> ## Documentation Index
> Fetch the complete documentation index at: https://doc.agentfirst.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch results

> Queue multiple searches for later retrieval.



## OpenAPI

````yaml post /search/batches
openapi: 3.1.0
info:
  title: Agent First
  description: The missing services for agent-first development.
  version: 1.0.0
servers:
  - url: https://api.agentfirst.dev
security:
  - bearerAuth: []
paths:
  /search/batches:
    post:
      summary: Batch results
      description: Queue multiple searches for later retrieval.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                terms:
                  description: >-
                    The broad or exact words or phrases to query (e.g., `foo bar
                    baz` or `"foo bar baz"`).
                  type: array
                  items:
                    type: string
                    maxLength: 255
                  minItems: 1
                  maxItems: 1000
                  example:
                    - foo bar baz
                engine:
                  description: The search engine to use.
                  type: string
                  enum:
                    - google
                    - bing (coming soon)
                  default: google
                  example: google
                serps:
                  description: The number of results pages to fetch.
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 1
                  example: 1
                size:
                  description: >-
                    The number of results per page to fetch; page size is unset
                    by default.
                  type: integer
                  minimum: 0
                  maximum: 100
                  example: null
                offset:
                  description: >-
                    The number of initial results to skip; results aren’t offset
                    by default.
                  type: integer
                  minimum: 0
                  maximum: 100
                  example: null
                device:
                  description: >-
                    The name as returned by the [devices resource](devices) of
                    the device to emulate searching on (these names are case
                    insensitive); device emulation is unused by default.
                  type: string
                  example: null
                country:
                  description: >-
                    The [two-letter ISO
                    code](https://www.iso.org/obp/ui/#search/code) of the
                    country to search from (these codes are case insensitive); a
                    random country is used by default.
                  type: string
                  example: null
                subdivision:
                  description: >-
                    The alphanumeric second part (proceeding the separator) of a
                    [first-level subdivision
                    code](https://www.iso.org/obp/ui/#search/code) in the
                    (prerequisite) country to search from (these codes are case
                    insensitive); a random subdivision is used by default.
                  type: string
                  example: null
                city:
                  description: >-
                    The [commonly spelled name](https://www.geonames.org/) of
                    the city in the (prerequisite) country to search from (these
                    names are temporarily case sensitive); a random city is used
                    by default.
                  type: string
                  example: null
                uule:
                  description: >-
                    The [proprietary encoded
                    string](https://moz.com/blog/geolocation-the-ultimate-tip-to-emulate-local-search)
                    for emulating the location to search from; if possible, the
                    actual location is searched from not emulated; location
                    emulation is unused by default.
                  type: string
                  example: null
                language:
                  description: >-
                    The commonly spelled name, [two-letter ISO
                    code](https://www.loc.gov/standards/iso639-2/php/code_list.php),
                    or [Google code](https://www.google.com/advanced_search) of
                    the language to search in (these names and codes are case
                    insensitive); the language is unset by default.
                  type: string
                  example: null
                display:
                  description: >-
                    The commonly spelled name, [two-letter ISO
                    code](https://www.loc.gov/standards/iso639-2/php/code_list.php),
                    or [Google code](https://www.google.com/advanced_search) of
                    the search interface’s display language (these names and
                    codes are case insensitive); the display language is unset
                    by default or set to the language if given.
                  type: string
                  example: null
                urls:
                  description: >-
                    The URLs of the results pages to retrieve; if given, the
                    URLs override any of the above params.
                  type: array
                  items:
                    type: string
                    format: uri
                  minItems: 1
                  maxItems: 1000
                  example:
                    - >-
                      https://www.google.com/search?q=foo+bar+baz&hl=fr&gl=fr&ie=UTF-8
                awaiting:
                  description: >-
                    The lazy result features to wait to load; any AI overview,
                    which can take significant time to generate, is awaited for
                    a maximum of **1 minute**; multiple features can be provided
                    by repeating the key; lazy results aren’t awaited by
                    default.
                  type: string
                  enum:
                    - ai
                    - answers
                    - ads
                  example: ai
                expiration:
                  description: >-
                    The age in days of when to consider cached results expired,
                    where `0` disables caching.
                  type: integer
                  minimum: 0
                  maximum: 1
                  default: 1
                  example: 0
                callback:
                  description: >-
                    The HTTP or HTTPS callback URL or Amazon SQS queue URL or
                    ARN to notify when the batch results have been retrieved;
                    any SQS queue must grant `sqs:SendMessage` permission to the
                    `arn:aws:iam::180363035301:role/api-instance` AWS principal.
                  type: string
                  example: https://webhook.site/02e249f8-1faf-4fab-bcf5-78ce683e85a8
              anyOf:
                - required:
                    - terms
                - required:
                    - urls
        required: true
      responses:
        '202':
          description: A job identifier and confirmation count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: The identifier to retrieve the batch searches with.
                    type: string
                    format: uuid
                    example: a0482596-c2ad-445a-a435-727002156a20
                  count:
                    description: >-
                      The number of queries in the batch as confirmed by the
                      API.
                    type: integer
                    minimum: 1
                    maximum: 1000
                    example: 1
                required:
                  - id
                  - count
        '401':
          $ref: '#/components/responses/authenticationError'
        '402':
          $ref: '#/components/responses/creditsError'
        '403':
          $ref: '#/components/responses/authorizationError'
        '422':
          $ref: '#/components/responses/paramsError'
        '500':
          $ref: '#/components/responses/unknownError'
components:
  responses:
    authenticationError:
      description: The authorization header was missing.
      content:
        text/plain:
          schema:
            type: string
            example: Authorization header must be provided
    creditsError:
      description: No more credits are available.
      content:
        text/plain:
          schema:
            type: string
            example: Credit balance is 0; top up at https://agentfirst.dev/#pricing
    authorizationError:
      description: The API token was invalid.
      content:
        text/plain:
          schema:
            type: string
            example: Valid API token must be provided
    paramsError:
      description: One or more parameters were invalid.
      content:
        text/plain:
          schema:
            type: string
            example: Character counts must be no more than 255
    unknownError:
      description: An unknown error occurred.
      content:
        text/plain:
          schema:
            type: string
            example: Unknown error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````