Getting Started with the API: Sandbox Environment

Monday, March 29, 2010 | 5:00 PM

Labels: ,

As most of you are now aware, there are two API environments - the sandbox and production. The production environment is the one in which your real ads run; this is the environment you log into on the website. The API also has a second environment, the sandbox, which allows developers to test their code before affecting any live running ads.  Production API access is in the process of being rolled out, and we'll have a blog post soon detailing how to get access. Today, we'll discuss some of the less known features of the sandbox and some new tools we've developed.

Inviting users to your network

A feature of the API that may be not immediately obvious is that the UserService allows a user with Administrator rights to create a user directly in their network. Any developer can currently do this without having the new user signup first. For example, if you are trying out the API for the first time, instead of performing every API call as an Administrator (the default for your email address), you may want to create a few users with roles such as Salesperson, Trafficker, or Advertiser to test real-world workflows.

  • Create some new gmail addresses such as
  • Alternatively, register an existing non-gmail address as a new Google account.
  • Call createUsers with that new address and the chosen Role.
  • You can now log in with that new user using that user's email and password while generating your authentication token.

As a quick note, calling createUsers with an address that already has access to the sandbox, will create a new network for that user. For example, if and separately sign up for the sandbox, each account has its own independent network and objects. If invites to their network by calling createUsers with will now have access to both networks. To decide which network will connect to, the correct networkCode will need to be supplied when making an API call. Making any API call without the proper networkCode will throw an exception.

Sandbox playground

We've listened your feedback and the top feature request was the ability to view the data in the sandbox. Today, we are announcing the DFP API Sandbox Playground.

With this online tool, you'll be able to log in via OAuth to view the objects within your network. We've also added the ability to test PQL statements directly in the tool. This app is built upon the current PHP sample web application and we'll backport many of the new features into the open-source application soon.

We also understand that having production access to the real website is also necessary for many developers. We are working on rolling this out and will have more information soon.

Monthly sandbox refresh

As a final note, the Sandbox is refreshed once a month as part of our server maintenance process. After a refresh, your account will only have the root ad unit, a test salesperson, and a test trafficker. We'll announce the next sandbox refresh coming up at the end of the month on our forum as usual.

Thanks for your continued feedback and support, and stay tuned for more info about our release to the production environment!

-- Adam Rogal, The DoubleClick for Publishers API Team