Budgets API v2.1

The Budgets API lets you view your account’s current budget settings. You can also use the API to replace your existing account budget settings with new values.

The Budgets API applies to accounts or sub accounts. To set campaign budgets, use the Campaigns API v2.1.

Paths

GET base_path/api_version/account_id/budgets
PUT base_path/api_version/account_id/budgets/update

Where:

Path Parameter Description
base_path https://www.googleapis.com/travelpartner
api_version v2.1
account_id A parent account or sub account ID.
update The optional action to submit a budget update. If you do not specify update in the URL path, then the Budgets API returns the daily spending cap for the account.

Query String Parameters

None.

Supported Methods

HTTP Method Description
GET Gets the specified account's current budget settings.
PUT Replaces the account's budget settings with new settings.

Examples

Gets the budget for account 4200042:

GET https://www.googleapis.com/travelpartner/v2.1/4200042/budgets

Sets a new budget for account 4200042:

PUT https://www.googleapis.com/travelpartner/v2.1/4200042/budgets/update

For more information, see the Budgeting & Billing Guide and Setting Spending Caps.

Getting budget settings

You can use the Budgets API to get the account’s daily spending cap. The daily spending cap is the maximum that the account can spend, across all campaigns and sub accounts that inherit billing.

To get budget details about an account, submit a GET request by using the following syntax:

GET https://www.googleapis.com/travelpartner/v2.1/account_id/budgets

The Budgets API responds with a JSON object that describes the budget for the specified account.

The following example shows an account that has a spending cap of $250.00 USD:

{
  "budget": [
    {
      "account_daily": {
        "amount": 250.00,
        "currency": "USD" //
      }
    }
  ]
}

Replacing budget settings

You can use the Budgets API to replace an account’s daily spending cap with a new value.

To update a budget with new settings, submit a PUT request to the update action with the following syntax:

PUT https://www.googleapis.com/travelpartner/v2.1/account_id/budgets/update

You must set the request’s Content-Type header to "application/json".

You define your new budget settings in the body of the HTTP message in JSON format, with the root budget object. The budget object is an array, as the following syntax shows:

{
  "budget": [
    {
      "account_daily": {
        "amount": <budget_amount>,
        "currency": "<3_letter_currency_code>"
      }
    }
  ]
} // end budget object

Use the account_daily object to define the daily spending cap for the account, in the specified currency. The minimum value for the daily spending cap is $100 USD. Any value between $.01 and $99.99 is interpreted as a cap of $100 USD. Set the value of account_daily to $0 to disable your account.

The following example sets an account’s daily budget to $500.00 USD:

{
  "budget": [
    {
      "account_daily": {
        "amount": 500.00,  // Set the daily spending cap to $500.00
        "currency": "USD"
      }
    }
  ]
}

To set an account's budget to be unlimited, set the budget's cleared value to true. The following example set the budget to be unlimited:

{
  "budget": [
    {
      "cleared": true
    }
  ]
}

To set a campaign's budget to be unlimited, use the Campaigns API.

Budgets API Changes

Changes to version 2.1 of the Budgets API include the following:

  • You now set an unlimited budget by setting cleared to true.
  • The maximum bid cap is no longer supported for sub accounts. As a result, it has been removed from the Budgets API. You can set a max bid cap at the campaign level by using the Campaigns API.
  • The API endpoint has changed from base_path/2.1/... to base_path/v2.1/...

Send feedback about...

Need help? Visit our support page.