Skip to main content

Amazon Advertising API Request Format

Intro

The official documentation for the Amazon Advertising API has some gaps or poorly worded information regarding the proper configuration of calls to the Advertising API. The goal of this post is to provide a clear example of how to properly configure these requests.

Say for example we would like to make a request to one of these endpoints:

Amazon Advertising API - Sponsored Products

Required Parameters

For basically all of these endpoints we require the following "parameters"

ParameterWhat it is
AuthenticationValid Amazon profile Access Token
Amazon-Advertising-API-ClientIdThe client ID from developer registration process
Amazon-Advertising-API-ScopeThe Advertising Profile ID

Getting these credentials is a multi-step process. The client ID is a fairly straightforward part of the application to the API so if you are reading this you likely already have this. This ID remains static regardless of which advertising profile we are querying and does not expire. Therefore we will not cover how to obtain this in this post.

Getting the Access Token

The documentation to retrieve the Access Token is covered in reasonable detail, but the exact configuration of the request is tricky. Here is a screenshot of a Postman setup.

access token request headers

Note the very specific Content-Type of application/x-www-form-urlencoded;charset=UTF-8

And then for the body note the following settings.

access token request body

These will vary depending on whether you are exchanging an auth code or a refresh token, but the format is basically the same.

Be absolutely certain that you are not making your secret key publicly available. This request cannot be sent directly from a web application client, it must be sent from a secure server, or if you are running a serverless application architecture, you must route this request through Lambda or a similar service.

At this point we have two of the three key pieces of information that we require to make requests to the advertising API. All we have left is...

Getting the Profile ID

Commonly an Amazon account will have access to more than one advertising profile, therefore when we make the request for the profiles information we get back an array of advertising profile data. If the Amazon account does not have access to any advertising profiles the array will be empty.

profiles array

Note that in this instance we only require the Client ID and User Access Token. Also the body of the request is blank.

Putting It All Together

We now have the three items that we need we can put together a request to a list of Advertising Campaigns for our chosen advertising profile.

request campaigns

The official documentation refers to the Client ID and Scope as parameters, but they are in fact headers. Adding these items as parameters will fail the request.

Once your request is working properly in Postman you can then convert it to whatever format you like.

Comments

Recent Work

Free desktop AI Chat client, designed for developers and businesses. Unlocks advanced model settings only available in the API. Includes quality of life features like custom syntax highlighting.

Learn More

BidBear

bidbear.io

Bidbear is a report automation tool. It downloads Amazon Seller and Advertising reports, daily, to a private database. It then merges and formats the data into beautiful, on demand, exportable performance reports.

Learn More