Billing and Budget

For more information and control over the billing of your account(s), you can use the BillingInfo and Budget resources. The BillingInfo resource allows you to determine which billingIds belong to a given account and can also list all billingIds you have access to. The Budget resource can be used to view and modify the budget of a PretargetingConfig with a matching billingId. The budgetAmount will reflect the daily maximum that can be spent. On reaching this limit, you will no longer receive bid requests for the associated PretargetingConfig for the remainder of the day.

The Ad Exchange Buyer REST API v1.4 provides these resources to:

The example below illustrates the use of the Budget resource.

Get billing IDs

To view the BillingInfo for a given Ad Exchange account, send an HTTP GET request to the billinginfo URI with the following format:

GET https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo/accountId

Request

GET https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo/123456789

Response

{
  "billingId": [
    "4321",
    "1234",
    "2314"
  ],
  "kind": "adexchangebuyer#billingInfo",
  "accountName": "test_account",
  "accountId": 123456789
}

List billing IDs

To list the Billinginfo for all accounts you have access to, send an HTTP GET request to the billinginfo URI with the following format:

GET https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo

Request

GET https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo

Response

{
  "items": [
    {
      "billingId": [
        "4321",
        "1234",
        "2314"
      ],
      "kind": "adexchangebuyer#billingInfo",
      "accountName": "test_account",
      "accountId": 123456789
    },
    {
      "billingId": [
        "3412",
        "2143"
      ],
      "kind": "adexchangebuyer#billingInfo",
      "accountName": "test_account_2",
      "accountId": 987654321
      }
  ],
  "kind": "adexchangebuyer#billingInfoList"
}

Get budget

You can request a particular budget by sending an HTTP GET request to the billinginfo URI. The URI has the following format:

GET https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo/accountId/billingId

Request

GET https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo/123456789/4321

Response

If successful, the server responds with a Budget resource in the response body.

{
  "kind": "adexchangebuyer#budget",
  "budgetAmount": "60000",
  "billingId": "4321",
  "currencyCode": "USD",
  "accountId": "123456789"
}

Update budget

To update and fully replace an existing budget:

  1. Retrieve the Budget resource that you want to update.
  2. Modify the properties you want to change.
  3. Send a PUT request to the resource URI and supply the modified resource as the message body.

The URI for the Budget Resource has the following format:

PUT https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo/accountId/billingId

Request

Here is an example of a PUT request (the final step above) that updates and fully replaces a Budget resource:

PUT https://www.googleapis.com/adexchangebuyer/v1.4/billingInfo/123456789/4321
Authorization: /* auth token here */
Content-Type: application/json
{
  "budgetAmount": "6000",
  "currencyCode": "USD",
  "billingId": "4321",
  "accountId": "123456789"
}

Response

If successful, the server responds with an updated Budget resource in the response body.

{
  "budgetAmount": "6000",
  "kind": "adexchangebuyer#budget",
  "billingId": "4321",
  "currencyCode": "USD",
  "accountId": "123456789"
}

Example

Create a PretargetingConfig and then adjust its budget to $1,000 USD.

  1. Create a PretargetingConfig.
  2. Note the billingId received in the response. In this example, the accountId will be "987654" and the billingId will be "123".

Request

PUT https://www.googleapis.com/adexchangebuyer/v1.4/billinginfo/987654/123
Content-Type: application/json
{
  "budgetAmount": "1000"
}

Response

{
  "budgetAmount": "1000",
  "kind": "adexchangebuyer#budget",
  "billingId": "123",
  "currencyCode": "USD",
  "accountId": "987654"
}

Send feedback about...

Buyer REST API
Buyer REST API