Add Negative Keywords
Negative keywords let you exclude search terms from your campaigns and help you focus on only the keywords that matter to your customers. Better targeting can put your ad in front of interested users and increase your return on investment (ROI). Use the Negative Keyword API to add, retrieve, update negative keywords for keyword (manual) campaigns with the help of negativeExact match type. Negative keywords are not subjected to review.
URL: POST /api/v1/negative_keywords
Query Parameters
| Parameter | Notes | Type | Required | Possible Values |
|---|---|---|---|---|
| campaignId | The ID of the campaign to which the negative keyword is added | integer | Y | A valid campaign ID |
| adGroupId | The ID of the ad group to which the negative keyword is added | integer | Y | A valid ad group ID |
| negativeMatchType | Matching strategies for negative keywords. Prevents your ad from serving in search results against negatively marked keywords | string | Y | Negative keywords can be used with following match type:negativeExact: Your ads don't show against keywords/search queries that exactly matches the bidded keyword(s) negativePhrase: Your ads don't show against keywords/search queries that contains the specified phrase in the bidded keyword(s) |
| state | The current state of the negative keyword resource | string | Y | Possible values of state:enabledpausedarchived |
| keywordText | The text of the keyword to match against a search query | string | Y | String value apt to the description of the item |
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 |
| WM_CONSUMER.ID | 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 | 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 |
| Content-Type | Format of the message body | Y | application/json |
**Note:**A maximum of 50 keywords can be included in a single POST request.
Sample Request 1
curl -X POST \
'https://developer.api.stg.walmart.com/api-proxy/service/WPA/Api/v1/api/v1/negative_keywords' \
--header 'Authorization: Bearer <auth_token>' \ --header 'accept: application/json' \
--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' \
--header 'Content-Type: application/json' \
--data '{ "campaignId": 600001, "adGroupId": 500001, "keywordText": "keyword 1", "negativeMatchType": "negativeExact", "state": "enabled" }'Sample Request 2 (Adding more than 500 keywords in an adgroup)
curl -X POST \
'https://developer.api.stg.walmart.com/api-proxy/service/WPA/Api/v1/api/v1/negative_keywords' \
--header 'Authorization: Bearer <auth_token>' \ --header 'accept: application/json' \
--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' \
--header 'Content-Type: application/json' \
--data '{ "campaignId": 600001, "adGroupId": 500001, "keywordText": "keyword 501", "negativeMatchType": "negativeExact", "state": "enabled" }'Sample Request 3 (Keyword text length greater than 80)
curl -X POST \
'https://developer.api.stg.walmart.com/api-proxy/service/WPA/Api/v1/api/v1/negative_keywords' \
--header 'Authorization: Bearer <auth_token>' \ --header 'accept: application/json' \
--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' \
--header 'Content-Type: application/json' \
--data '{ "campaignId": 600001, "adGroupId": 500001, "keywordText": "keyword 123456789012345678901234567890123456789012345678901234567890123456789012345678901", "negativeMatchType": "negativeExact", "state": "enabled" }'Sample Request 4 (negativePhrase)
curl -X POST '<https://developer.api.stg.walmart.com/api-proxy/service/WPA/Api/v1/api/v1/negative_keywords'> --header 'Authorization: Bearer \<auth_token>' --header 'accept: application/json' --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' --header 'Content-Type: application/json' --data '{ "campaignId": 600001, "adGroupId": 500001, "keywordText": "keyword 2", "negativeMatchType": "negativePhrase", "state": "enabled" }'Response
| Element | Description | Type |
|---|---|---|
| code | The response code can have following values: success, failureClick here for more information about Status Codes and Errors | string |
| details | Details of the error if value of response code is failure | string |
| keywordId | ID of the keyword | integer |
| keywordText | The text that you set for your keyword while placing the request | string |
Sample Response 1
[ { "code": "success", "details": "", " keywordId ": 50001 " keywordText ": "keyword 1" }
]Sample Response 2
[ { "code": "failure", "details": "Cannot add more than 500 enabled negative keywords in an ad group", " keywordId ": 0, " keywordText ": "keyword 501" }
]Sample Response 3
[ { "code": "failure", "details": "Keyword Text length greater than 80 / ", "keywordId": 0, "keywordText": "123456789012345678901234567890123456789012345678901234567890123456789012345678901" }
]Sample Response 4
[ { "code": "success", "details": "", " keywordId ": 50001 " keywordText ": "keyword 2" } ]Updated 2 days ago
Did this page help you?
