Skip to main content
The q parameter accepts a rich query syntax for building precise searches: exact phrase matching, boolean operators, wildcards, and proximity search. This page describes each technique and how to combine them. To apply these techniques in a working API call, see Build search queries.

Exact match

Wrap a phrase in double quotes to search for it as an exact sequence of words. Without quotes, the API treats each word as a separate term and inserts AND between them automatically. Use exact match for names, titles, and any multi-word term you want treated as a unit.

Escaping quotes in JSON

When passing exact match syntax inside a JSON string, escape the inner double quotes with a backslash:
Always escape double quotes with \ inside JSON string values to maintain exact match syntax.

Boolean operators

Use boolean operators to combine or exclude terms. The q parameter is a string — the table below shows the exact value you pass: Use parentheses to group terms and control evaluation order:
Always quote multi-word terms: "Tesla NOT \"Elon Musk\"".Without quotes, the API inserts AND between standalone words — "AI OR artificial intelligence" becomes "AI OR artificial AND intelligence", which returns a 422 (mixed operators at the same level).See Automatic AND insertion.

Wildcards

Use wildcards to match term variations:
Wildcards cannot appear at the start of a term. "*intelligence" is not valid.
The NEAR operator finds articles where two terms appear within a specified number of words of each other. Use it when terms must be discussed in the same context, not just anywhere in the article. Syntax:
Limits:
  • Maximum 4 words per phrase
  • Maximum 3 phrases per NEAR operation
  • Maximum distance of 100 words

Combining techniques

You can combine all techniques in a single query. The following examples show the exact value to pass in the q string: Market research:
Competitive analysis:
Event monitoring:

Comparison of techniques

Best practices

  • Start broad and add filters to narrow results.
  • Always quote multi-word terms to prevent automatic AND insertion.
  • Use parentheses to group terms and make operator precedence explicit.
  • Use NEAR when terms must appear in the same context, not just the same article.
  • Check user_input.q in the response to verify how the API interpreted your query.
  • URL-encode the q parameter when using GET requests to avoid issues with special characters.

See also