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

# Search

> Search the web, and images. Add `scrapeOptions` to read every result page too.

Search the web and, with `scrapeOptions`, read the results. For a guide with examples, see [Search](/features/search.md).


## OpenAPI

````yaml /api-reference/openapi.json POST /search
openapi: 3.1.0
info:
  title: ScreenshotRender API
  version: v1
  description: >-
    Screenshot any website, search the web, and turn any page or document into
    clean Markdown or structured data.
servers:
  - url: https://www.screenshotrender.com/api/v1
security:
  - bearerAuth: []
paths:
  /search:
    post:
      tags:
        - Search
      summary: Search
      description: >-
        Search the web, and images. Add `scrapeOptions` to read every result
        page too.
      operationId: search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: The results, grouped by source.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '429':
          $ref: '#/components/responses/Busy'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl -s -X POST "https://www.screenshotrender.com/api/v1/search" \
              -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "query": "open source vector databases",
                "limit": 3
              }'
        - lang: javascript
          label: Node
          source: >-
            import ScreenshotRender from "screenshotrender";


            const screenshotrender = new ScreenshotRender({ apiKey:
            "sr-YOUR-API-KEY" });


            const results = await screenshotrender.search("open source vector
            databases", { limit: 3 });


            for (const result of results.web ?? []) {
              console.log(result.title, result.url);
            }
        - lang: python
          label: Python
          source: >-
            from screenshotrender import ScreenshotRender


            screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")


            results = screenshotrender.search("open source vector databases",
            limit=3)


            for result in results.web or []:
                print(result.title, result.url)
components:
  schemas:
    SearchRequest:
      type: object
      properties:
        query:
          type: string
          example: open source vector databases
        limit:
          type: integer
          description: Results per source.
          default: 10
          maximum: 100
        sources:
          type: array
          description: Where to search.
          default:
            - web
          items:
            type: string
            enum:
              - web
              - images
        includeDomains:
          type: array
          items:
            type: string
          description: Only return results from these domains.
        tbs:
          type: string
          description: A time range, like `qdr:m` for the past month.
        scrapeOptions:
          $ref: '#/components/schemas/PageOptions'
          description: >-
            Read every result page too, in these formats. Each page read costs
            what a scrape would.
      required:
        - query
    SearchResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            web:
              type: array
              items:
                type: object
                description: >-
                  A result: its link and snippet, and the page itself in the
                  formats asked for when `scrapeOptions` was set.
                properties:
                  url:
                    type: string
                  title:
                    type: string
                  description:
                    type: string
                  position:
                    type: integer
                  markdown:
                    type: string
                  metadata:
                    $ref: '#/components/schemas/Metadata'
                additionalProperties: true
            images:
              type: array
              items:
                type: object
                properties:
                  title:
                    type: string
                  imageUrl:
                    type: string
                  imageWidth:
                    type: integer
                  imageHeight:
                    type: integer
                  url:
                    type: string
                  position:
                    type: integer
        creditsUsed:
          type: integer
    PageOptions:
      type: object
      properties:
        formats:
          type: array
          description: The formats to return. Defaults to Markdown.
          items:
            $ref: '#/components/schemas/Format'
        onlyMainContent:
          type: boolean
          description: >-
            Leave out the parts of the page around its main content. On by
            default.
          default: true
        includeTags:
          type: array
          items:
            type: string
          description: >-
            Only keep these elements: tag names, classes or ids, like `h1`,
            `.article` or `#main`.
        excludeTags:
          type: array
          items:
            type: string
          description: 'Drop these elements: tag names, classes or ids.'
        waitFor:
          type: integer
          description: Extra time to wait after the page loads, in milliseconds.
        timeout:
          type: integer
          description: How long the page may take, in milliseconds.
        mobile:
          type: boolean
          description: Load the page as a phone would.
        location:
          type: object
          description: Load the page from this country.
          properties:
            country:
              type: string
              description: An ISO country code, like `US` or `DE`.
            languages:
              type: array
              items:
                type: string
              description: Preferred languages, like `de-DE`.
        maxAge:
          type: integer
          description: >-
            Accept a cached copy of the page up to this old, in milliseconds.
            `0` always loads a fresh copy.
        headers:
          type: object
          additionalProperties:
            type: string
          description: Extra HTTP headers to send to the page.
        blockAds:
          type: boolean
          description: Hide ads and cookie banners before the page is read.
        actions:
          type: array
          description: >-
            Browser steps to run before the page is read, such as `wait`,
            `click` and `screenshot`.
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - wait
                  - click
                  - screenshot
              milliseconds:
                type: integer
                description: For `wait`.
              selector:
                type: string
                description: 'For `click`: a CSS selector.'
            required:
              - type
    Metadata:
      type: object
      description: >-
        What the page says about itself (title, description, Open Graph tags)
        and how it was loaded.
      properties:
        title:
          type: string
        description:
          type: string
        language:
          type: string
        sourceURL:
          type: string
          description: The URL you asked for.
        url:
          type: string
          description: The URL the page ended up at.
        statusCode:
          type: integer
        contentType:
          type: string
        numPages:
          type: integer
          description: 'For documents: the pages read.'
        totalPages:
          type: integer
          description: 'For documents: the pages in the file.'
        cacheState:
          type: string
          enum:
            - hit
            - miss
        cachedAt:
          type: string
      additionalProperties: true
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: What went wrong, in words.
        code:
          type: string
          description: A stable code to branch on, such as `invalid_request`.
        field:
          type: string
          description: The request field the error is about, when there is one.
      required:
        - success
        - error
        - code
    Format:
      description: >-
        An output format: a name, or an object for the formats that take
        settings.
      oneOf:
        - title: Name
          type: string
          enum:
            - markdown
            - summary
            - html
            - rawHtml
            - links
            - images
            - screenshot
            - branding
        - title: Screenshot
          type: object
          properties:
            type:
              type: string
              const: screenshot
            fullPage:
              type: boolean
              description: Capture the whole page, not just the browser window.
              default: false
            viewport:
              type: object
              description: The browser window's size in pixels.
              properties:
                width:
                  type: integer
                height:
                  type: integer
              required:
                - width
                - height
          required:
            - type
        - title: JSON
          type: object
          description: Structured data extracted with AI. +4 credits per page.
          properties:
            type:
              type: string
              const: json
            prompt:
              type: string
              description: What to extract, in plain words.
            schema:
              type: object
              description: A JSON Schema the result must follow.
          required:
            - type
        - title: Question
          type: object
          description: >-
            A short answer to a question about the page, in `answer`. +4 credits
            per page.
          properties:
            type:
              type: string
              const: question
            question:
              type: string
          required:
            - type
            - question
        - title: Highlights
          type: object
          description: The passages of the page that match a query. +4 credits per page.
          properties:
            type:
              type: string
              const: highlights
            query:
              type: string
          required:
            - type
            - query
  responses:
    InvalidRequest:
      description: Something in the request isn't valid. `field` names it, when known.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: url is required.
            code: invalid_request
            field: url
    InvalidApiKey:
      description: The API key doesn't match an account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Invalid API key.
            code: invalid_api_key
    InsufficientCredits:
      description: The balance can't cover the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: >-
              This crawl can use up to 10000 credits (10000 pages at 1 credit
              each) and your balance is 773. Lower the page limit or add
              credits.
            code: insufficient_credits
    Busy:
      description: >-
        Too many requests right now. Wait for `Retry-After` seconds and send it
        again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your API key from the dashboard. It starts with `sr-`.

````