Get access token

Use your Sigma client ID and secret with this endpoint to generate an access token valid for one hour, or to refresh your token. You can then use the access token to authenticate requests made to the Sigma API.

Recipes
🔒
Authentication: Get Access Token (JavaScript)
Open Recipe

To make any API call with the Sigma API, including calls from the API documentation, you must have a valid bearer token. Before you can generate a token, you must have a valid Client ID and Secret. See Generate Sigma API client credentials.

You make all API calls to a specific URL that corresponds to the cloud where your Sigma environment is hosted. Set the Base URL to the relevant URL for your environment. For details, see Identify your API request URL.

Generate a token by sending a POST request to this /v2/auth/token endpoint, or use the Try It! option on this page. If you use the Try It! option, the token is automatically used for any other API calls you make from the API reference documentation pages during your browser session.

📘

The API token is valid for 1 hour. When the token expires, an endpoint response returns an unauthorized error.

Get an access token

To retrieve a valid access token for the Sigma API, send a POST request with the following data:

  • Set an endpoint-url that corresponds to the cloud where your Sigma environment is hosted. See Identify your API request URL.
  • Set the grant_type parameter to client_credentials.
  • Send a client_id parameter with the value of your Sigma API client ID.
  • Send a client_secret parameter with the value of your Sigma API secret.

For example:

curl --location --request POST '{endpoint-url}' \  
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id={client_id}' \
--data-urlencode 'client_secret={client_secret}'

Refresh an access token

When you request an access token, the response includes a refresh token that you can use to refresh your access token after it expires. Use a refresh token whenever possible instead of generat

  • Set the grant_type to refresh_token.
  • Send a refresh_token parameter with the value of the refresh token provided when you got the access token.
  • Send your client_id and client_secret to authenticate your request.

For example:

curl --location --request POST '{endpoint-url}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'refresh_token={refresh_token}' \  
--data-urlencode 'client_id={client_id}' \
--data-urlencode 'client_secret={client_secret}'
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!