AdWords API
Feedback on this document

Using the Sandbox

The AdWords API sandbox is a testing and development environment that replicates the functionality of the production AdWords API web services. Here are some reasons to use the sandbox for developing your application:

  • Calls made in the sandbox are free, so you can develop and debug your applications without spending API units.
  • Sandboxed campaign data has no effect on live campaigns, so you can test campaign management logic without affecting live campaign data.
  • Sandbox access does not require an AdWords account or a developer token, so you can experiment with the AdWords API before registering as an AdWords developer.

However, the sandbox environment has its limitations:

  • The sandbox enforces rate limiting differently than the production environment. Do not use the sandbox for load testing; a throughput of requests that succeeds in the sandbox might fail in the production environment.
  • Do not rely on the sandbox to persist stored data (campaigns, ads, report definitions) for longer than a month.
  • Services that return statistics will intentionally return fake data, and certain features will behave differently than their production counterparts.

In this document:

  1. Getting Started
  2. Sandbox Behavior

Getting Started

To start using the sandbox, you need to initialize your sandbox account. We recommend downloading a client library, which has code examples demonstrating the necessary steps.

  1. To access the sandbox, the first thing you need is a Google Account (if you don't have one, create a new account). You will use this account's email address and password to set the sandbox-specific request headers.
  2. Edit your client library’s configuration to use your Google Account username and password (see the library-specific README for details on how to set the developer token to email++currency_code—this is a magic value for the sandbox only—for example: your.name@gmail.com++USD). Leave the clientCustomerId blank for now; we’ll come back and edit it later.
    • Some libraries configure the environment/endpoint in the config file. We want to make sure we use the SANDBOX environment—the server is located at https://adwords-sandbox.google.com
  3. In order to initialize a sandbox MCC account with client accounts, run your client library’s GetCampaigns code example. Since we left the clientCustomerId blank, this will request the campaigns for a new Sandbox My Client Center (MCC) account (for which your Google Account is used to authenticate). MCC accounts don’t normally contain Campaigns, however, this is a special hook that the server uses to initialize your sandbox MCC account with 5 client accounts.
    • This newly generated MCC account is not the same as the account you’ll use to sign up for the API. The Google Account you use for the sandbox can be an MCC, regular client account, or even a Google Account that has no AdWords product associated with it.
  4. Now that your sandbox MCC account has been initialized with 5 client accounts, we need to know their clientCustomerIds to make requests. Run the GetAccountHierarchy example. This will print out the ID of client account(s) managed by your sandbox MCC account.
  5. Edit your configuration file (see step 2) and insert the clientCustomerId of your client account. This tells the API you are going to authenticate with your Google Account (which is an MCC in the sandbox) and target the client account corresponding to the clientCustomerId.
  6. Now we can start making requests. Run the AddCampaigns example followed by the GetCampaigns example. We’re now specifying a clientCustomerId, so AddCampaigns creates campaigns for the client account and GetCampaigns prints them out. Try out more code examples to see what they do!

You can change the clientCustomerId to target different sandbox client accounts. If you leave it blank, the request will target the MCC account (for use with examples such as GetAccountHierarchy). For most types of requests, you’ll want to specify the clientCustomerId.

Sandbox WSDL Locations

To access the sandbox instead of the production environment, connect to the sandbox versions of the AdWords API web services. The sandbox WSDL URLs are identical to their production counterparts, except their domain is adwords-sandbox.google.com instead of adwords.google.com:

Production URL https://adwords.google.com/api/adwords/cm/v201209/CampaignService
Sandbox URL https://adwords-sandbox.google.com/api/adwords/cm/v201209/CampaignService

Sandbox Request Headers

In addition to the changing the URL, you also provide a different set of SOAP request header values:

authToken (same as production environment)
Authenticates and authorizes the request to the sandbox. For more information, see the authToken documentation.
developerToken
Identifies the sandbox account and its associated currency code. A string of the form login++currency_code, where login is your Google account's email address and currency_code identifies the currency code associated with this sandbox account. Your initial call to the sandbox sets the currency code for your sandbox account. Once you set the currency code, you cannot change it.
userAgent
An arbitrary string that identifies the intent of the request.
clientCustomerId (optional)
Specifies the client account. Since your sandbox account is an MCC account, you must specify a client account if you want to experiment with campaign data. You can use ServicedAccountService.get() to retrieve client customer IDs.

Note: Sandbox response headers are identical to those returned in the production environment.

Sandbox Behavior

To help you better deterministically test your applications in the sandbox (and to prevent statistic-returning services from providing actual data) certain web services and features are designed to behave differently in the sandbox.

Ad policy checking (AdGroupAdService)
In the sandbox, only repeated punctuation will trigger a policy violation error.
Keyword and placement ideas (TargetingIdeaService)
Returned ideas will be of the form {"sample keyword 0", "sample keyword 1", ...}. Returned attributes will contain random values.
Media handling (MediaService)
Any uploaded media data is immediately discarded. You can reference uploaded media objects by ID, but the returned URL is set by the sandbox.
Reporting (ReportDefinitionService)
Statistics in downloaded reports will be 0. To download a report generated from the sandbox, request it from the following sandbox-specific URL:
https://adwords-sandbox.google.com/api/adwords/reportdownload?__rd=REPORT_DEFINITION_ID

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.