See also the API reference for more detail.

Usage

‘s search service delivers all organic and paid Google results reliably, as structured or raw data. The service has a RESTful interface that accepts GET requests at https://‍/search. Searches can be localized with geotargeting parameters. They’re performed live by default or optionally queued for later retrieval. Live searches take an average of a few seconds but may require multiple retries, in which case up to 120 seconds is allocated per API call.

Authentication

You can access the service by including your secret API token in an Authorization header:
Authorization: Bearer [API token here]
Here’s an example request that uses the common Curl command:
$ curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
  'https://api.agentfirst.dev/search'\
  '?terms=foo+bar+baz'

Search parameters

Besides the geotargeting and scheduling parameters linked above, required and optional search parameters can be added in a standard query string. The keys and values supports are as follows:
KeyRequiredValue
termsThe broad or exact word or phrase to query (e.g., foo bar baz or "foo bar baz"); the terms require form or URL encoding (with any space character being replaced by a + character or %20 sequence)
serpsThe number of results pages to retrieve, from 1 to 10 inclusive; 1 is the default count
sizeThe number of results per page to retrieve, from 0 to 100 inclusive; page size is unset by default
offsetThe number of initial results to skip, from 0 to 100 inclusive; results aren’t offset by default
uuleThe proprietary encoded string for emulating the location to search from; if possible, the actual location will be searched from not emulated; location emulation is unused by default
languageThe commonly spelled name, two-letter ISO code, or Google code of the language to search in (these names and codes are case insensitive but required to include form- or URL-encoded spaces and punctuation marks); the language is unset by default
formatThe format to output to, html or json (see details below); html is the default format
expirationThe maximum age of cached results in days to accept, where 0 will disable caching; 1 is the default number of days
subaccountAny unique identifier of up to 255 characters (regardless of character encoding); will bill calls made from subaccounts separately

Response format

Search results are returned as rendered HTML or structured JSON.

HTML

If you request multiple results pages that don’t feature infinite scrolling, the HTML of each page will be separated from the next by an empty line (\n\n).

JSON

If you set the output to JSON, your results will be parsed into nested objects.

Additional examples

$ curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
  'https://api.agentfirst.dev/search?terms=foo+bar+baz&serps=2'
$ curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
  'https://api.agentfirst.dev/search?terms=%22foo+bar+baz%22&serps=10&country=us&format=json'