Getting Started with Product Advertising API - Product Advertising API

Getting Started with Product Advertising API

This section provides step-by-step instructions that you must complete before you can submit your first Product Advertising API request.

Becoming an Associate

Associates earn commissions by using their own websites to refer sales to To get a commission, an Associate must have an Associate ID, also known as an Associate tag. The Associate ID is an automatically generated unique identifier that you will need to make requests through the Product Advertising API.


You must register for Amazon Associates before you register as a Product Advertising API developer. If you make a request with an invalid Associate ID, the Product Advertising API returns an error.

To become an associate

  1. Using the following table, choose the Amazon Associates URL for your locale.

  2. Follow the instructions to create an Amazon Associates account.

  3. When you register as an Amazon Associate, an Associate ID is sent you in email. When you sign in to Amazon Associates for your locale, the home page shows your email and ID in the corner.


One of the requirements for becoming an Associate is that you provide the URL of your site. If your site is not yet public but you want to test against the API, you must still provide a URL during registration.

Your Associate ID works only in the locale in which you register. If you want to be an Associate in more than one locale, you must register separately for each locale.

Becoming a Product Advertising API Developer

The Product Advertising API allows developers to advertise products from the following Amazon sites:


Before you register for the Product Advertising API, register for Amazon Associates. See Becoming an Associate.

To register as a Product Advertising API developer

  1. On the Amazon Associates page, under Tools, choose Product Advertising API. You can also use the table at the bottom of this page to locate the Product Advertising API URL for your locale.

  2. Choose Sign Up Now.

  3. Use the primary or secondary email address in your Associates account to sign in.

  4. Follow the steps to register.

  5. On the Success page, choose Manage Your Account. We automatically create an AWS account for you. You will use your AWS account security credentials to make calls to the Product Advertising API.

  6. On the Manage Your Account page, choose the AWS Security Credentials Console link. Sign in to your AWS account with the same email address and password you used to register for the Product Advertising API.

  7. On the pop-up message, choose Get Started with IAM Users. In the following steps, you will create an IAM user and then give the user permission to access the Product Advertising API.

  8. Choose Add user.

  9. Type a user name such as ProductAdvertisingAPI-user. For Access Type, check Programmatic access.

  10. Choose Next: Permissions.

  11. Choose Attach existing policies directly.

  12. Choose Create policy. This opens a new page.

  13. For Create Your Own Policy, choose Select.

  14. On the Review Policy page, for Policy Name, type a name such as AmazonProductAdvertisingAPIFullAccess.

  15. For Description, type a description such as: "This policy provides full access to all operations of the Product Advertising API."

  16. For Policy Document, copy and paste the following policy in the field.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ProductAdvertisingAPI:*", "Resource": "*" } ] }

    The following is an example Product Advertising API policy.

  17. Choose Validate Policy and then choose Create Policy.

  18. Return to the Add user page and for Policy type, search and choose the policy that you created. Choose Refresh if the policy doesn't appear.

  19. Choose Next: Review.

  20. Review your choices and then choose Create user.

  21. Choose Download.csv to retrieve the credentials or choose Show to find the secret access key.

  22. Save the access key information in a safe location. You will use these credentials to make calls to the Product Advertising API.


    You can access the secret access key only when you first create an access key pair. For security reasons, it cannot be retrieved at a later time. Make sure you save both the access key ID and its matching secret key. If you lose them, you must create a new access key pair.

  23. When finished, choose Close. The user has the permissions required to access the Product Advertising API.


As a best practice, use the IAM user credentials to access the Product Advertising API. You can continue using your root credentials, but root credentials provide unlimited access to your AWS resources. An IAM user has permission to access only the services you specify.

Reading the Licensing Agreement

You will need to review and accept the terms and conditions of the license agreement to become a Product Advertising API developer. To read the Product Advertising API licensing agreement, go to the license agreement link for your locale:


If you plan to use the Product Advertising API to advertise Amazon products from a locale other than the one you signed up in, review the license agreement for that locale. The terms and conditions for each locale apply to any use of the Product Advertising API in that locale.

Review the Amazon Product Advertising API Best Practices to make sure your application is compliant, scalable, and efficient.


In addition to the Product Advertising API License Agreement, be sure to read your locale's Associates Program Operating Agreement for information on usage guidelines, policies, and requirements.

Get the Tools You Need

Product Advertising API requests can be integrated into applications using most modern programming languages. In the table below, click the tool you would like to use to implement Product Advertising API. The link directs you to the website where you can download and install the appropriate toolkit.

Language API Style Tools Used



  • Java 6 or later

    Make sure the PATH environment variable points at the Java installation.

  • Eclipse 3.2 or later

    If you use Eclipse as your interactive development environment (IDE), you must use version 3.2 or later. You can, however, use other IDEs, such as NetBeans.





To download the modules used in the following Perl example, go to CPAN website:

  • Digest::HMAC_SHA256

  • MIME::Base64

  • LWP

  • XML::XPath

  • Date::Format



The PHP example uses the base installation of PHP5.

Because PHP configurations vary, we're using a command-line interface to run our example. You can also run the example through a web server, but those details are not covered in this guide.

Product Advertising API Signed Requests Helper

All requests you send to Product Advertising API must be authenticated using a signed version of the request.

You can use the Product Advertising API Signed Requests Helper to generate this signed request. You can use this tool online or download it to your machine.

Product Advertising API Scratchpad

You can also use the Product Advertising API Scratchpad to generate sample requests and responses.

Set Up Your Development Environment

This section helps you confirm that your development environment is set up correctly. Skip to the section that corresponds to the toolkit you downloaded.

Or, if you are viewing this document online, you can view the setup steps for your preferred programming language by using the Filter View list on the top-right corner of the page.

Java Setup

You can implement Product Advertising API operations directly in Java. You can also generate and use the Product Advertising API Java Client-Side library to simplify your Java implementations. This section explains how to generate the Product Advertising API Java Client-Side Library. The next section shows you how to use it to create a request.

Generating the Stubs

You use the wsimport utility in Java 6 to generate the stubs from the Product Advertising API WSDL, which is located at

To generate the Product Advertising API client-side library stubs

  1. Go to the directory where you want to generate the stubs and create a "build" directory and a "src" directory.

    All of the generated source code goes under "src" folder.

  2. If you are using Eclipse 3.2, create a custom binding to disable "Wrapper Style" code generation.

    <jaxws:bindings wsdlLocation="" xmlns:jaxws=""> <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle> </jaxws:bindings>

    This step is required because Eclipse 3.2 does not support wrapper-style generated code. If your IDE, such as NetBeans, supports wrapper-style generated code, this step is not required.

  3. Run the command:

    wsimport -d ./build -s ./src -p com.ECS.client.jax -b jaxws-custom.xml .

    You can find the generated stubs in the path, com.ECS.client.jax.

Generated File Types

Several file types are generated in the package, com.ECS.client.jax:

  • AWSECommerceService—This file identifies the Product Advertising API service.

  • AWSECommerceServicePortType—This file provides the port type that the client can listen on.

    This file also contains a list of all Product Advertising API operation signatures that can be used to build the client.

C# Setup

Product Advertising API requires that you have successfully installed Microsoft Visual Studio.

To confirm the installation

  1. Open Microsoft Visual 2005 C# Express Edition.

  2. Click Help > About Microsoft Visual Studio.

    The dialog box that opens should list Microsoft Visual Studio 2005 and version 2.0 of the .NET Framework.

Create the SOAP Proxy in Visual Studio

In your application, you must add a web reference to the Product Advertising API WSDL you want to use.

To add a web reference

  1. On the Project menu, click Add Web Reference.

  2. In the URL box, type, and then click Go.

  3. Click Add Reference.

A new Web References folder is added to the Solution Explorer.

You can now reference the SOAP proxy using your project namespaces. For example:


Perl Setup

Run the following commands to verify that you have installed all of the required Perl modules:

perl -MDigest::HMAC_SHA256 -e 1 perl -MMIME::Base64 -e 1 perl -MLWP -e 1 perl -MXML::XPath -e 1 perl -MDate::Format -e 1

You should not receive any error messages.

PHP Setup

To verify your PHP installation

  • Use a command-line interface to run the following command:

    php -version

    This command assumes you are either in your PHP installation directory or it is in your PATH system variable.

The response should be similar to the following:

PHP 5.1.2 (cli) (built: Jan 11 2006 16:40:00) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies