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

# Parse

> Turn a document into Markdown: upload a file (multipart), or send the `url` of a public document (JSON). PDFs are billed 1 credit per page read.

Turn a document into Markdown: send its URL as JSON, or upload it as `multipart/form-data` in a field named `file`, with options as JSON in a field named `options`. For a guide with examples, see [Parse](/features/parse.md).


## OpenAPI

````yaml /api-reference/openapi.json POST /parse
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:
  /parse:
    post:
      tags:
        - Parse
      summary: Parse
      description: >-
        Turn a document into Markdown: upload a file (multipart), or send the
        `url` of a public document (JSON). PDFs are billed 1 credit per page
        read.
      operationId: parse
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ParseUpload'
          application/json:
            schema:
              $ref: '#/components/schemas/ParseUrlRequest'
      responses:
        '200':
          description: The document as Markdown.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScrapeResponse'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '413':
          description: The upload is over 4 MB. Parse bigger documents from a URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: >-
                  This file is 5.0 MB. Uploads are limited to 4 MB, parse bigger
                  documents from a URL instead.
                code: file_too_large
                field: file
        '415':
          description: The file type isn't supported.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl -s -X POST "https://www.screenshotrender.com/api/v1/parse" \
              -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "url": "https://arxiv.org/pdf/1706.03762",
                "parsers": [{ "type": "pdf", "maxPages": 2 }]
              }'
        - lang: javascript
          label: Node
          source: >-
            import ScreenshotRender from "screenshotrender";


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


            const paper = await
            screenshotrender.parse("https://arxiv.org/pdf/1706.03762", {
              parsers: [{ type: "pdf", maxPages: 2 }],
            });

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

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

            paper = screenshotrender.parse(
                "https://arxiv.org/pdf/1706.03762",
                parsers=[{"type": "pdf", "max_pages": 2}],
            )
            print(paper.markdown)
        - lang: bash
          label: cURL (upload)
          source: |-
            curl -s -X POST "https://www.screenshotrender.com/api/v1/parse" \
              -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY" \
              -F "file=@report.pdf"
components:
  schemas:
    ParseUpload:
      type: object
      properties:
        file:
          type: string
          format: binary
          description: >-
            Up to 4 MB: .pdf, .docx, .doc, .docm, .odt, .rtf, .xlsx, .xls,
            .xlsm, .xlsb, .ods, .csv, .pptx, .ppt, .pptm, .odp, .epub, .html,
            .htm or .xhtml.
        options:
          type: string
          description: >-
            Optional: the options as a JSON string, like
            `{"formats":["markdown","summary"]}`.
      required:
        - file
    ParseUrlRequest:
      type: object
      properties:
        url:
          type: string
          description: A public document.
          example: https://arxiv.org/pdf/1706.03762
        parsers:
          type: array
          items:
            $ref: '#/components/schemas/Parser'
        formats:
          type: array
          description: Defaults to Markdown.
          items:
            $ref: '#/components/schemas/Format'
      required:
        - url
    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
    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
    Parser:
      type: object
      properties:
        type:
          type: string
          const: pdf
        maxPages:
          type: integer
          description: Stop after this many pages (1 credit each).
      required:
        - type
    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
    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
    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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your API key from the dashboard. It starts with `sr-`.

````