Create an access token
POST
/partner/authorization/token
const url = 'https://client-api.abi.ai/partner/authorization/token';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"subPartnerName":"partner_test"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://client-api.abi.ai/partner/authorization/token \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "subPartnerName": "partner_test" }'Exchange the partner API key for an access token. Include subPartnerName only when the token must be scoped to a configured sub-partner. The request body may be omitted entirely.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
Optional body used to scope the issued token to a configured sub-partner. The API key is sent in the x-api-key header, not in this body.
object
subPartnerName
Exact registered sub-partner name to scope the token.
string
Example
partner_testResponses
Section titled “Responses”Access and refresh tokens created.
Media typeapplication/json
object
access_token
Bearer token for authenticated API requests.
string
token_type
string
refresh_token
Token used to obtain a replacement access token.
string
Example
{ "access_token": "your_access_token", "token_type": "Bearer", "refresh_token": "your_refresh_token"}Request could not be completed.
Media typeapplication/json
object
code
Short machine-readable error code.
string
message
Human-readable explanation of the error.
string
Examplegenerated
{ "code": "example", "message": "example"}