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

# Create a capture

> Requires screenshot:write. Accepts a JSON body of at most 256 KiB. Returns capture data on 200 or a job handle on 202, including when sync is true. A query mode=async overrides the body's sync flag. Successful viewport images cost 1 credit, full-page images 2, and PDFs 3. Use the same key and identical request on an idempotent retry.



## OpenAPI

````yaml /openapi.json post /v1/screenshot
openapi: 3.1.0
info:
  title: ScreenshotAPI
  version: 1.0.0
  description: >-
    Hosted ScreenshotAPI capture endpoints, authentication, request options, and
    response envelopes.
servers:
  - url: https://api.screenshotapi.tech
    description: ScreenshotAPI production REST API
security:
  - bearerAuth: []
tags:
  - name: Captures
  - name: Jobs
  - name: Webhook delivery
  - name: Service
paths:
  /v1/screenshot:
    post:
      tags:
        - Captures
      summary: Create a capture
      description: >-
        Requires screenshot:write. Accepts a JSON body of at most 256 KiB.
        Returns capture data on 200 or a job handle on 202, including when sync
        is true. A query mode=async overrides the body's sync flag. Successful
        viewport images cost 1 credit, full-page images 2, and PDFs 3. Use the
        same key and identical request on an idempotent retry.
      operationId: createCapture
      parameters:
        - name: mode
          in: query
          description: Optional asynchronous override.
          required: false
          schema:
            type: string
            enum:
              - async
        - name: Idempotency-Key
          in: header
          description: >-
            Stable logical submission key. Reuse with identical configuration
            and the same API key.
          required: false
          schema:
            type: string
            minLength: 1
            maxLength: 128
            pattern: ^[A-Za-z0-9._-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CaptureRequest'
            example:
              url: https://example.com
              format: png
              sync: false
      responses:
        '200':
          description: Completed capture. Download data.cdn_url.
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  request_id:
                    type: string
                  data:
                    $ref: '#/components/schemas/CaptureData'
                required:
                  - ok
                  - request_id
                  - data
        '202':
          description: Accepted work. Poll the relative poll_url on the same API origin.
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  request_id:
                    type: string
                  data:
                    $ref: '#/components/schemas/AcceptedJob'
                required:
                  - ok
                  - request_id
                  - data
        '400':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers:
            Retry-After:
              description: Delay in seconds when provided.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '451':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: >-
            Structured failure. Inspect error.code, error.retriable, and
            error.details before retrying.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CaptureRequest:
      type: object
      properties:
        url:
          type: string
          minLength: 1
          description: >-
            Public HTTP or HTTPS target. Bare hostnames are normalized to HTTPS.
            Private network destinations are blocked by the hosted service.
        viewport:
          type: object
          properties:
            width:
              type: integer
              minimum: 320
              maximum: 3840
              default: 1280
            height:
              type: integer
              minimum: 240
              maximum: 2160
              default: 720
            deviceScaleFactor:
              type: number
              minimum: 1
              maximum: 3
              default: 2
            isMobile:
              type: boolean
              default: false
            hasTouch:
              type: boolean
              default: false
          description: >-
            CSS-pixel viewport and output density. A device preset takes
            precedence over an explicit viewport.
        device:
          type: string
          description: >-
            Supported preset identifier; takes precedence over viewport
            settings.
          enum:
            - desktop_standard
            - desktop_hd
            - desktop_2k
            - desktop_4k
            - iphone_15_pro
            - iphone_15_pro_max
            - iphone_17_pro_max
            - pixel_8
            - ipad_pro_11
        full_page:
          type: boolean
          default: false
          description: >-
            Capture the scrollable page. Successful full-page images cost 2
            credits.
        full_page_algorithm:
          type: string
          enum:
            - by_sections
            - native
          default: by_sections
          description: >-
            Section capture is the default. Native uses the alternative
            full-page path.
        full_page_scroll_delay:
          type: integer
          minimum: 0
          maximum: 5000
          description: Delay between full-page scroll steps, in milliseconds.
        full_page_scroll_by:
          type: integer
          minimum: 120
          maximum: 2160
          description: Full-page scroll step in CSS pixels.
        reduce_motion:
          type: boolean
          default: true
          description: Reduce motion while capturing.
        format:
          type: string
          enum:
            - png
            - jpeg
            - webp
            - pdf
          default: webp
          description: >-
            Output format. Full-page by_sections PDFs package rendered pixels;
            native and viewport PDFs use browser PDF export. PDFs cost 3 credits
            and cannot be combined with selector.
        quality:
          type: integer
          minimum: 1
          maximum: 100
          default: 90
          description: JPEG or WebP encoding quality; does not control PNG encoding.
        delay:
          type: integer
          minimum: 0
          maximum: 30000
          default: 0
          description: Additional wait after page settlement, in milliseconds.
        timeout:
          type: integer
          minimum: 1000
          maximum: 60000
          default: 30000
          description: >-
            Capture/navigation time budget in milliseconds, independent of the
            synchronous HTTP wait budget.
        wait_for_selector:
          type: string
          description: CSS readiness selector to wait for before capture.
        wait_for_content:
          type: boolean
          default: false
          description: Enable content-readiness waiting for dynamic pages.
        wait_for_idle:
          type: boolean
          default: true
          description: Enable additional network-idle settlement.
        wait_until:
          type: string
          enum:
            - load
            - domcontentloaded
            - networkidle
          default: load
          description: Navigation milestone to wait for.
        fail_if_incomplete:
          type: boolean
          default: false
          description: Reject detected incomplete or loading-shell captures.
        fail_if_content_missing:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 500
          maxItems: 32
          default: []
          description: Required text markers, trimmed before validation.
        fail_if_content_contains:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 500
          maxItems: 32
          default: []
          description: Disallowed text markers, trimmed before validation.
        min_capture_height:
          type: integer
          exclusiveMinimum: 0
          description: Minimum output height accepted by quality checks.
        min_capture_bytes:
          type: integer
          exclusiveMinimum: 0
          description: Minimum encoded output bytes accepted by quality checks.
        dark_mode:
          type: boolean
          default: false
          description: Emulate a dark preference when color_scheme is not explicitly set.
        color_scheme:
          type: string
          enum:
            - light
            - dark
            - no-preference
          description: Explicit browser color-scheme preference.
        locale:
          type: string
          description: Browser locale; overrides the region locale if supplied.
        timezone:
          type: string
          description: IANA browser timezone; overrides the region timezone if supplied.
        user_agent:
          type: string
          description: Explicit browser user agent.
        region:
          type: string
          description: >-
            Country-aligned locale/timezone preset and expected egress country.
            Does not provision a managed proxy.
          enum:
            - us
            - ca
            - gb
            - ie
            - de
            - fr
            - es
            - it
            - nl
            - sg
            - au
            - jp
            - kr
            - in
            - br
            - mx
            - za
            - ae
        proxy:
          type: object
          properties:
            server:
              type: string
              minLength: 1
            bypass:
              type: string
            username:
              type: string
            password:
              type: string
              writeOnly: true
          required:
            - server
          description: Caller-supplied public proxy endpoint and optional authentication.
        verify_egress:
          type: boolean
          default: true
          description: Verify observed egress country when a region is requested.
        block_ads:
          type: boolean
          default: true
          description: Enable ad filtering.
        block_cookie_banners:
          type: boolean
          default: true
          description: Enable cookie-banner filtering.
        block_chats:
          type: boolean
          default: true
          description: Enable chat-widget filtering.
        block_trackers:
          type: boolean
          default: true
          description: Enable tracker filtering.
        selector:
          type: string
          description: Capture the first matching visible element. Not supported with PDF.
        hide_selectors:
          type: array
          items:
            type: string
          default: []
          description: Suppress matching elements.
        remove_selectors:
          type: array
          items:
            type: string
          default: []
          description: Remove matching nodes; can affect layout.
        custom_css:
          type: string
          description: CSS injected into the target page.
        custom_js:
          type: string
          description: JavaScript executed in the target page.
        headers:
          type: object
          additionalProperties:
            type: string
          description: >-
            Headers sent to the target, not credentials for the ScreenshotAPI
            request. Keep target credentials private.
        sync:
          type: boolean
          default: true
          description: >-
            Wait for immediate completion when true; a slow or queued capture
            still returns 202. The mode=async query overrides this field.
        cache_ttl:
          type: integer
          minimum: 0
          default: 3600
          description: >-
            Maximum capture reuse age in seconds. Zero requests a fresh capture;
            not a storage-lifetime guarantee.
        store:
          type: boolean
          default: false
          description: >-
            Shared engine storage flag. Hosted REST output still requires a
            downloadable artifact.
        inspect_page:
          type: boolean
          default: false
          description: >-
            Extract readable Markdown and accessibility text from this render
            (12,000 characters each). Untrusted page content; normal capture
            credits apply and image caches are bypassed.
        webhook:
          type: object
          properties:
            url:
              type: string
              format: uri
              maxLength: 2048
            secret:
              type: string
              minLength: 16
              maxLength: 256
              writeOnly: true
          required:
            - url
            - secret
          description: >-
            Public HTTPS callback on port 443 with a 16–256 character signing
            secret. Delivered after terminal settlement.
      required:
        - url
    CaptureData:
      type: object
      properties:
        url:
          type: string
        final_url:
          type: string
        format:
          type: string
        width:
          type: number
        height:
          type: number
        bytes:
          type: number
        duration_ms:
          type: number
        cached:
          type: boolean
          default: false
        data_url:
          type: string
        cdn_url:
          type: string
        blocked_requests:
          type: number
          default: 0
        region:
          type: string
        egress_country:
          type: string
        render_diagnostics:
          type: object
          properties:
            version:
              type: integer
            algorithm:
              type: string
              enum:
                - by_sections
                - native
                - element
            sections:
              type: integer
              minimum: 0
            device_scale_factor:
              type: number
              exclusiveMinimum: 0
            scroll_height:
              type: number
              minimum: 0
            stopped_reason:
              type: string
            truncated:
              type: boolean
          required:
            - version
            - algorithm
            - sections
            - device_scale_factor
            - scroll_height
            - stopped_reason
            - truncated
        inspection:
          type: object
          properties:
            markdown:
              type: string
              maxLength: 12000
            accessible_tree:
              type: string
              maxLength: 12000
            untrusted_content:
              type: boolean
              enum:
                - true
            character_limit:
              type: number
              enum:
                - 12000
          required:
            - markdown
            - accessible_tree
            - untrusted_content
            - character_limit
      required:
        - url
        - final_url
        - format
        - width
        - height
        - bytes
        - duration_ms
        - cached
        - blocked_requests
    AcceptedJob:
      type: object
      properties:
        job_id:
          type: string
        state:
          type: string
          enum:
            - waiting
            - prioritized
            - active
            - completed
            - failed
            - delayed
            - paused
            - unknown
        poll_url:
          type: string
          description: Relative API path.
      required:
        - job_id
        - state
        - poll_url
    ErrorResponse:
      type: object
      properties:
        ok:
          type: boolean
          const: false
        request_id:
          type: string
        error:
          $ref: '#/components/schemas/CaptureError'
      required:
        - ok
        - request_id
        - error
    CaptureError:
      type: object
      properties:
        code:
          type: string
          enum:
            - invalid_request
            - idempotency_conflict
            - unauthorized
            - forbidden
            - quota_exceeded
            - rate_limited
            - render_timeout
            - render_incomplete
            - navigation_failed
            - blocked_by_target
            - target_error
            - render_crashed
            - internal_error
            - unsupported_option
            - egress_unavailable
            - egress_mismatch
        message:
          type: string
        retriable:
          type: boolean
        request_id:
          type: string
        docs_url:
          type: string
        details:
          type: object
          additionalProperties: {}
      required:
        - code
        - message
        - retriable
        - request_id
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Active sf_live_ API key with endpoint-specific scopes. Keep this
        credential server-side.

````

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