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

# Search

> Searches the web, news, images, videos, research papers or GitHub issues and pull requests, and returns a `jobId`. Poll [Get a search](/api-reference/search/search-status) until `status` is `completed` or `failed`. Guide: [Search](/search).

With `wait: true`, the request waits up to 20 seconds and answers `200` with the result. If the search takes longer, you get the usual `202` and poll. `wait` is ignored when you send `scrapeOptions`, since reading pages takes longer.

`limit` is per source, so 3 sources at 10 can return 30 results. To get the next page of a source, send its token from `nextPageTokens` back as `pageTokens`. If you send the same search again within 5 seconds, you get the first job's `jobId` back with `deduplicated: true`.

**Credits:** 1 per 10 results per source, rounded up, so 20 web results cost 2 and 3 cost 1. A source with no results costs nothing. With `scrapeOptions`, each page read is billed as a scrape. See [How credits work](/billing/how-credits-work).

**Rate limits:** 60 requests a minute, and up to 10 unfinished searches at a time.




## OpenAPI

````yaml POST /search
openapi: 3.1.0
info:
  title: Spidra API
  version: 1.0.0
  description: >-
    Public API endpoints for web scraping via Spidra. Authenticate with
    `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://api.spidra.io/api
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /search:
    post:
      tags:
        - Search
      summary: Search
      description: >
        Searches the web, news, images, videos, research papers or GitHub issues
        and pull requests, and returns a `jobId`. Poll [Get a
        search](/api-reference/search/search-status) until `status` is
        `completed` or `failed`. Guide: [Search](/search).


        With `wait: true`, the request waits up to 20 seconds and answers `200`
        with the result. If the search takes longer, you get the usual `202` and
        poll. `wait` is ignored when you send `scrapeOptions`, since reading
        pages takes longer.


        `limit` is per source, so 3 sources at 10 can return 30 results. To get
        the next page of a source, send its token from `nextPageTokens` back as
        `pageTokens`. If you send the same search again within 5 seconds, you
        get the first job's `jobId` back with `deduplicated: true`.


        **Credits:** 1 per 10 results per source, rounded up, so 20 web results
        cost 2 and 3 cost 1. A source with no results costs nothing. With
        `scrapeOptions`, each page read is billed as a scrape. See [How credits
        work](/billing/how-credits-work).


        **Rate limits:** 60 requests a minute, and up to 10 unfinished searches
        at a time.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  maxLength: 2000
                  description: What to search for.
                  example: best espresso machine
                sources:
                  type: array
                  minItems: 1
                  items:
                    type: string
                    enum:
                      - web
                      - news
                      - images
                      - videos
                      - research
                      - developer
                  default:
                    - web
                  description: >-
                    Where to search. `research` returns academic papers and
                    preprints, and `developer` returns GitHub issues and pull
                    requests. Each source comes back as its own list.
                limit:
                  type: integer
                  minimum: 1
                  maximum: 20
                  default: 10
                  description: Results per source.
                page:
                  type: integer
                  minimum: 1
                  maximum: 5
                  default: 1
                  description: >-
                    Which page of results to return. Once you have a result,
                    prefer `pageTokens`, which continues the exact same result
                    set.
                pageTokens:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Tokens from an earlier result's `nextPageTokens`, keyed by
                    source, such as `{ "web": "v1...." }`. Send them with the
                    next `page` number. A token that has expired isn't an error:
                    that source runs as a fresh search.
                country:
                  type: string
                  description: >-
                    The country to search from, which changes which results you
                    get. A two-letter code such as `us`, `gb` or `de`, or
                    `global`, `eu` or `asia`.
                  example: gb
                timeRange:
                  type: string
                  enum:
                    - hour
                    - day
                    - week
                    - month
                    - year
                  description: >-
                    Only return results from this recent period. Some sources
                    don't support every value, and ignore one they can't apply.
                includeDomains:
                  type: array
                  maxItems: 20
                  items:
                    type: string
                  description: >-
                    Only return results from these domains, such as
                    `["github.com"]`. Can't be used with `excludeDomains`.
                excludeDomains:
                  type: array
                  maxItems: 20
                  items:
                    type: string
                  description: >-
                    Leave out results from these domains. Can't be used with
                    `includeDomains`.
                filetype:
                  type: string
                  enum:
                    - pdf
                  description: Only return PDF files.
                wait:
                  type: boolean
                  default: false
                  description: >-
                    Waits up to 20 seconds and answers `200` with the result. If
                    the search takes longer, you get `202` and poll as usual.
                    Ignored with `scrapeOptions`.
                scrapeOptions:
                  type: object
                  required:
                    - formats
                  description: >-
                    Reads the top web results and adds each page's Markdown to
                    its result as `markdown`. Only web results are read. The
                    search takes as long as the slowest page, up to about two
                    minutes.
                  properties:
                    formats:
                      type: array
                      items:
                        type: string
                        enum:
                          - markdown
                      description: >-
                        What to add to each result. Only `markdown` is
                        supported.
                    maxResults:
                      type: integer
                      minimum: 1
                      maximum: 20
                      description: >-
                        How many of the top web results to read. Without it, up
                        to 10 are read.
            examples:
              web_wait:
                summary: Web search, answered inline
                value:
                  query: best espresso machine
                  sources:
                    - web
                  limit: 3
                  wait: true
              multi_source:
                summary: News, research and GitHub at once
                value:
                  query: vector database
                  sources:
                    - news
                    - research
                    - developer
                  limit: 2
                  wait: true
              scrape_content:
                summary: Search and read the top result
                value:
                  query: how to redact data in posthog
                  sources:
                    - web
                  limit: 2
                  scrapeOptions:
                    formats:
                      - markdown
                    maxResults: 1
      responses:
        '200':
          description: >-
            Only with `wait: true`. The search finished within 20 seconds.
            `status` is `completed` with the result, or `failed` with the reason
            in `error`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - completed
                      - failed
                  jobId:
                    type: string
                    format: uuid
                    description: >-
                      The job's ID. Works with `GET /search/{jobId}` for the
                      next hour.
                  progress:
                    type: object
                    properties:
                      message:
                        type: string
                        description: A short status line.
                      progress:
                        type: number
                        description: '`1` when completed, `0` when failed.'
                  result:
                    description: The result when `status` is `completed`, `null` otherwise.
                    oneOf:
                      - $ref: '#/components/schemas/SearchResult'
                      - type: 'null'
                  error:
                    type:
                      - string
                      - 'null'
                    description: Why the search failed. `null` otherwise.
              example:
                status: completed
                jobId: b3629517-f38a-4827-8536-25dee8cad0ec
                progress:
                  message: Search completed successfully
                  progress: 1
                result:
                  success: true
                  data:
                    web:
                      - title: >-
                          The 16 Best Espresso Machines of 2026, Tested &
                          Reviewed
                        url: >-
                          https://www.seriouseats.com/best-espresso-machines-5185482
                        description: >-
                          We tested 41 home espresso machines to find which 16
                          pulled the best shots, steamed latte art-worthy
                          microfoam, and were easy to use. We have top picks at
                          all prices.
                        position: 1
                      - title: Best Espresso Machines 2026 | Tested - Forbes Vetted
                        url: >-
                          https://www.forbes.com/sites/forbes-personal-shopper/article/best-espresso-machine/
                        description: >-
                          For devotees of handcrafted café beverages, investing
                          in an espresso machine can save both time and money
                          (particularly in the long run). ...
                        position: 2
                      - title: >-
                          The 7 best espresso machines you can buy in 2026 -
                          Tom's Guide
                        url: >-
                          https://www.tomsguide.com/home/coffee-makers/best-espresso-machines
                        description: >-
                          Our editor-selected guide to the best espresso
                          machines you can buy, and advice on finding the right
                          one for you.
                        position: 3
                    nextPageTokens:
                      web: >-
                        v1.WsrkJb5NyTSUa0o5ESmXstp0yS4ES_TPYDeE7Bl7wNgf_wDV75yX8L5hUnXoANcQxXKPg-5LyY0OKsSnVPQM...
                  stats:
                    durationMs: 4015
                  logUuid: e5a1a64a-75ad-4db2-841e-9b9cd4597bf9
                error: null
        '202':
          description: >-
            The search was queued, or it was still running when the 20-second
            `wait` ran out. Poll `GET /search/{jobId}` for the result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - queued
                  jobId:
                    type: string
                    format: uuid
                    description: The job's ID. Use it with `GET /search/{jobId}`.
                  message:
                    type: string
                    description: Where to poll for the result.
                  deduplicated:
                    type: boolean
                    description: >-
                      `true` when the same search was sent in the last 5 seconds
                      and this is that job's ID.
              examples:
                queued:
                  summary: Queued, still running after the wait
                  value:
                    status: queued
                    jobId: 7ae18e2b-2953-45d8-9cea-5a246f367c2f
                    message: >-
                      Search job has been queued. Poll
                      /api/search/7ae18e2b-2953-45d8-9cea-5a246f367c2f to get
                      the result.
                scrape_content:
                  summary: Queued, with scrapeOptions
                  value:
                    status: queued
                    jobId: 08135670-12ca-442d-a48c-e83f0da437d7
                    message: >-
                      Search job has been queued. Poll
                      /api/search/08135670-12ca-442d-a48c-e83f0da437d7 to get
                      the result.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >-
            The account's payment is overdue. Update the payment method in the
            dashboard to continue.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: >-
                  Your payment is overdue. Please update your payment method to
                  continue searching.
                code: PAYMENT_OVERDUE
        '403':
          description: >-
            Either your account doesn't have enough credits for the most this
            search could cost (every source returning `limit` results), or
            search isn't turned on for your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                credits:
                  summary: Not enough credits
                  value:
                    status: error
                    message: You have exceeded your monthly credit limit.
                not_available:
                  summary: Search not turned on for this account
                  value:
                    status: error
                    message: This feature isn't available on your account yet.
        '422':
          description: The request isn't valid. `errors` lists every problem.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                query_and_limit:
                  summary: Empty query and limit too high
                  value:
                    status: error
                    message: >-
                      Request validation failed. Fix the errors below and try
                      again.
                    errors:
                      - '"query" is required and must be a non-empty string.'
                      - '"limit" must be an integer between 1 and 20.'
                bad_source:
                  summary: Unknown source
                  value:
                    status: error
                    message: >-
                      Request validation failed. Fix the errors below and try
                      again.
                    errors:
                      - >-
                        "sources" contains invalid values: podcasts. Valid
                        values: web, news, images, videos, research, developer.
                both_domain_lists:
                  summary: includeDomains and excludeDomains together
                  value:
                    status: error
                    message: >-
                      Request validation failed. Fix the errors below and try
                      again.
                    errors:
                      - Use "includeDomains" or "excludeDomains", not both.
        '429':
          description: >-
            Too many requests. Either more than 60 searches in a minute, or 10
            searches already unfinished. Wait, then send the request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                rate_limit:
                  summary: More than 60 a minute
                  value:
                    status: error
                    message: >-
                      Too many job submissions. Please slow down and try again
                      shortly.
                pending:
                  summary: 10 searches still running
                  value:
                    status: error
                    message: >-
                      You have too many pending search jobs. Please wait for
                      some to complete before submitting more.
                    code: TOO_MANY_PENDING_JOBS
        '503':
          description: >-
            Search is at capacity. Wait `retry_after` seconds, then send the
            request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: >-
                  The search service is currently at capacity. Please retry in a
                  few minutes.
                code: SERVICE_BUSY
                retry_after: 30
components:
  schemas:
    SearchResult:
      type: object
      description: The finished result of a search.
      properties:
        success:
          type: boolean
          description: >-
            `false` when no source returned any results. You aren't charged
            then.
        data:
          type: object
          description: >-
            One list per source you asked for, plus `nextPageTokens` and,
            sometimes, `extras`.
          properties:
            web:
              type: array
              items:
                $ref: '#/components/schemas/SearchResultItem'
              description: Web results, when you asked for `web`.
            news:
              type: array
              items:
                $ref: '#/components/schemas/SearchResultItem'
              description: News articles, when you asked for `news`.
            images:
              type: array
              items:
                $ref: '#/components/schemas/SearchResultItem'
              description: Images, when you asked for `images`.
            videos:
              type: array
              items:
                $ref: '#/components/schemas/SearchResultItem'
              description: Videos, when you asked for `videos`.
            research:
              type: array
              items:
                $ref: '#/components/schemas/SearchResultItem'
              description: Academic papers and preprints, when you asked for `research`.
            developer:
              type: array
              items:
                $ref: '#/components/schemas/SearchResultItem'
              description: GitHub issues and pull requests, when you asked for `developer`.
            extras:
              $ref: '#/components/schemas/SearchExtras'
            nextPageTokens:
              type: object
              additionalProperties:
                type: string
              description: >-
                One token per source that has more results. Send it back as
                `pageTokens` to get that source's next page. Missing for a
                source with no more results.
        stats:
          type: object
          description: How the search ran.
          properties:
            durationMs:
              type: integer
              description: How long the search took, in milliseconds.
        logUuid:
          type: string
          format: uuid
          description: >-
            The ID of this search in your [search
            logs](/api-reference/search/search-logs). When you fetch a next page
            with `pageTokens`, this stays the first page's ID.
    ErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          description: What went wrong, as a sentence you can show to a person.
        code:
          type: string
          description: >-
            A stable code for the error, when there is one, such as
            `JOB_NOT_FOUND` or `SERVICE_BUSY`. Branch on this rather than on
            `message`.
        errors:
          description: >-
            On validation errors (`422`), every problem with the request.
            Scrape, batch, crawl, map and search return a list of sentences.
            Templates, presets and monitors return `{ field, message }` objects.
          oneOf:
            - type: array
              items:
                type: string
            - type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
        retry_after:
          type: integer
          description: >-
            On `503 SERVICE_BUSY`, how many seconds to wait before sending the
            request again.
    SearchResultItem:
      type: object
      required:
        - title
        - url
        - position
      description: One search result. Which optional fields appear depends on the source.
      properties:
        title:
          type: string
          description: The result's title. Developer results start with `PR:` or `Issue:`.
        url:
          type: string
          description: The result's link. For images, the page the image is on.
        description:
          type: string
          description: >-
            The snippet shown with the result. For research, the abstract. For
            developer results, the repository, its state and the start of the
            body.
        position:
          type: integer
          description: The result's rank within its source, starting at 1.
        imageUrl:
          type: string
          description: Images only. The full-size image.
        thumbnailUrl:
          type: string
          description: Images and videos. A small preview image.
        imageWidth:
          type: integer
          description: Images only, when known. The width in pixels.
        imageHeight:
          type: integer
          description: Images only, when known. The height in pixels.
        date:
          type: string
          description: >-
            News, videos, research and developer results. As the source gives
            it, so it can be relative (`3 years ago`) or a date and time. For
            research, the publication date.
        source:
          type: string
          description: >-
            News, research and developer results. The publisher for news, the
            journal or database for research, and `GitHub` for developer
            results.
        duration:
          type: string
          description: Videos only. The length, such as `24:59`.
        authors:
          type: string
          description: >-
            Research and developer results. The authors as one comma-separated
            string for research, and the username of whoever opened the issue or
            pull request for developer results.
        doi:
          type: string
          description: Research only, when the paper has one. Its DOI.
        markdown:
          type: string
          description: >-
            Web results only, with `scrapeOptions`. The page as Markdown.
            Missing when the page couldn't be read in time, when it's past
            `scrapeOptions.maxResults`, or when you were out of credits. That's
            not an error.
        structuredData:
          type: object
          description: >-
            Web results only, with `scrapeOptions`, when the result is on one of
            the [popular sites](/sites/overview). The page's data, such as a
            product's price or a video's views.
    SearchExtras:
      type: object
      description: >-
        Extra panels that sometimes come with web results. Only present when the
        search found them, so never rely on them being there.
      properties:
        relatedSearches:
          type: array
          items:
            type: string
          description: Related queries people also search for.
        topStories:
          type: array
          description: News stories shown for the query.
          items:
            type: object
            required:
              - title
              - url
            properties:
              title:
                type: string
                description: The story's headline.
              url:
                type: string
                description: The story's link.
              source:
                type: string
                description: The publisher.
              date:
                type: string
                description: When it was published
                as shown.: null
        answerBox:
          type: object
          description: A direct answer, such as a currency or unit conversion.
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - currency
                - unit_conversion
              description: What kind of answer it is.
            value:
              type: string
              description: The answer.
        knowledgeBox:
          type: object
          description: A short summary of a company, place or idea.
          required:
            - title
          properties:
            title:
              type: string
              description: What the summary is about.
            category:
              type: string
              description: What kind of thing it is.
            description:
              type: string
              description: The summary.
  responses:
    Unauthorized:
      description: The API key is missing, wrong, or turned off.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing:
              summary: No key sent
              value:
                status: error
                message: Missing authentication
            invalid:
              summary: Wrong or turned-off key
              value:
                status: error
                message: Invalid token or API key
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.