Contents

Query Keywords

Query keywords using structured filters, sorting, and pagination.

URL

POST https://api.ads.apple.com/v1/keywords/query

Header Parameters

NameTypeDescription
X-Ap-Context Requiredstring

Response Codes

StatusReasonTypeDescription
200OK
Content-Type: application/json
KeywordQueryResponse
400Bad Request
Content-Type: application/json
ErrorResponse
401Unauthorized
Content-Type: application/json
ErrorResponse
403Forbidden
Content-Type: application/json
ErrorResponse
404Not Found
Content-Type: application/json
ErrorResponse
429Too Many Requests
Content-Type: application/json
ErrorResponse
500Internal Server Error
Content-Type: application/json
ErrorResponse

Discussion

This endpoint queries keywords using a standard QueryRequest body. Either adGroupId or campaignId is required. The API returns an error if neither is present.

  • The adGroupId EQUALS or adGroupId IN filter scopes the query to one or more specific ad groups, and can span ad groups across different campaigns within the same ad account. The adGroupId IN filter accepts up to 1000 values. The IS_NULL, IS_NOT_NULL, and NOT_EQUALS operators aren’t supported on adGroupId for keywords.

  • The campaignId field scopes the query to all keywords across a campaign, and only supports EQUALS. There is no campaign-level keyword concept the way there is for negative keywords.

  • Filtering by id (EQUALS or IN) is exempt from the adGroupId/campaignId requirement, since id already fully bounds the query.

See QueryFilterOperator for the full set of supported comparison operators.

Filterable Fields

Field

Type

Operators

Sortable

Description

id

integer

EQUALS, IN

Yes (default)

The unique identifier for the keyword.

adGroupId

integer

EQUALS, IN

Yes

The ad group this keyword belongs to.

campaignId

integer

EQUALS

Yes

The campaign ID of the parent campaign. Informational only.

text

string

EQUALS, STARTS_WITH

Yes

The original advertiser-given keyword text.

matchType

string (enum)

EQUALS, IN

Yes

Keyword match type. See Keywordmatchtype.

status

string (enum)

EQUALS, IN

Yes

Whether the keyword is active and eligible to serve. See Keywordstatus.

deleted

boolean

EQUALS

Yes

Whether the keyword has been deleted.

The request body is a QueryRequest composed of QueryFilter conditions and QuerySort directives (QuerySortOrder), controlled by QueryPagination.

Payload Examples

See Also