Step 3 Generating Tokens

In this step you will use your unique Client ID and Secret to generate a Bearer Token. Your Client ID (sometimes also referred to as your Consumer ID) and generated token are needed to authenticate any API call.

Before you begin:

To authenticate your access to our APIs, you need to have already submitted your public key to Walmart and have already received your unique Client ID and Secret. Please refer back to Step 2 Requesting Access if you need to complete this step.

If you already have your unique Client ID and Secret, you can begin generating Bearer Tokens.

To start, have the following ready:

  • Your Walmart issued, unique Client ID
  • Your Walmart provided Secret

Generating Your Token

You can generate your Token using any appropriate tool. We recommend using our Get Token API!

To generate your Token using cURL, pass the following applicable cURL command in your terminal:

Sandbox Environment Command

curl --location --request POST 'https://developer.api.stg.walmart.com/api-proxy/service/identity/oauth/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=YOUR_CLIENT_ID' \
--data-urlencode 'client_secret=YOUR_CLIENT_SECRET'

Production Environment Command

curl --location --request POST 'https://developer.api.walmart.com/api-proxy/service/identity/oauth/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=YOUR_CLIENT_ID' \
--data-urlencode 'client_secret=YOUR_CLIENT_SECRET'

Where:

  • YOUR_CLIENT_ID = your Walmart issued Client ID
  • YOUR_CLIENT_SECRET = your Walmart issued Secret

The output of the above command will be a generated token:

{"access_token":"eyJraWQiOiIxMTk5MWNlNC1jMzRmLTQ0ZTQtYmEwNS1jYWQwNzM3NjczYWMiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..1TzVXg3ZHGA4WNhl.6xtCm7npLkf-K8C-kP1Dl9fHacQkofQ9cN-4ITxn_7wESIIGOBtAKtGQSnkMRM48ZlfSj9K_yxjCkGzNg5ckYIiC8tM_arqJF9xZTtoLQt0j20n4piF3fIuddEYD3T3pLj79b169xnBFLJwG-...

This value must be used for request header: Authorization

📘

The generated token has a Time-To-Live (TTL) of 15 minutes (900 seconds) and will need to be regenerated. Please plan your API calls accordingly.

Now that you can generate Bearer Tokens, you are ready to start invoking APIs!





©️Walmart | All Rights Reserved