Update Existing Ad Group - PATCH
URL: PATCH /api/v1/adGroups
-
This API supports batch operations with a max batch size of 10. For bulk operation, the advertiserId must be the same across all requests in the payload.
-
You must set all of
budgetType,dailyBudget,totalBudget,startDate,endDate, anddeliverySpeedparameters at same level i.e. either at campaign level or ad group level. Attempting to alter the "level" at which they are set via a PATCH request will result in a validation error. -
Supports both expression-based and flattened targeting structure. Only one of expression based or flattened structure should be used in a request. More details here
-
Fields can be explicitly cleared or unset by passing null.
-
Delta Targeting Update: This endpoint uniquely supports an add and remove schema for targeting, allowing you to modify keyword or audience lists without uploading the entire list again. More details
-
For details on updatable fields through PUT and PATCH operations, refer to this link
Request Parameters
| Parameters | Notes | Type | Required | Possible Values |
|---|---|---|---|---|
| advertiserId | ID of advertiser | integer | Y | Unique numeric identifier |
| adGroupId | Identifier of ad group to update | integer | Y | Unique numeric identifier |
| name | The name of the ad group. Maximum length: 255 characters | string | N | Relevant string value representing the ad group |
| startDate | Date on which the ad group is set to go live | string | Conditional Required if set at ad group level. |
|
| endDate | The date when ad group ends | date | Conditional Required if set at ad group level. |
|
| rateType | Rate type refers to the pricing structure | string | N | cpm |
| budgetType | Type of budget allocation | string | Conditional Required if not set at the campaign level | Values: daily, total Ad groups scheduled to run indefinitely must use a daily budget. |
| dailyBudget | Daily budget of the ad group. | double | Conditional Required if budgetType is set to daily. | The value of daily budget should at least be $0.01 |
| totalBudget | Total budget of the ad group. | double | Conditional Required if budgetType is set to total. | The value of total budget should at least be $0.01 |
| deliverySpeed | Determines pacing of ad delivery | string | Conditional. Required if not set at the campaign level. | Values: frontloaded, evenly Note: frontloaded pacing is not supported if budgetType is daily |
| creativeRotationMode | Specifies the rotation strategy for creatives within an ad group during delivery. Creatives can either be automatically rotated and prioritized based on performance (OPTIMIZE_PERFORMANCE), or distributed evenly with equal weight (ROTATE_EVENLY) | string | N | Enum Values: OPTIMIZE_PERFORMANCE (Default value), ROTATE_EVENLY |
| frequencyCapDay | The number of times the ad from specific adgroup should be shown to the same user on a daily basis To clear frequencyCapDay pass null | integer | N | Integer values between 1 and 511 |
| frequencyCapWeek | The number of times the ad from specific adgroup should be shown to the same user on a weekly basis To clear frequencyCapWeek pass null | integer | N | Integer values between 3 and 511 |
| frequencyCapMonth | The number of times the ad from specific adgroup should be shown to the same user on a monthly basis To clear frequencyCapMonth pass null | integer | N | Integer values between 5 and 511 |
| maxBid | max bid value for the ad group Can be cleared/unset only in the draft state | double | N | Value of max bid Minimum value: $0.01 |
| targeting | Please find targeting object details here | string | N | The values: • keywords • contextual • behavioral • runOfSite • geoTargets |
Note: You must set all of: budgetType, dailyBudget, totalBudget, startDate, endDate, and deliverySpeed parameters at same level i.e. either at campaign level or ad group level, not both
Targeting Objects
The targeting object can either be replaced fully or can be incrementally updated using add and remove arrays.
For Ad Groups with Keywords and Negative Keywords Targeting
| Parameter | Parameter Description | Type | Required | Possible Values |
|---|---|---|---|---|
| keywordText | Text that defines the keyword | string | Y | Advertiser ID for which the campaign needs to be updated for delivery status |
| matchType | Matching criteria for the keywords | string | Y | broad, exact For negative keywords only exact matchType is allowed |
For Ad Groups with Contextual Targeting
| Parameter | Parameter Description | Type | Required | Possible Values |
|---|---|---|---|---|
| id | ID of the contextual node | integer | Y | |
| reach | Determines contextual reach.This is how tiers in API call map to the representation on ad center UI: Tier mapping:
| string | Y |
|
For Ad Groups with Behavioral Targeting
| Parameter | Parameter Description | Type | Required | Possible Values |
|---|---|---|---|---|
| id | ID of the audience obtained from List targeting endpoint | integer | Y | |
| audienceType | Type of audience | string | Y |
|
| attribute | Attribute of the audience | string | Y |
|
For Ad Groups with ROS Targeting
| Parameter | Parameter Description | Type | Required | Possible Values |
|---|---|---|---|---|
| runOfSite | Indicates whether run‑of‑site targeting is enabled | boolean | Y |
|
Geo targeting
Can be set to one of:
- Country
- State,City
- DMA
- Zip code
If omitted will be default set to country (US). You cannot combine different geo-targeting types within a single ad group
| Parameter | Parameter Description | Type | Required | Possible Values |
|---|---|---|---|---|
| id | is used for Country, State, City or DMA targets | integer | Y | |
| zipCode | is used for zip code targeting.We only support ZIP codes within the USA currently | string | Y |
Headers
| Header Name | Description | Required | Values |
|---|---|---|---|
| Authorization | The token will provide you the access to the API. It is same for all advertisers you access through the API. | Y | Please utilize the generated auth_token shared with you at the time of partner onboarding from the Getting Started Guide |
| Content-Type | Format of the message body | Y | application/json |
| WM_CONSUMER.ID | Unique ID for consumer. We will provide you the consumer ID to access the API. It is same for all advertisers you access through the API. | Y | Please use the generated ConsumerId shared with you at the time of partner onboarding. Refer to the Getting Started Guide for more information |
| WM_SEC.AUTH_SIGNATURE | Auth signature as an API key. | Y | Use the signature generator code from Getting Started Guide to generate this value |
| WM_SEC.KEY_VERSION | Key version. We will provide you with the KEY VERSION to access the API. It is same for all advertisers you access through the API. | Y | 1 |
| WM_CONSUMER.intimestamp | Timestamp for which the auth signature is generated. Use Unix epoch format for the timestamp. | Y | Use the signature generator code from Getting Started Guide to generate this value |
Rules
- startDate >= today’s date
- startDate <= endDate
- total and daily budget should be >= max bid
- You can only set either dailyBudget or totalBudget
- To set daily budget, you must choose value of budgetType as “daily” and then define dailyBudget.
- To set total budget, you must choose value of budgetType as “total” and then define totalBudget.
- Budget, Schedule and Delivery speed must be set either at campaign or ad group level
- You must set all of budgetType, dailyBudget, totalBudget, startDate, endDate, and deliverySpeed parameters at same level i.e. either at campaign level or ad group level, not both
- IDs with isDisabled = true from POST/api/v2/targeting/list cannot be used for targeting
- Campaigns must be homogeneous; if mediaType is VIDEO, all ad groups will be VIDEO; if mediaType is BANNER, all ad groups will be BANNER. Mixing VIDEO and BANNER ad groups within the same campaign is not allowed.
- mediaType, if included in the request payload, is ignored and has no effect on processing.
- The update rules for PATCH are similar to the update rules for PUT
Targeting Rules
- Only one of keywords, contextual, behavioral, or runOfSite is allowed.
- geoTargets can be combined with the selected targeting tactic.
- Patch supports both expression based targeting structure and flattened targeting structure, and the user should pass only one of them in the request body.
- For geo targeting (Refer to the sample requests for creating an Ad Group with ROS to see how zip codes are used in geo-targeting):
- In an ad group, geo targeting can be set to one of:
- Country
- State, City
- DMA
- Zip code
- You cannot combine different geo-targeting types within a single ad group
- If geo targeting is not specified, the default Country (US) level targeting will be applied
- In an ad group, geo targeting can be set to one of:
- When setting up targeting for Video Ad Groups, the following restrictions apply:
- Keywords targeting is not supported for ad groups in campaigns with mediaType = VIDEO.
- Ad groups with runOfSite targeting will not serve on Item Page placement.
- Ad groups with contextual targeting will not serve on Homepage Feature_4
- Mixing replace (plain array) and delta (add/remove object) in the same targeting request is not allowed and returns HTTP 400
Sample Request 1 - Update name, frequencyCapDay, frequencyCapWeek and targeting for an ad group(Expression based Targeting Structure)
curl -X PATCH \
'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/adGroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>' \
--header 'WM_SEC.AUTH_SIGNATURE: **************' \
--header 'WM_SEC.KEY_VERSION: 1' \
--header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \
--header 'WM_CONSUMER.intimestamp: 1565309779' \
--data '[ { "advertiserId": 1, "adGroupId": 11, "name": "Ad Group 1", "frequencyCapDay": 1, "frequencyCapWeek": 3, "targeting": { "and": [ { "contextual": [ { "id": 3452, "reach": "tier_2" }, { "id": 2343, "reach": "tier_3" } ] }, { "geoTargets": [ { "id": 123 }, { "id": 234 }, { "id": 235 } ] } ] } }
]'
Sample Request 2 - Update name, frequencyCapDay, frequencyCapWeek and targeting for an ad group(Flattened Targeting Structure)
curl -X PATCH \
'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/adGroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>'
--header 'WM_SEC.AUTH_SIGNATURE: **************' \
--header 'WM_SEC.KEY_VERSION: 1' \
--header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \
--header 'WM_CONSUMER.intimestamp: 1565309779'
--data '[ { "advertiserId": 1, "adGroupId": 11, "name": "Ad Group 1" , "frequencyCapDay": 1, "frequencyCapWeek": 3, "targeting": { "contextual": { "include": [ { "id": 3455, "reach": "tier_2" }, { "id": 3455, "reach": "tier_2" } ] } }, "geoTargets": { "include": [ { "id": 123 }, { "id": 122 } ] } } } ]' Sample Request 3 - Update multiple adGroups (Expression based Targeting Structure)
Fields being patched
In adgroup 11:
- frequencyCapDay
- frequencyCapWeek
- frequencyCapMonth
In adgroup 12:
- endDate
- frequencyCapMonth
curl -X PATCH \
'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/adGroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>'
--header 'WM_SEC.AUTH_SIGNATURE: **************' \
--header 'WM_SEC.KEY_VERSION: 1' \
--header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \
--header 'WM_CONSUMER.intimestamp: 1565309779'
--data '[ { "advertiserId": 1, "adGroupId": 11, "frequencyCapDay": null, "frequencyCapWeek": null, "frequencyCapMonth": null, "targeting": { "and": [ { "and": [ { "keywords": [ { "keywordText": "running shoes", "matchType": "BROAD" } ] }, { "not": [ { "keywords": [ { "keywordText": "cheap shoes", "matchType": "EXACT" } ] } ] } ] }, { "geoTargets": [ { "id": 234 }, { "id": 235 } ] } ] } }, { "advertiserId": 1, "adGroupId": 12, "endDate": "2023-12-09T12:00:00Z", "frequencyCapMonth": 5, "targeting": { "and": [ { "behavioral": [ { "id": 134, "audienceType": "retail", "attribute": "historical" } ] }, { "geoTargets": [ { "id": 234 }, { "id": 235 } ] } ] } }
] '
Sample Request 4 - Update multiple adGroups and add/remove keywords (Flattened Targeting Structure)
curl -X PATCH \
'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/adGroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>'
--header 'WM_SEC.AUTH_SIGNATURE: **************' \
--header 'WM_SEC.KEY_VERSION: 1' \
--header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \
--header 'WM_CONSUMER.intimestamp: 1565309779'
--data '[ { "advertiserId": 1, "adGroupId": 11, "frequencyCapDay": null, "frequencyCapWeek": null, "frequencyCapMonth": null, "targeting": { "keywords": { "include": { "add": [ { "matchType": "BROAD", "keywordText": "running shoes" }, { "matchType": "PHRASE", "keywordText": "trail sneakers" } ], "remove": [ { "matchType": "BROAD", "keywordText": "old broad term" }, { "matchType": "BROAD", "keywordText": "new broad term" } ] }, "exclude": { "add": [ { "matchType": "EXACT", "keywordText": "free shoes" }, { "matchType": "EXACT", "keywordText": "nike shoes" } ], "remove": [ { "matchType": "EXACT", "keywordText": "cheap shoes" }, { "matchType": "EXACT", "keywordText": "old shoes" } ] } } }, "geoTargets": { "include": [ { "id": 234 }, { "id": 235 } ] } } }, { "advertiserId": 1, "adGroupId": 12,= "endDate": "2023-12-09T12:00:00Z", "frequencyCapMonth": 5, "targeting": { "behavioral": { "include": [ { "audienceType": "retail", "attribute": "historical", "id": 134 }, { "audienceType": "retail", "attribute": "historical", "id": 234 } ], "exclude": [ { "audienceType": "retail", "attribute": "historical", "id": 123 }, { "audienceType": "retail", "attribute": "historical", "id": 111 } ] }, "geoTargets": { "include": [ { "id": 234 }, { "id": 235 } ] } } }
]'
Sample Request 5 - Update ad group end date
curl -X PATCH \
'https: //developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/adGroups' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <auth_token>'
--header 'WM_SEC.AUTH_SIGNATURE: **************' \ --header 'WM_SEC.KEY_VERSION: 1' \ --header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \ --header 'WM_CONSUMER.intimestamp: 1565309779' --data '[ { "advertiserId": 1, "adGroupId": 11, "endDate": "2024-12-09T12:00:00Z" } ]'Sample Request 6 - Partial success example for adGroup batch update
curl -X PATCH \
'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/adGroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>'
--header 'WM_SEC.AUTH_SIGNATURE: **************' \
--header 'WM_SEC.KEY_VERSION: 1' \
--header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \
--header 'WM_CONSUMER.intimestamp: 1565309779'
--data '[ { "advertiserId": 1, "adGroupId": 11, "frequencyCapDay": null, "frequencyCapWeek": null, "frequencyCapMonth": null, "targeting": { "keywords": { "include": { "add": [ { "matchType": "BROAD", "keywordText": "running shoes" }, { "matchType": "PHRASE", "keywordText": "trail sneakers" } ], "remove": [ { "matchType": "BROAD", "keywordText": "old broad term" } ] }, "exclude": { "add": [ { "matchType": "EXACT", "keywordText": "free shoes" } ], "remove": [ { "matchType": "EXACT", "keywordText": "cheap shoes" } ] } } }, "geoTargets": { "include": [{"id": 234},{"id": 235}] }
} },
{ "advertiserId": 1, "adGroupId": 12, "endDate": "2023-12-09T12:00:00Z", "frequencyCapMonth": 5, "targeting": { "behavioral": { "include": [ { "audienceType": "retail", "attribute": "historical", "id": 134 }, { "audienceType": "retail", "attribute": "historical", "id": 234 } ], "exclude": [ { "audienceType": "retail", "attribute": "historical", "id": 123 }, { "audienceType": "retail", "attribute": "historical", "id": 111 } ] }, "geoTargets": { "include": [ { "id": 234 }, { "id": 235 } ] } }
}
]'Response
| Element | Description | Type |
|---|---|---|
| code | The response code can have following values:
Click here for more information about Status Codes and Errors | string |
| details | Details will populate success or error message depending upon value of code | string |
| adGroupId | ID of the Ad Group being updated | integer |
Sample Response 1 Success - Update name, frequencyCapDay, frequencyCapWeek and targeting for an ad group(Expression based Targeting Structure)
[ { "code": "success", "details": "string", "adGroupId": 11 }
]Sample Response 1 Failure - Update name, frequencyCapDay, frequencyCapWeek and targeting for an ad group(Expression based Targeting Structure)
[ { "code": "failure", "details": ["string"], "adGroupId": 11 }
]Sample Response 2 Success - Update name, frequencyCapDay, frequencyCapWeek and targeting for an ad group(Flattened Targeting Structure)
[ { "code": "success", "details": "string", "adGroupId": 11 }
]Sample Response 2 Failure - Update name, frequencyCapDay, frequencyCapWeek and targeting for an ad group(Flattened Targeting Structure)
[ { "code": "success", "details": "string", "adGroupId": 11 }
]Sample Response 3 Success - Update multiple adGroups (Expression based Targeting Structure)
[ { "code": "success", "details": "string", "adGroupId": 11 }, { "code": "success", "details": "string", "adGroupId": 12 } ]Sample Response 3 Failure - Update multiple adGroups (Expression based Targeting Structure)
[ { "code": "failure", "details": ["string"], "adGroupId": 11 } { "code": "failure", "details": ["string"], "adGroupId": 12 }
]Sample Response 4 Success - Update multiple adGroups and add/remove keywords (Flattened Targeting Structure)
[ { "code": "success", "details": "string", "adGroupId": 11 }, { "code": "success", "details": "string", "adGroupId": 12 } ]Sample Response 4 Failure- Update multiple adGroups and add/remove keywords (Flattened Targeting Structure)
[ { "code": "failure", "details": ["string"], "adGroupId": 11 } { "code": "failure", "details": ["string"], "adGroupId": 12 }
]Sample Response 5 Success - Update ad group end date
[ { "code": "success", "details": "string", "adGroupId": 11 }
]Sample Response 5 Failure - Update ad group end date
[ { "code": "failure", "details": ["string"], "adGroupId": 11 }
]Sample Response 6 Success - Partial success example for adGroup batch update
[ { "code": "success", "details": "string", "adGroupId": 11 }, { "code": "failure", "details": "string", "adGroupId": 12 }
]
Delta Targeting Update
Update targeting criteria - Full Replacement (PUT/PATCH)
When creating or fully updating an ad group, pass arrays of objects to the include and exclude keys.
include: replaces all existing included keywords/audiences/contextual nodes
exclude : replaces all existing excluded keywords/audiences/contextual nodes
"targeting": { "keywords": { "include": [ { "keywordText": "running shoes", "matchType": "broad" }, { "keywordText": "trail sneakers", "matchType": "exact" } ], "exclude": [ { "keywordText": "sandals", "matchType": "exact" } ] }, "geoTargets": { "include": [ { "zipCode": "35004" } ] }
}Update targeting criteria - Delta Updates (PATCH Only)
When using the PATCH endpoint, the Flattened Structure supports incremental updates. Instead of passing an array to include or exclude, you pass an object containing add and/or remove arrays . This allows you to update massive keyword or audience lists without re-uploading the entire list.
Note: You cannot mix array replacement and add/remove delta patching in the same request.
-
include.add: Adds new keywords/audiences/contextual nodes to inclusion list
-
include.remove: Removes keywords/audiences/contextual nodes from inclusion list
-
exclude.add: Adds keywords/audiences/contextual nodes to exclusion list
-
exclude.remove: Removes keywords/audiences/contextual nodes from exclusion list
"targeting": { "behavioral": { "include": { "add": [ { "id": 134, "audienceType": "retail", "attribute": "historical" } ], "remove": [ { "id": 234, "audienceType": "retail", "attribute": "historical" } ] } }
}Reference Schema:
keywords tactic - Full Replacement (PUT/PATCH)
"targeting": { "keywords": { "include": [ { "matchType": "...", "keywordText": "..." }, { "matchType": "...", "keywordText": "..." } ], "exclude": [ { "matchType": "...", "keywordText": "..." } ] }, "geoTargets": { "include": [ ... ] }
} keywords tactic - Delta Updates (PATCH Only)
"targeting": { "keywords": { "include": { "add": [ { "matchType": "...", "keywordText": "..." }, { "matchType": "...", "keywordText": "..." } ], "remove": [ { "matchType": "...", "keywordText": "..." } ] }, "exclude": { "add": [ { "matchType": "...", "keywordText": "..." } ], "remove": [ { "matchType": "...", "keywordText": "..." } ] } } }, "geoTargets": { "include": [ ... ] }
}contextual tactic - Full Replacement (PUT/PATCH)
"targeting": { "contextual": { "include": [{"id": ..., "reach": "..."}], "exclude": [{"id": ..., "reach": "..."}] } }, "geoTargets": { "include": [ ... ] }
} contextual tactic - Delta Updates (PATCH Only)
"targeting": { "contextual": { "include": { "add": [ {{"id": ..., "reach": "..."}} ], "remove": [ {{"id": ..., "reach": "..."}} ] } }, "geoTargets": { "include": [ ... ] }
} behavioral tactic - Full Replacement (PUT/PATCH)
"targeting": { "behavioral": { "include": [{ "id": ..., "audienceType": "...", "attribute": "..." }], "exclude": [{ "id": ..., "audienceType": "...", "attribute": "..." }] } }, "geoTargets": { "include": [ ... ] }
} behavioral tactic - Delta Updates (PATCH Only)
"targeting": { "behavioral": { "include": { "add": [{ "id": ..., "audienceType": "...", "attribute": "..." }], "remove": [{ "id": ..., "audienceType": "...", "attribute": "..." }] }, "exclude": { "add": [{ "id": ..., "audienceType": "...", "attribute": "..." }], "remove": [{ "id": ..., "audienceType": "...", "attribute": "..." }] } } }, "geoTargets": { "include": [ ... ] }
}runOfSite tactic - Full Replacement (PUT/PATCH)
"targeting": { "runOfSite": true , "geoTargets": { "include": [ ... ] }
}runOfSite tactic - Delta Updates (PATCH Only)
NA
geoTargets tactic - Full Replacement (PUT/PATCH), using ID
{ "geoTargets": "include":[{ "id": ... },{ "id": ... }]
}geoTargets tactic - Delta Updates (PATCH Only), using ID
{ "geoTargets": "include": {"add": [{ "id": ... },{ "id": ... }], "remove": [{ "id": ... },{ "id": ... }] }
}geoTargets tactic - Full Replacement (PUT/PATCH), using zipCode:
{ "geoTargets": "include":[{ "zipCode": ... },{ "zipCode": ... }]
}geoTargets tactic - Delta Updates (PATCH Only), using zipCode:
{ "geoTargets": "include": {"add": [{ "zipCode": ... },{ "zipCode": ... }], "remove": [{ "zipCode": ... },{ "zipCode": ... }] }
}Updated about 13 hours ago
