Get a client credentials access token for the Compliance API
Learn how to authenticate with Instacart Connect and make your first Compliance API call.
Before you begin
For this tutorial, you need the following items:
- Your client ID and secret
- The base URL of your assigned Instacart development server
Generate a token
To make requests to the API, you need a bearer token with the client_credentials grant type. To generate the token, use the authentication endpoint, specify your client ID and secret in the body, and set the scope to connect:compliance.
curl --request POST \
--url 'https://<instacart_development_domain>/v2/oauth/token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"client_id": "<your_client_id>",
"client_secret": "<your_client_secret>",
"grant_type": "client_credentials"
"scope": "connect:compliance"
}'
The response contains the generated token.
{
"access_token": "<your_access_token>",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "connect:compliance",
"created_at": 1603897760
}
note
The token is valid for 24 hours. During this period, reuse the same token in your requests. After 24 hours, you must generate a new token.