Acquire a new OAuth token

🚧

Closed Release

This feature is a Closed Release, available for a limited number of users and specific use cases only.

To acquire a new API token with OAuth 2.0, you need four pieces of information from the Tango portal—the client ID, client secret, service account username, and service account password. Once you have the above information ready, use thePOST {URI}/oauth/token endpoint (at least once every 24 hours) to send an API request and get a new token.

See how to get the client ID, client secret, username, and password: Use OAuth for secure connection.

📘

Note:

  • You can get unlimited tokens. There's no restrictions in the number of tokens.
  • An access token can only be used for 24 hours once created. Fetch a new token at least once every 24 hours to authenticate calls. New tokens can be generated using the same client credentials and service accounts, or the updated credentials.

Use the following endpoint to request a new OAuth token:

EndpointDescription
POST {URI}/oauth/tokenTo acquire a new oauth token.

The following parameters can be used in your request:

ParameterData typeDescription
client_idstringYour client ID created in the Tango portal under OAuth client credentials.
client_secretstringYour client secret created in the Tango portal under OAuth client credentials.
usernamestringThe Service Account username created in the Tango portal under OAuth Service Accounts.
passwordstringThe Service Account password created in the Tango portal under OAuth Service Accounts.
scopestringList of space-separated OAuth scopes, static, the value is always raas.all.
audiencestringAudience for the token, static, the value is always https://api.tangocard.com/.
grant_typestringType of the OAuth flow in progress, static, the value is always password.

The following headers are used in your request:

HeadersData type
Content-typestring
Acceptstring

Here's an example of the above parameters in the code:

curl --request POST \
    --url https://sandbox-auth.tangocard.com/oauth/token \
    --header ‘Accept: application/json’ \
    --header ‘Content-Type: application/x-www-form-urlencoded’ \
    --data client_id= string \
    --data client_secret=string\
    --data username=string \
    --data ’password=string \
    --data scope=raas.all \
    --data audience=https://api.tangocard.com/ \
    --data grant_type=password

Here's an example of the returned payload:

{
  "access_token": "<string>",
  "scope": "<string>",
  "expires_in": "<integer>",
  "token_type": "Bearer"
}

The response message for this endpoint is. For details, see i18nkey codes and their error messages:

  • 200 OK
  • 400 Bad request
  • 401 Unauthorized

© 2025 Tango API are provided by Tango, a division of BHN, Inc.