News API supports a rich query syntax in theDocumentation Index
Fetch the complete documentation index at: https://newscatcherinc-docs.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
q parameter: boolean operators
(AND, OR, NOT), proximity search (NEAR), wildcards, and exact phrase
matching. This guide shows you how to put them together and make the API call.
For the full syntax reference, see
Advanced querying.
Before you begin
Make sure you have the following:- An active News API key
- The Newscatcher SDK installed for your language, or cURL for quick testing
Steps
Build a boolean query
Use
Pass your query in the
AND, OR, and NOT to combine terms. Use parentheses to control
evaluation order. The q parameter is a string — examples below show the
exact value you pass:| Goal | Query string |
|---|---|
| Both terms present | "bitcoin AND blockchain" |
| Either term | "bitcoin OR cryptocurrency" |
| Exclude a term | "Tesla NOT \"Elon Musk\"" |
| Combine groups | "(bitcoin OR cryptocurrency) AND (investment OR trading)" |
| Exact phrase | "\"electric vehicles\" NOT Tesla" |
q parameter:Build a proximity query
The
NEAR operator finds articles where two terms appear within a specified
number of words of each other. Use it when you need terms to be discussed in
the same context, not just anywhere in the article.Syntax:| Parameter | Description |
|---|---|
phrase_A, phrase_B | Terms to find near each other (max 4 words each) |
distance | Maximum words between the phrases (max 100) |
in_order | Optional. If true, phrase_B must follow phrase_A (default: false) |
Validate your query
If you’re using the Python SDK, run Validation is especially useful for LLM-generated queries and user input.
See Validate queries with Python SDK
for bulk validation and the full rules reference.
validate_query() before making the API
call. It catches syntax errors locally without consuming an API call:Refine your results
Check If results are off, try the following:
total_hits and user_input in the response to understand what the
API matched and how it interpreted your query:- Too broad — add
ANDterms or narrow withNOT, or reduce theNEARdistance - Too few — broaden with
OR, increase theNEARdistance, or use wildcards (technolog*) - Wrong interpretation — check
user_input.qto see how the API parsed your query

