Get a client credentials access token for the Transaction API
Learn how to authenticate with Instacart Connect so that you can use the Transaction API.
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 Transaction API, you need a bearer token with the client_credentials
grant type. To generate the token, use the authentication endpoint and specify your client ID and secret in the body.
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",
}'
The response contains the generated token.
{
"access_token": "<your_access_token>",
"token_type": "Bearer",
"expires_in": 86400,
"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.
You are ready to use send your transaction information with the Transaction API.