Getting Started with the Insights API

This guide will walk you through making your first couple of requests to the Babel Street Insights API.

Authentication

Each call to the Insights API requires an access token. Before making any API calls, you must obtain an access token by calling the /identity/token endpoint. This endpoint requires a username and password, along with an API key. The username and password are the same ones you use to login to the Babel Insights application.

Once you have obtained the access_token, you must include it in the token header of all subsequent API requests (except for the authentication request itself). This tells the server that you are authorized to access protected resources.

  • The access token is valid for 4 hours, after which you must obtain a new one.
  • You can use a refresh token to obtain a new access token without needing to provide your username and password again.
  • The refresh token is valid for 15 days, after which you must provide your username and password again to obtain a new access token.

Let’s generate an access token through this portal.

  1. Navigate to the Insights API Reference.

  2. Select POST Retrieve authentication token

  3. Click on the Try it out button. This will bring you to the SDK documentation platform, where you can interactively modify parameters and execute calls to the API.

  4. In the X-Api-Key field, enter your API key. This is a unique identifier for your application and is required for authentication.

  5. In the body parameters, enter your username and password. These are the same credentials you use to log in to the Babel Street application.

  6. The code snippet is now filled with your values. Select Send Request to execute the request.

  7. If successful, you will receive a response with a status code of 200 and a JSON object containing:

  • An access token, which you will use in subsequent API calls.
  • A refresh token, which can be used to obtain a new access token without needing to provide your username and password again.

You can also use the curl command line tool to make the request. If you have cURL installed, you can run the following command in your terminal:

$curl -X POST https://api.babelstreet.com/auth/v1/identity/token \
> -H "Authorization: Bearer <api-key>" \
> -H "Content-Type: application/json" \
> -d '{
> "username": "your-username",
> "password": "your-password"
> }'

Making Your First Request

Once you have obtained an access token, you can use it to make requests to the Insights API.