API Reference / AdHierarchyService
AdHierarchyService
Fetches and mutates campaigns, ad groups, and ads.
CreateCampaign
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_account_id | string | min_len: 1 | |
| name | string | min_len: 1 | |
| start_date | timestamp | .required = true | |
| end_date | timestamp | — | |
| budget_cents | int64 | .int64.gte = 0 |
Response
| Field | Type | Description |
|---|---|---|
| campaign | Campaign |
UpdateCampaign
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| id | string | min_len: 1 | ULID of the resource |
| name | string | min_len: 1 | |
| start_date | timestamp | .required = true | |
| end_date | timestamp | — | |
| budget_cents | int64 | .int64.gte = 0 | |
| expected_version | int64 | .int64.gte = 1 |
Response
| Field | Type | Description |
|---|---|---|
| campaign | Campaign |
DeleteCampaign
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| id | string | min_len: 1 | ULID of the resource |
CreateAdGroup
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| campaign_id | string | min_len: 1 | |
| location_id | string | min_len: 1 |
Response
| Field | Type | Description |
|---|---|---|
| ad_group | AdGroup |
UpdateAdGroup
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_group_id | string | min_len: 1 | |
| location_id | string | min_len: 1 | |
| expected_version | int64 | .int64.gte = 1 |
Response
| Field | Type | Description |
|---|---|---|
| ad_group | AdGroup |
DeleteAdGroup
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_group_id | string | min_len: 1 |
CreateAd
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_group_id | string | min_len: 1 | |
| creative_url | string | — |
Response
| Field | Type | Description |
|---|---|---|
| ad | Ad |
UpdateAd
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_id | string | min_len: 1 | |
| creative_url | string | — | |
| expected_version | int64 | .int64.gte = 1 |
Response
| Field | Type | Description |
|---|---|---|
| ad | Ad |
DeleteAd
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_id | string | min_len: 1 |
ListAdGroupsByCampaign
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| campaign_id | string | min_len: 1 |
Response
| Field | Type | Description |
|---|---|---|
| ad_group_ids | string[] |
ListCampaigns
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| account_id | string | min_len: 1 | |
| query | string | — | |
| filters | CampaignFilters | — | |
| sort | SortBy[] | — | |
| page | int32 | min_len: 1 |
Response
| Field | Type | Description |
|---|---|---|
| campaigns | CampaignListItem[] | |
| page | int32 | |
| per_page | int32 | |
| total_results | int64 |
GetAdGroup
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| ad_group_id | string | min_len: 1 |
Response
| Field | Type | Description |
|---|---|---|
| ad_group | AdGroup |
GetCampaign
Request
| Field | Type | Validation | Description |
|---|---|---|---|
| campaign_id | string | min_len: 1 |
Response
| Field | Type | Description |
|---|---|---|
| campaign | Campaign |
Messages
Ad
| Field | Type | Description |
|---|---|---|
| id | string | ULID of the resource |
| ad_group_id | string | |
| creative_url | string | |
| created_at | timestamp | |
| updated_at | timestamp | |
| version | int64 | |
| deleted_at | timestamp |
AdGroup
| Field | Type | Description |
|---|---|---|
| id | string | ULID of the resource |
| campaign_id | string | |
| ad_ids | string[] | |
| created_at | timestamp | |
| version | int64 | |
| updated_at | timestamp | |
| deleted_at | timestamp |
CampaignListItem
| Field | Type | Description |
|---|---|---|
| id | string | ULID of the resource |
| account_id | string | |
| name | string | |
| status | CampaignStatus | |
| start_date | timestamp | |
| end_date | timestamp | |
| budget_cents | int64 | |
| version | int64 | |
| created_at | timestamp | |
| updated_at | timestamp | |
| deleted_at | timestamp | |
| account_name | string | |
| brand_id | string | |
| brand_name | string | |
| ad_group_count | int32 | |
| ad_count | int32 | |
| location_ids | string[] |
CampaignFilters
| Field | Type | Description |
|---|---|---|
| statuses | CampaignStatus[] | |
| start_from | timestamp | |
| start_to | timestamp | |
| end_from | timestamp | |
| end_to | timestamp | |
| brand_id | string | |
| location_id | string |
Campaign
| Field | Type | Description |
|---|---|---|
| id | string | ULID of the resource |
| ad_account_id | string | |
| name | string | |
| status | CampaignStatus | |
| start_date | timestamp | |
| end_date | timestamp | |
| budget_cents | int64 | |
| created_at | timestamp | |
| updated_at | timestamp | |
| ad_group_ids | string[] | |
| deleted_at | timestamp | |
| version | int64 |
SortBy
| Field | Type | Description |
|---|---|---|
| field | string | |
| descending | bool |
Enums
CampaignStatus
| Name | Number |
|---|---|
| CAMPAIGN_STATUS_UNSPECIFIED | 0 |
| CAMPAIGN_STATUS_PLANNED | 1 |
| CAMPAIGN_STATUS_LIVE | 2 |
| CAMPAIGN_STATUS_COMPLETED | 3 |