Examples Stay organized with collections Save and categorize content based on your preferences.
Page Summary
This guide provides examples of directly calling Search Ads 360 REST endpoints using curl, bypassing the need for a client library.
Before running the examples, you'll need to set up environment variables for your API version, OAuth 2.0 access token, manager account ID, and client account ID.
The provided code samples demonstrate both paginated search using the
searchmethod with an adjustablepageSizeand streaming search using thesearchStreammethod which returns all results at once.All examples utilize the SA360 Query Language for data retrieval, focusing on campaign data like name, budget, status, and performance metrics.
This guide contains examples of calling the REST endpoints directly, without theuse of a client library.
Prerequisites
All the samples below are meant to be easily copy-and-pasteable into abash shell usingcurl command. You will need a Search Ads 360 manager account containing at least one client account.
Important: In these examples, we assume that you are accessing a client account(CUSTOMER_ID) by a user that has administrative access to a manager account(MANAGER_CUSTOMER_ID) that directly manages the client account. If you areinstead accessing an individual client account directly, omit thelogin-customer-id header or set it to the same value asCUSTOMER_ID.Environment variables
Enter account credentials and IDs below, and then copy-and-paste into yourterminal to configure the environment variables used in the subsequent examples.
Note: TheAuthorization guide provides instructionsfor generating an OAuth 2.0 access token.API_VERSION="0"OAUTH2_ACCESS_TOKEN="OAUTH_ACCESS_TOKEN"MANAGER_CUSTOMER_ID="MANAGER_CUSTOMER_ID"CUSTOMER_ID="CUSTOMER_ID"Additional optional object IDs
The following examples work on pre-existing campaigns. If youhave IDs of an existing campaign to use with these examples, enter it below.
CAMPAIGN_ID=CAMPAIGN_IDPaginated search
Thesearch method uses pagination, with an adjustablepageSize parameterspecified alongside thequery.
cURL
#!/bin/bash#[STARTcurl_command]curl -f --request POST "https://searchads360.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/searchAds360:search" \--header "Content-Type: application/json" \--header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \--data '{"pageSize": 10,"query": " SELECT campaign.name, campaign_budget.amount_micros, campaign.status, campaign.advertising_channel_type, metrics.clicks, metrics.impressions, metrics.ctr, metrics.average_cpc, metrics.cost_micros, campaign.bidding_strategy_type FROM campaign WHERE segments.date DURING LAST_7_DAYS AND campaign.status != 'REMOVED'"}'#[ENDcurl_command]
SA360 Query Language
SELECTcampaign.name,campaign_budget.amount_micros,campaign.status,campaign.advertising_channel_type,metrics.clicks,metrics.impressions,metrics.ctr,metrics.average_cpc,metrics.cost_micros,campaign.bidding_strategy_typeFROMcampaignWHEREsegments.dateDURINGLAST_7_DAYSANDcampaign.status!='REMOVED'
Streaming
ThesearchStream method streams all results in a single response, and thus thepageSize field is not supported.
cURL
#!/bin/bash#[STARTcurl_command]curl -f --request POST "https://searchads360.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/searchAds360:searchStream" \--header "Content-Type: application/json" \--header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \--data '{"query": " SELECT campaign.name, campaign_budget.amount_micros, campaign.status, campaign.advertising_channel_type, metrics.clicks, metrics.impressions, metrics.ctr, metrics.average_cpc, metrics.cost_micros, campaign.bidding_strategy_type FROM campaign WHERE segments.date DURING LAST_7_DAYS AND campaign.status != 'REMOVED'"}'#[ENDcurl_command]
SA360 Query Language
SELECTcampaign.name,campaign_budget.amount_micros,campaign.status,campaign.advertising_channel_type,metrics.clicks,metrics.impressions,metrics.ctr,metrics.average_cpc,metrics.cost_micros,campaign.bidding_strategy_typeFROMcampaignWHEREsegments.dateDURINGLAST_7_DAYSANDcampaign.status!='REMOVED'
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-28 UTC.
