Skip to main content

Authentication

All Backstory API requests require a valid bearer token. To generate a token, pass the appropriate API key and secret pair into the token generation API.

curl -X POST
https://api.people.ai/auth/v1/tokens
-H "Content-Type: application/x-www-form-urlencoded"
-d "grant_type=client_credentials&client_id={API key}&client_secret={API secret}"

Note that, according to the OAuth 2.0 specification, authentication requests must include the Content-Type: application/x-www-form-urlencoded header.

Argument

Description

grant_type (required)

The OAuth 2.0 standard used when an application requests an access token to access its resources

Accepted value:

  • client_credentials

client_id (required)

Public identifier for the API key

Accepted value:

  • Your API Key from the API Key Management module

client_secret (required)

Secret known only to the application and authorization server

Accepted value:

  • Your API Secret from the API Key Management module

Response

{
  "access_token": [access token],
  "token_type": "bearer"
  "expires_in": [remaining lifespan in seconds]
}

Attribute

Description

access_token

Token that the application uses to make a request on behalf of the user.

token_type

The token is a “bearer” token

expires_in

Lifespan of the access token in seconds

Access is provided in the JSON Web Tokens (JWT) format, and has a default lifespan of 7200 seconds. If you call the Token API before the access token has expired, the API will issue the new access token. The previously issued access token for this API key and secret will also remain active within its remaining lifespan.

Pass your newly generated bearer token in the Authorization: Bearer header of your API requests

Did this answer your question?