API authentication with cURL
Requirements
You must have a valid API token and Client ID; see Get an API Token and Client ID.
Authenticate using cURL
-
Open your terminal.
-
Identify your target /auth endpoint URL based on your organization's cloud platform and region. For information about identifying your platform host, see Region, warehouse, and feature support.
https://api.sigmacomputing.com/v2/auth/token
https://aws-api.sigmacomputing.com/v2/auth/token
https://api.ca.aws.sigmacomputing.com/v2/auth/token
https://api.eu.aws.sigmacomputing.com/v2/auth/token
https://api.au.aws.sigmacomputing.com/v2/auth/token
https://api.us.azure.sigmacomputing.com/v2/auth/token
-
Run the following command:
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={api_token}'
-
Expected Response:
{ οΌaccess_tokenοΌ: {access_token}, οΌrefresh_tokenοΌ: {refresh_token}, οΌtoken_typeοΌ: οΌbearerοΌ, οΌexpires_inοΌ: 3600 }
Use the access_token from the response in subsequent API calls as a Bearer token.
Try it with the WhoAmI endpoint to verify it is valid.
Note that the access token expires after 1 hour (3600 seconds).
Generate a refresh token
Use the refresh_token
to refresh an expired auth token.
Run the following command:
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={api_token}'
Updated 4 months ago
Related resources