The AdWords API is no longer supported. Use the Google Ads API instead.

API Call Structure

This guide describes the elements of an API call and demonstrates making a basic call using cURL.

If you're using a client library or a SOAP library to interact with the API, you probably won't need to worry about the underlying SOAP and XML. However, knowing a bit about them can come in handy when testing and debugging.

Making calls to the API involves sending HTTPS POST requests to a service and interpreting the response. The body of the request and response is comprised of XML defined by a WSDL.

WSDL elements

You can print the WSDL by appending a ?wsdl to the service URL:

Request headers

HTTP headers accompany the SOAP+XML body in the request:

You need to include an OAuth2 access token in the form of Authorization : Bearer access-token that identifies either a manager account acting on behalf of a client, or an advertiser directly managing their own account. Directions for retrieving an access token can be found in the OAuth2 guide. An access token is valid for an hour after you acquire it; when it expires, refresh the access token to retrieve a new one. Note that our client libraries automatically refresh expired tokens.
A 22-character string that uniquely identifies an AdWords API developer. An example developer token string is ABcdeFGH93KL-NOPQ_STUv.
A user-specified string that defines the sender and purpose of the request. Set this to your application name and version in order to help us find your requests when diagnosing a problem, for example,
Customer ID of the target Google Ads account, typically in the form of 123-456-7890. Required for all calls to all services except CustomerService and ReportDefinitionService.
validateOnly (optional)
If set to true, the request is validated but not performed. You can use this header to validate user-provided data.
partialFailure (optional and available for only some services)
If set to true, the service will perform all operations that are free of errors, and return the errors for the failing operations. This header is ignored for non-mutate operations.

Response headers

The following headers are returned with the response XML. We recommend that you log these values for debugging purposes.

String that uniquely identifies this request.
Number of operations performed in this request.
Elapsed time in milliseconds between the web service receiving the request and sending the response.

API call example

This example demonstrates how to interact with the API using cURL. Although cURL and SOAP+XML would be impractical for building a real-world application, the example demonstrates how the AdWords API functions at the lowest level.


  1. Get your OAuth2 client ID and client secret (if you haven't done so already). Follow the instructions in the OAuth2 guide.

  2. Get an OAuth2 access token. To request your access token from OAuth2, enter your OAuth2 client ID in the following URL, and paste it in your browser:

    A screen appears where you grant your application access to your Google Ads data:

    After you accept the request, you'll receive an authorization code that can be exchanged for an access token.

    Finally, make the request to exchange the authorization code for an access token:

    curl \
      -d code=authorization-code \
      -d client_id=client-id \
      -d client_secret=client-secret \
      -d redirect_uri= \
      -d grant_type=authorization_code

    If you've made a proper request, Google will return your OAuth2 access token. The access token is what you need when sending requests to AdWords API services.

    "access_token" : "ya29.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "token_type" : "Bearer",
    "expires_in" : 3600,
    "refresh_token" : "1/Ixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  3. Create a SOAP request. The following sample XML snippet defines a SOAP request that adds a budget. Save this XML (with your authentication token and account login replacing the placeholders) as hello_world.xml. The XML elements are defined in the WSDL.

    <?xml version="1.0"?>
    <soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
        <ns1:RequestHeader xmlns:ns1="" soapenv:actor="" soapenv:mustUnderstand="0">
        <mutate xmlns="">
              <name>Hello World</name>
              <settings xmlns:ns2="" xsi:type="ns2:GeoTargetTypeSetting">
                <biddingScheme xmlns:ns4="" xsi:type="ns4:ManualCpcBiddingScheme">
  4. Send the request. Use cURL to send this SOAP request to CampaignService. You can send your access token by including it in the HTTP header like this:

    curl --header "Content-Type: application/soap+xml" \
         --header "Authorization: Bearer access-token" \
         --data @hello_world.xml \


After the AdWords API server processes your request, it returns a response that contains the XML data representing the newly-added campaign:

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="">
    <ResponseHeader xmlns="">
    <mutateResponse xmlns="">
          <name>Hello World</name>
          <settings xmlns:xsi="" xsi:type="GeoTargetTypeSetting">
            <biddingScheme xmlns:xsi="" xsi:type="ManualCpcBiddingScheme">