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

ParameterNotesTypeRequiredPossible Values
campaignIdThe ID of the campaign to which the negative keyword is addedintegerYA valid campaign ID
adGroupIdThe ID of the ad group to which the negative keyword is addedintegerYA valid ad group ID
negativeMatchTypeMatching strategies for negative keywords. Prevents your ad from serving in search results against negatively marked keywordsstringYNegative 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)
stateThe current state of the negative keyword resourcestringYPossible values of state:
enabled
paused
archived
keywordTextThe text of the keyword to match against a search querystringYString value apt to the description of the item

Headers

Header NameDescriptionRequiredValues
AuthorizationThe token will provide you the access to the API. It is same for all advertisers you access through the API.YPlease utilize the generated auth_token shared with you at the time of partner onboarding from the Getting Started Guide
WM_CONSUMER.IDWe will provide you the consumer ID to access the API. It is same for all advertisers you access through the API.   YPlease 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_SIGNATUREAuth signature as an API key.YUse the signature generator code from Getting Started Guide to generate this value
WM_SEC.KEY_VERSIONWe will provide you with the KEY VERSION to access the API. It is same for all advertisers you access through the API.Y1
WM_CONSUMER.intimestampTimestamp for which the auth signature is generated. Use Unix epoch format for the timestamp.YUse the signature generator code from Getting Started Guide to generate this value
Content-TypeFormat of the message bodyYapplication/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

ElementDescriptionType
codeThe response code can have following values: success, failure
Click here for more information about Status Codes and Errors
string
detailsDetails of the error if value of response code is failurestring
keywordIdID of the keywordinteger
keywordTextThe text that you set for your keyword while placing the requeststring

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" } ]

Did this page help you?