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

# Scrape

> Read one page in the formats you ask for: Markdown, HTML, links, a screenshot, structured JSON and more. Ask for the `screenshot` format alone to capture a page.

Read one page in the formats you choose. For a guide with examples, see [Scrape](/features/scrape.md). To capture a page as an image, ask for the `screenshot` format: see [Screenshot](/features/screenshot.md).


## OpenAPI

````yaml /api-reference/openapi.json POST /scrape
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:
  /scrape:
    post:
      tags:
        - Scrape
      summary: Scrape
      description: >-
        Read one page in the formats you ask for: Markdown, HTML, links, a
        screenshot, structured JSON and more. Ask for the `screenshot` format
        alone to capture a page.
      operationId: scrape
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScrapeRequest'
      responses:
        '200':
          description: The page, in the formats you asked for.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScrapeResponse'
        '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/scrape" \
              -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "url": "https://example.com",
                "formats": ["markdown", "html"]
              }'
        - lang: javascript
          label: Node
          source: >-
            import ScreenshotRender from "screenshotrender";


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


            const doc = await screenshotrender.scrape("https://example.com", {
              formats: ["markdown", "html"],
            });

            console.log(doc.markdown);
        - lang: python
          label: Python
          source: >-
            from screenshotrender import ScreenshotRender


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


            doc = screenshotrender.scrape("https://example.com",
            formats=["markdown", "html"])

            print(doc.markdown)
components:
  schemas:
    ScrapeRequest:
      allOf:
        - type: object
          properties:
            url:
              type: string
              description: The page to read.
              example: https://example.com
          required:
            - url
        - $ref: '#/components/schemas/PageOptions'
    ScrapeResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/Document'
        creditsUsed:
          type: integer
          description: What this request cost.
        warning:
          type: string
    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
    Document:
      type: object
      description: One page. Only the formats you asked for are present.
      properties:
        markdown:
          type: string
        summary:
          type: string
        html:
          type: string
        rawHtml:
          type: string
        links:
          type: array
          items:
            type: string
        images:
          type: array
          items:
            type: string
        screenshot:
          type: string
          description: The image's URL. Images are kept for 30 days.
        json:
          description: The structured data from the `json` format.
        answer:
          type: string
          description: The answer from the `question` format.
        highlights:
          description: The passages from the `highlights` format.
        branding:
          type: object
          description: Logo, colors, fonts and the page's design system.
        actions:
          type: object
          description: What `actions` produced, such as `screenshots`.
          properties:
            screenshots:
              type: array
              items:
                type: string
        metadata:
          $ref: '#/components/schemas/Metadata'
      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
    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
  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-`.

````