Parameter reference table
The table below summarises every filter parameter covered in this guide. All parameters are passed as query string arguments on aGET request to https://www.googleapis.com/customsearch/v1.
Date and recency filters
dateRestrict
Limit results to pages indexed within a rolling time window relative to today. The format is a single letter (d, w, m, or y) followed by a positive integer.
- Last 24 hours
- Last 3 months
sort
Override the default relevance ranking. Setting sort=date returns results ordered by the date Google last indexed the page — the most recently crawled pages appear first. This is most useful when you need fresh content and relevance is a secondary concern.
Language and geography filters
lr — Language restrict
Restrict results to pages written in a specific language. The format is lang_ followed by an ISO 639-1 language code.
gl — Geolocation
Specify the geographic location of the end user as a two-letter ISO 3166-1 alpha-2 country code. This parameter influences (but does not strictly restrict) result ranking — pages relevant to users in that country will score higher.
gl values: us, gb, ca, au, de, fr, in, br, jp, mx, es, it, kr, nl.
cr — Country restrict
Strictly restrict results to pages originating from a specific country, regardless of the user’s geography. The format is the word country followed by a two-letter uppercase country code.
cr restricts the origin of the page (typically inferred from the domain’s country TLD or hosting). gl signals the user’s country to influence ranking. You can use both together.File type filter
fileType
Return only results of a specific file format. Google’s index supports a wide range of document types:
filetype: operator directly inside q for the same effect:
Rights and licensing filter
rights
Restrict results to pages whose content is licensed under a specific Creative Commons license. You can combine multiple values with | (pipe):
Site targeting filters
siteSearch + siteSearchFilter
Control which domain(s) contribute to your results on a per-request basis. Set siteSearch to a domain and siteSearchFilter to i (include) or e (exclude).
- Include a domain
- Exclude a domain
Return results only from
developer.mozilla.org:siteSearch accepts one domain per request. To include or exclude multiple domains, configure them permanently in the Programmable Search Engine Control Panel as Included sites or Excluded sites.Term-level filters
exactTerms
Require that every result contains a specific exact phrase. This is the API equivalent of wrapping terms in quotes in a Google search. Use it to eliminate loosely related results when your query terms are ambiguous.
excludeTerms
Exclude any result that contains the specified term or phrase. This is the API equivalent of the -term operator in a Google search.
orTerms
Return results that contain at least one of the specified terms, in addition to the main query. Terms are separated by spaces (treated as OR). This broadens results without requiring all terms to appear.
Combining filters
Filters compose freely. The example below performs a tightly scoped query: English-language PDF research papers on neural architecture search, published within the last year, from academic domains, excluding blog content:Filter interaction reference
Understanding how filters interact helps you avoid accidentally over-constraining your query:dateRestrict vs. sort=date
dateRestrict vs. sort=date
dateRestrictfilters the result set to a time window.sort=dateorders the filtered set by recency.- Use both together for “most recent results within a window”.
sort=datewithoutdateRestrictre-ranks all matching results by date, which can surface very old pages if they were recently re-crawled.
lr vs. gl vs. cr
lr vs. gl vs. cr
lr=lang_enrestricts the language of the content.gl=ussignals the user’s country, influencing ranking but not strictly filtering.cr=countryUSrestricts the origin country of the page, not its language.- You can use all three simultaneously for maximum geographic and linguistic precision.
siteSearch vs. q site: operator
siteSearch vs. q site: operator
Both restrict results to a domain, but they behave differently:
siteSearch=example.com&siteSearchFilter=iis a structured filter applied by the API before ranking.q=site:example.com+your+termsuses Google’ssite:operator inside the query string. ThesiteSearchparameter is preferred for programmatic use because it keeps the domain out of the query and makes the intent explicit.
exactTerms vs. q with quoted string
exactTerms vs. q with quoted string
Both require an exact phrase in results, but
exactTerms applies as a hard post-filter, while a quoted string in q is weighted heavily in ranking. For strict enforcement, use exactTerms; for softer preference, embed the quoted phrase in q.Error reference
The free tier allows 100 queries per day per project. The paid tier supports up to 10,000 queries per day per project. Filter parameters do not affect query cost — each API call counts as one query regardless of how many filters you apply.