Authenticate

An API for retrieving your access token for authentication.

This guide will help you connect to our API using OAuth authentication. This document will guide you through setting up and using these authentication methods in your preferred programming language. For reference, you can also try out your authentication and the entire API in the OpenAPI Spec.

Prerequisites

Before you begin, ensure you have the following:

-A Blackbird AI account.

-Your client credentials (Client ID and Client Secret) for the Client Credentials flow.

Download OpenAPI description
Languages
Servers
Mock server
https://docs.blackbird.ai/_mock/token/
https://blackbird-ai.auth.us-west-2.amazoncognito.com/

Get token

Request

Exchange authorization code or refresh token for an access token.

Bodyapplication/x-www-form-urlencodedrequired
grant_typestring

The grant type. Either authorization_code or refresh_token.

Enum"authorization_code""refresh_token"
Example: "client_credentials"
codestring

The authorization code received from the authorization server (required if grant_type is authorization_code).

refresh_tokenstring

The refresh token (required if grant_type is refresh_token).

client_idstring

Your application's client ID.

Example: "your_client_id"
client_secretstring

Your application's client secret.

Example: "your_client_secret"
redirect_uristring

The redirect URI, which should match the one used in the authorization request (only required for authorization_code grant type).

curl -i -X POST \
  https://docs.blackbird.ai/_mock/token/oauth2/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d grant_type=client_credentials \
  -d client_id=your_client_id \
  -d client_secret=your_client_secret

Responses

Access token and refresh token are returned successfully.

Bodyapplication/json
access_tokenstring

The access token to use for API requests.

Example: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
token_typestring

Token type, typically "Bearer".

Example: "bearer"
expires_ininteger

Time in seconds until the access token expires.

Example: 3600
refresh_tokenstring

The refresh token for obtaining a new access token when the current one expires.

Example: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response
application/json
{ "access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "token_type": "bearer", "expires_in": 3600, "expires_at": 1728577218, "refresh_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }