Supported Query Syntax

 

ON THIS PAGE      Show

 

 

 

 

 

  Important

 

  • This section applies only to specifying the query expression (the value of the q parameter in search and feed requests).

  • When submitting a request, make sure that the query expression is URL-encoded.

 

 

 

Fielded Query

  • Use ':' instead of '='; for example:

    slug:travel

    headline:storm

  • To include more than one keyword in a field, enclose the keywords in parentheses ( ) or straight quotes " "; for example:

    slug:(football OR nfl) finds either football or nfl in the slug.

    headline:(biles AND olympics) finds both biles and olympics in the headline.

    title:"Simone Biles" finds the full name Simone Biles in the title.

     

 

  Tip

 

 

When specifying multiple possible values for the same field, make sure to include your desired Boolean operator. For example, use type:(text OR picture) instead of type:(text picture).

 

 

 

 

For more information, see Common Query Fields.

Boolean Operators (AND/OR/NOT)

  • Use AND to find results with all of your keywords in the same content item. Use OR to find results with either of your keywords in the same content item. Use NOT to exclude a keyword. AND, OR and NOT must be uppercase; for example:

    tennis AND Williams

    raptors AND NOT category:s

    Istanbul OR Izmir OR Ankara

 

 

  Tip

 

 

When mixing AND, OR, and NOT Boolean operators in a query, make sure to group the OR clauses with parentheses ( ). See Grouping Terms for examples.

 

 

 

 

Exact Phrases

  • Use straight quotes " " to find results with an exact phrase or name; for example:

    "Simone Biles"

    "climate change"

Grouping Terms

  • Group parts of your query with parentheses ( ); for example:

    ("Prince George" OR pgc) AND (Maryland OR md)

    title:(Illinois AND governor)

((handball AND "world cup") OR (handball AND egypt)) AND NOT (women OR lifestyle)

Position Operator

  • In fielded queries, search for terms near one another using "~"; for example:

    headline:"tennis Williams"~5 finds the terms tennis and Williams within five words of each other in the headline.

Wildcard Operators

  • Use '*' to replace zero or more characters at the end of a word; use '?' to replace one character.

    Fre* finds Fred, Freddy, Freddie, etc.

    Gr?y finds Gray or Grey.

Common Query Fields

  • byline (returned in bylines). Name of the writer, photographer, editor or producer to whom the content item is attributed; for example:

    byline:"ben liebenerg"

    byline:"don babwin"

  • editorialtype (returned in editorialtypes). The editorial condition of the story, such as Add, HoldForRelease or Lead; for example:

    editorialtype:correction

    editorialtype:add

  • photographer (returned in photographer). Name of the photographer who created the image; for example:

    photographer:"ivan sekretarev"

  • category (returned in subject.rels:category). The name, one-letter or three-letter category code of the content item's subject, such as domestic news or entertainment; for example:

    category:a

    category:spx

    category:sports

    For a list of possible values, see AP Category Codes and AP Supplemental Categories.

  • urgency (returned in urgency). The editorial urgency of the content from 1 (the highest) to 8 (the lowest). For example:

    urgency:2

    For more information, see Urgency.

 

 

  Important

 

 

urgency is not in use for video.

 

 

 

 

  • format (returned in textformat). Two-letter filing format code indicating the type of text set, such as agate; for example:

    format:bx

    format:at

 

 

  Important

 

 

format and textformat are no longer deprecated and will continue to be maintained. However, we recommend using profile:agate to search for agate (at / ax).

 

 

 

 

  • fixture (returned in fixture). Named sets of regularly occurring content or features with a predictable focus; for example, Today in History or Financial Markets:

    fixture:"today in history"

    For a list of possible values, see Fixture.

  • company (returned in organisation). The name or ticker symbol of a publicly-traded company; for example:

    company:apple

    company:goog

  • industry, industryname (returned in organisation.industries). Categories describing the principal product or service of a manufacturing service organization, such as the Energy industry; for example:

    industry:"online retail"

    For possible values, use CTRL-F to search for "industry" on the AP Subject page.

     

 

  Tip

 

 

Searching by code is a better guarantee of uniqueness; for example, industry:6fd7e1aa975ef14a80f93a1da7d78c3a finds content tagged with "Information technology".

 

 

 

 

  • instrument (returned in organisation.symbols.instrument). The combination of a company's ticker symbol and the stock exchange on which the company is traded in the format <stock exchange code>:<ticker symbol>; for example:

    instrument:"nas:goog"

     

 

  Tip

 

 

As tickers are not unique across stock exchanges, searching by instrument is a better guarantee of uniqueness.

 

 

 

 

For a list of stock exchange codes, see Stock Exchange Codes.

  • itemcontenttype, contenttype, profile (returned in profile). The type of information contained in the content item. Currently, content types are applied to text, audio and video news items; for example:

    contenttype:"press release"

    itemcontenttype:newsbrief

profile:advisory

For a list of possible values, see Profile (Item Content Type).

  • ticker (returned in organisation.symbols.ticker). A company's ticker symbol; for example:

    ticker:msft

     

 

  Tip

 

 

As tickers are not unique across stock exchanges, searching by instrument is a better guarantee of uniqueness.

 

 

 

 

  • located, dateline (returned in located). The date and/or place where the news took place; for example:

    located:brazil

    dateline:seattle

  • city (returned in datelinelocation:city). The name of the city where the content item was created; for example:

    city:paris

    city:"new orleans"

  • state (returned in datelinelocation:countryareaname and datelinelocation:countryareacode). The name or postal code of the state where the content item was created; for example:

    state:OH

    state:"new mexico"

  • country (returned in datelinelocation:countryname and datelinelocation:countrycode). The name or three-letter code of the country where the content item was created; for example:

    country:canada

    country:aus

  • geography, geo (returned in place). Any geographic location (city, state, country, continent, etc.) that the content item is about or where it took place. Using this field returns content to which the geography is automatically applied. Examples:

    geography:europe

    geo:tokyo

    For a list of possible values, see AP Geography.

     

 

  Tip

 

 

Searching by code is a better guarantee of uniqueness; for example, geography:661850e07d5b100481f4c076b8e3055c.

 

 

 

 

  • location, place (returned in located, datelinelocation and/or place). An aggregate of all location-related fields; using this field searches simultaneously in dateline, city, state, country, geography, etc. Examples:

    place:california

    location:berlin

  • slug, slugline (returned in slugline). The story type identifier; used in sluglines for news items; for example:

    slug:fea

    slugline:obit

  • headline. The content item's headline; a list of keywords to aid in the search for the item; for example:

    headline:(russia AND putin)

    headline:("tom brady" AND superbowl)

  • organization (returned in organisation). Names of organizations or groups (other than companies), such as government departments and national Olympic teams; for example:

    organization:"new york giants"

    organization:"world health organization"

    For a list of possible values, see AP Organization.

     

 

  Tip

 

 

Searching by code is a better guarantee of uniqueness; for example, organization:1b1ee09884971004870e91f43387513e finds content tagged with "National Football League".

 

 

 

 

  • person (returned in person). In pictures, the name of a person in the news drawn from a list of celebrities, politicians, sports figures, business leaders and other newsmakers. This person may be mentioned in the caption and tagged by classification, but is not necessarily pictured. Example:

    person:"kate middleton"

     

 

  Tip

 

 

To search for images where the person is pictured, include persons.rels:personfeatured in your query (see next).

 

 

 

 

  • person AND persons.rels:personfeatured. In pictures, the name of a person who is actually pictured in the image; for example:

    (person:"Simone Biles" AND persons.rels:personfeatured)

  • source (returned in infosource). The organization that created the content item; for example:

    source:ap

    source:"philadelphia inquirer"

  • subject (returned in subject). The subject word, phrase or code used to search for content items by a concept; for example:

    subject:"california wildfires"

    subject:celebrity

    For a list of possible values, see AP Subject.

     

 

  Tip

 

 

If you are looking for a specific AP Subject, searching by code is a better guarantee of uniqueness; for example, subject:c946c3908b6b10048d99a385cd5ce603 finds content tagged with "Consumer electronics".

 

 

 

 

  • suppcat, supcat (returned in subject.rels:suppcategory). The content item's 3- or 4- letter supplemental (or secondary) news classification category; for example:

    supcat:BKB

    suppcat:ENT

    For a list of possible values, see AP Supplemental Categories.

  • title (returned in title). The content item's title; generally used for pictures; for example:

    title:"World Cup"

    title:(new york fashion show)

  • language (returned in language). The two-letter code of the language that the content item is written in; for example:

    language:en

    language:es

  • versioncreated (returned in versioncreated). The date when this version of the content item was published. Use square brackets [min TO max] to specify inclusive ranges and curly brackets {min TO max} to specify exclusive ranges; for example:

    versioncreated:[2019-11-12 TO *]

    versioncreated:[2019-10-31 TO 2019-10-31]

    versioncreated:<now-3d (arrived later than three days ago)

    versioncreated:{now-2d TO now-1d}

  • firstcreated (returned in firstcreated). The date when the first version of the content item was created; for example:

    firstcreated:[2019-05-15 TO 2019-05-18]

  • event (returned in subject; may be returned in event for some sports events such as NFL and for developing news events such as The Latest). The name of an event that the content item describes; for example:

    event:olympics

    For possible values, use CTRL-F to search for "event" on the AP Subject page.

     

 

  Tip

 

 

Searching by code is a better guarantee of uniqueness; for example, subject:3ee3daef5f474988b2c1332a1096165f  finds content tagged with "2020 Tokyo Olympic Games".

 

 

 

 

  • sourcetype (returned in infosource.type). The type of source that created the content item; for example:

    sourcetype:thirdparty

    sourcetype:member

  • productid (returned in meta.products.id). One or more AP product or package IDs; for example:

    productid:30079

    productid:(30079+OR+31536)

  • followedtopicid (returned in meta.followedtopics.id). One or more AP Newsroom Followed Topic IDs; for example:

    followedtopicid:700764

    followedtopicid:(701285+OR+700763)

Searching for Olympic Content

You can use keywords and/or the subject, organization or person query fields to search for Olympic content about a particular topic or topics.

 

Fielded query syntax

Use to search for content tagged with...

subject:term

An event or sport term; for example:

subject:triathlon

subject:"table tennis"

organization:term

"International Olympic Committee”; for example:

organization:"international olympic committee"

person:name

A particular person; for example:

person:"sha'carri richardson"

For a list of Olympic metadata terms and corresponding IDs, see AP Winter and Summer Olympics Metadata.

Searches on Multiple Fields and Field Instances

  • To search for content tagged with either Taekwondo or Handball:

subject:(taekwondo OR handball)

  • To search for content tagged with both Rowing and Olympic Games:

(subject:rowing AND "olympic games")

  • To search for content tagged with Basketball and 2024 Paris Olympic Games:

subject:(basketball AND "2024 paris olympic games")

  • To search for content tagged with Katie Ledecky and 2024 Paris Olympic Games:

person:"katie ledecky" AND subject:"2024 paris olympic games"

  • To search for content tagged with International Olympic Committee and 2024 Paris Olympic Games:

organization:"international olympic committee" AND subject:"2024 paris olympic games"

A Field Search Combined with a Free-Text Search

To search for content that mentions Sky Brown anywhere in the article and is tagged with 2024 Paris Olympic Games:

"sky brown" AND subject:"2024 paris olympic games"