API Authentication with cURL
Summary of Content
Requirements
Authenticate using cuRL
Related Resources
Requirements
You must have a valid API token and Client ID. Learn more.
Authenticate using cURL
- Open your terminal.
- Identify your target /auth endpoint
For GCP organizations, use:POST https://api.sigmacomputing.com/v2/auth/token
For AWS organizations, use:
POST https://aws-api.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
}
Now what?
- Use the access_token from the response in future API calls. Try it with the WhoAmI endpoint.
- Use the refresh_token to refresh expired auth.
Note: An access token lasts for 1 hour.
Related Resources
Get an API Token and Client ID