Skip to navigation

Generate a token

Generate a token for usage with authenticating via OAuth2 in subsequent API calls.

Supports the following grant types:

  • client_credentials — exchange client ID and secret for an access token.
  • authorization_code — exchange an authorization code (from the OAuth2 authorize flow) for an access token and refresh token. Requires code, redirect_uri, and optionally code_verifier (for PKCE) and state.
  • refresh_token — exchange a refresh token for a new access token and refresh token.

Note: This endpoint is available at the absolute URL /oauth/token (not relative to the versioned API base path).

Request

This endpoint expects an object.
grant_typeenumRequired
Allowed values:
client_idstringOptional
ID of client to request token for. Leave off if client ID and secret are being supplied through Authorization header.
client_secretstringOptional
Leave off if client ID and secret are being supplied through Authorization header.
codestringOptional

Authorization code received from the authorize endpoint. Required when grant_type is authorization_code.

code_verifierstringOptional

PKCE code verifier. Required when grant_type is authorization_code and a code_challenge was sent in the authorization request.

redirect_uristringOptional

Redirect URI that was used in the authorization request. Required when grant_type is authorization_code.

refresh_tokenstringOptional

Refresh token to exchange for a new access token. Required when grant_type is refresh_token.

statestringOptional

Optional state parameter for the authorization_code grant type.

Response

Generated token
access_tokenstring
expires_ininteger
Number of seconds that the access token is valid for
token_typeenum
Allowed values:
refresh_tokenstringOptional

Refresh token. Returned when grant_type is authorization_code or refresh_token.

refresh_token_expires_inintegerOptional

Number of seconds that the refresh token is valid for. Returned when a refresh_token is included in the response.

Errors

400
Get Token OAuth Request Bad Request Error
401
Get Token OAuth Request Unauthorized Error