Step 1: Authenticate

Authenticate and make your first API call

Once you have your API keys, it's time to authenticate and make your first Railz API call. In this step, you will:

  • Get your access token
  • Make your first API call

Get your Access Token

Railz uses API keys to authenticate requests. The API key needs to be included in all API requests to the server with an Authorization header: Authorization: Bearer your_acces_token.

Use your API keys to generate an access_token using the GET /getAccess API.

Copy the access_token returned in the response. You will need it to complete the next steps.

📘

An access_token is valid for 60 minutes. We recommend getting a new access_token before calling each API endpoint. See API Authentication section for more details.

Make your First API Call

Most API requests interact with a connection. Each business can have multiple data connections to different service providers. Now that you have an access token, let's make your first API call to get a list of your businesses and their connections using the coding language of your choice.

  1. Create a new REST client using https://api.railz.ai as the base URL.
  2. Add the Authorization header using the access_token you copied above.
  3. Create a GET request to the /businesses endpoint.
curl --request GET \
     --url https://api.railz.ai/businesses \
     --header 'Accept: application/json'
     --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkIjo1LCJzYW5kYm94IjpmYWxzZSwibmFtZSI6ImFjY2VzcyIsImJldGEiOnRydWUsImlhdCI6MTYzMzc5MzU.'
import requests

baseUrl = "https://api.railz.ai/businesses"
authHeader = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkIjo1LCJzYW5kYm94IjpmYWxzZSwibmFtZSI6ImFjY2VzcyIsImJldGEiOnRydWUsImlhdCI6MTYzMzc5MzU."

requestHeaders = {"Accept": "application/json", "Authorization": authHeader}

response = requests.request("GET", baseUrl, headers=requestHeaders)

print(response.text)

Did this page help you?