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

# Fetch

> Fetch and render a single URL. Returns HTML, Markdown, JSON, or a screenshot.



## OpenAPI

````yaml post /v1/fetch
openapi: 3.1.0
info:
  title: Scrapio
  version: 1.0.0
  description: >-
    Turn any URL into structured data. Fetch raw HTML, crawl sites, extract
    structured content, interact with dynamic pages, and search the web through
    one API.
  contact:
    name: Scrapio Support
    url: https://scrapio.dev
  license:
    name: Proprietary
servers:
  - url: https://api.scrapio.dev
    description: Production
  - url: http://localhost:3000
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: System
  - name: Fetch
  - name: Google
  - name: Crawl
  - name: Map
  - name: Interact
  - name: Search
  - name: Jobs
  - name: YouTube
  - name: Amazon
  - name: Walmart
paths:
  /v1/fetch:
    post:
      tags:
        - Fetch
      summary: Fetch and render a URL
      description: >-
        Fetches a URL and returns its content as HTML, Markdown, JSON, or a
        screenshot. Set `render_js: true` to execute JavaScript before capturing
        the output. Requests that exceed 15 seconds are automatically promoted
        to async jobs and return a `job_id` to poll.
      operationId: createFetch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FetchRequest'
            examples:
              basic:
                summary: Fetch a page as Markdown
                value:
                  url: https://example.com
                  output:
                    - markdown
              js_render:
                summary: Render JavaScript and extract structured data
                value:
                  url: https://news.ycombinator.com
                  render_js: true
                  output:
                    - json
                  extract:
                    mode: schema
                    schema:
                      top_stories: array of story titles
      responses:
        '200':
          description: Inline fetch completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InlineFetchResponse'
        '202':
          description: Request exceeded inline timeout; async job queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncFetchResponse'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Extraction validation failed on the fetched content.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Target site blocked or rejected the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Browser or proxy backend unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST https://api.scrapio.dev/v1/fetch \
              -H "Authorization: Bearer $SCRAPIO_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{"url":"https://example.com","output":["markdown"]}'
        - lang: Python
          label: Python
          source: |-
            import os, requests
            resp = requests.post(
                "https://api.scrapio.dev/v1/fetch",
                headers={"Authorization": f"Bearer {os.environ['SCRAPIO_API_KEY']}"},
                json={"url": "https://example.com", "output": ["markdown"]},
            )
            print(resp.json()["outputs"]["markdown"])
        - lang: JavaScript
          label: Node.js
          source: |-
            const resp = await fetch("https://api.scrapio.dev/v1/fetch", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.SCRAPIO_API_KEY}`, "Content-Type": "application/json" },
              body: JSON.stringify({ url: "https://example.com", output: ["markdown"] }),
            });
            const data = await resp.json();
            console.log(data.outputs.markdown);
components:
  schemas:
    FetchRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
        render_js:
          type: boolean
        device:
          type: string
          enum:
            - desktop
            - mobile
            - tablet
        session:
          type: object
          properties:
            id:
              type: string
              minLength: 1
          required:
            - id
          additionalProperties: false
        output:
          minItems: 1
          type: array
          items:
            type: string
            enum:
              - html
              - markdown
              - json
              - screenshot
        extract:
          anyOf:
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - page
              required:
                - mode
              additionalProperties: false
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - selectors
                fields:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: object
                    properties:
                      selector:
                        type: string
                        minLength: 1
                      type:
                        type: string
                        enum:
                          - text
                          - html
                          - attr
                      attribute:
                        type: string
                        minLength: 1
                    required:
                      - selector
                      - type
                    additionalProperties: false
              required:
                - mode
                - fields
              additionalProperties: false
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - schema
                schema:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: string
              required:
                - mode
                - schema
              additionalProperties: false
            - type: object
              properties:
                mode:
                  type: string
                  enum:
                    - instruction
                instruction:
                  type: string
                  minLength: 1
              required:
                - mode
                - instruction
              additionalProperties: false
        wait_for:
          type: object
          properties:
            network_idle:
              type: boolean
          additionalProperties: false
        timeout_ms:
          type: integer
          exclusiveMinimum: 0
          maximum: 300000
      required:
        - url
      additionalProperties: false
    InlineFetchResponse:
      type: object
      properties:
        request_id:
          type: string
        mode:
          type: string
          enum:
            - inline
        status:
          type: string
          enum:
            - completed
            - partial
        outputs:
          type: object
          properties:
            html:
              type: string
            markdown:
              type: string
            json:
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
            screenshot:
              type: object
              properties:
                url:
                  type: string
                  format: uri
              required:
                - url
          additionalProperties: false
        usage:
          type: object
          properties:
            credits:
              type: integer
              minimum: 0
              maximum: 9007199254740991
          required:
            - credits
        diagnostics:
          type: object
          properties:
            outcome:
              type: string
              enum:
                - partial
            output_failures:
              type: array
              items:
                type: object
                properties:
                  output:
                    type: string
                    enum:
                      - html
                      - markdown
                      - json
                      - screenshot
                  code:
                    type: string
                  message:
                    type: string
                required:
                  - output
                  - code
                  - message
          required:
            - outcome
            - output_failures
        session:
          type: object
          properties:
            id:
              type: string
            updated:
              type: boolean
          required:
            - id
            - updated
      required:
        - request_id
        - mode
        - status
        - outputs
        - usage
      additionalProperties: false
    AsyncFetchResponse:
      type: object
      properties:
        request_id:
          type: string
        mode:
          type: string
          enum:
            - async
        status:
          type: string
          enum:
            - queued
        job_id:
          type: string
      required:
        - request_id
        - mode
        - status
        - job_id
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        request_id:
          type: string
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
        diagnostics:
          type: object
          properties:
            outcome:
              type: string
              enum:
                - failed
            retryable:
              type: boolean
            blocked:
              type: boolean
            timed_out:
              type: boolean
          required:
            - outcome
            - retryable
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````