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

# GET /screenshot

> Capture a page, the full page or one element, on any device, in light or dark mode, as JPEG, PNG, WebP or PDF. 1 credit.

Captures a page and returns a hosted image URL.

**1 credit**, whatever the options. Failed requests are never charged.

> [card] [Guide: Screenshots](https://docs.prefetch.io/web-data/screenshot.md)
>
> Devices, element captures, formats and examples.


## OpenAPI

````yaml GET /screenshot
openapi: 3.1.0
info:
  title: Prefetch API
  description: >-
    Extract brand identity, company data, screenshots, IAB classifications, and
    clean page content from any URL.
  version: 1.0.0
  contact:
    email: support@prefetch.io
servers:
  - url: https://api.prefetch.io
    description: Production
security:
  - apiKey: []
tags:
  - name: Endpoints
    description: Data extraction endpoints. All require authentication and consume credits.
  - name: Health
    description: Health and readiness probes. No authentication required.
paths:
  /screenshot:
    get:
      tags:
        - Endpoints
      summary: Take a screenshot
      description: >-
        Captures a screenshot of a webpage and returns a public URL to the image
        stored in cloud storage. **Credit cost: 1.**
      operationId: takeScreenshot
      parameters:
        - $ref: '#/components/parameters/url'
        - $ref: '#/components/parameters/screenshotWidth'
        - $ref: '#/components/parameters/screenshotHeight'
        - $ref: '#/components/parameters/screenshotFormat'
        - $ref: '#/components/parameters/screenshotFullPage'
        - schema:
            type: string
            enum:
              - iphone_15
              - iphone_15_pro_max
              - iphone_se
              - pixel_7
              - galaxy_s8
              - ipad
              - ipad_mini
              - ipad_pro_11
              - galaxy_tab_s4
              - desktop_retina
            description: >-
              Render as a real device: its viewport, pixel density, touch
              support and user agent, so the page serves its phone or tablet
              layout. The image keeps the device's pixel density (an `iphone_15`
              capture is 1179 px wide). Overrides `width` and `height`.
            example: iphone_15
          required: false
          description: >-
            Render as a real device: its viewport, pixel density, touch support
            and user agent, so the page serves its phone or tablet layout. The
            image keeps the device's pixel density (an `iphone_15` capture is
            1179 px wide). Overrides `width` and `height`.
          name: device
          in: query
        - schema:
            type: boolean
            default: false
          required: false
          description: >-
            Ask the page for its dark theme (`prefers-color-scheme: dark`).
            Pages without one render as usual. Pass "true" to enable.
          name: dark_mode
          in: query
        - schema:
            type: string
            description: >-
              Capture only the first element matching this CSS selector, e.g.
              `#pricing` or `header`. Answers 422 `TARGET_ELEMENT_NOT_FOUND`
              when nothing matches within 10 s. Not available with `format=pdf`.
            example: '#pricing'
          required: false
          description: >-
            Capture only the first element matching this CSS selector, e.g.
            `#pricing` or `header`. Answers 422 `TARGET_ELEMENT_NOT_FOUND` when
            nothing matches within 10 s. Not available with `format=pdf`.
          name: selector
          in: query
        - schema:
            type: integer
            minimum: 0
            maximum: 30000
            default: 0
          required: false
          description: >-
            Milliseconds to wait after the page loads, for content that arrives
            late (0–30000).
          name: wait_for
          in: query
        - schema:
            type: string
            description: >-
              Wait (up to 10 s) for this CSS selector to be visible before
              capturing. Best effort: if it never appears, the page is captured
              as it is, with a warning.
            example: .chart canvas
          required: false
          description: >-
            Wait (up to 10 s) for this CSS selector to be visible before
            capturing. Best effort: if it never appears, the page is captured as
            it is, with a warning.
          name: wait_for_selector
          in: query
        - schema:
            type: boolean
            default: false
          required: false
          description: >-
            Block ad and tracker requests while the page loads, on top of the ad
            and cookie-banner hiding every screenshot gets. Pages load faster
            and cleaner. Pass "true" to enable.
          name: block_ads
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 85
          required: false
          description: 'Image quality for `jpeg` and `webp` (1–100). Default: 85.'
          name: quality
          in: query
      responses:
        '200':
          description: Screenshot result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    $ref: '#/components/schemas/ScreenshotData'
                  meta:
                    $ref: '#/components/schemas/Meta'
                required:
                  - success
                  - data
                  - meta
              example:
                success: true
                data:
                  url: https://stripe.com
                  screenshot_url: https://assets.prefetch.io/screenshots/stripe-1440x900.jpg
                  viewport:
                    width: 1440
                    height: 900
                  format: jpeg
                  full_page: false
                  captured_at: '2026-05-14T10:00:00.000Z'
                meta:
                  requestId: c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f
                  durationMs: 2540
        '400':
          description: Invalid URL or parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Revoked key, expired key, credit limit, or blocklisted URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: URL hostname could not be resolved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily busy — retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: Request timed out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    url:
      name: url
      in: query
      required: true
      description: >-
        The website URL to process. `https://` is prepended automatically if no
        protocol is provided.
      schema:
        type: string
        example: https://stripe.com
    screenshotWidth:
      name: width
      in: query
      required: false
      description: 'Viewport width in pixels. Range: 320–2560. Default: 1440.'
      schema:
        type: integer
        minimum: 320
        maximum: 2560
        default: 1440
    screenshotHeight:
      name: height
      in: query
      required: false
      description: 'Viewport height in pixels. Range: 240–5000. Default: 900.'
      schema:
        type: integer
        minimum: 240
        maximum: 5000
        default: 900
    screenshotFormat:
      name: format
      in: query
      required: false
      description: >-
        Output format: `jpeg`, `png`, `webp`, or `pdf` (the whole page as a PDF
        document). Default: `jpeg`.
      schema:
        type: string
        enum:
          - jpeg
          - png
          - webp
          - pdf
        default: jpeg
    screenshotFullPage:
      name: full_page
      in: query
      required: false
      description: 'Capture full scrollable page height. Default: `false`.'
      schema:
        type: boolean
        default: false
  schemas:
    ScreenshotData:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: The URL that was screenshotted.
          example: https://stripe.com
        screenshot_url:
          type: string
          format: uri
          description: Public URL to the screenshot stored in cloud storage.
          example: https://assets.prefetch.io/screenshots/stripe-1440x900.jpg
        viewport:
          type: object
          properties:
            width:
              type: integer
              example: 1440
            height:
              type: integer
              example: 900
          required:
            - width
            - height
        format:
          type: string
          enum:
            - jpeg
            - png
            - webp
            - pdf
          description: Format of the capture.
          example: jpeg
        full_page:
          type: boolean
          description: Whether the full scrollable height was captured.
          example: false
        captured_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp of when the screenshot was taken.
          example: '2026-03-19T14:22:05.000Z'
        device:
          type: string
          nullable: true
          description: >-
            The `device` preset the page was rendered as; null for a plain
            viewport.
          example: iphone_15
        device_scale_factor:
          type: number
          nullable: true
          description: >-
            Pixels per CSS pixel in the image: 1 for a plain viewport, the
            device's own density for a preset.
          example: 3
        dark_mode:
          type: boolean
          nullable: true
          description: Whether the page was asked for its dark theme.
        selector:
          type: string
          nullable: true
          description: The element captured, when `selector` was set.
        warnings:
          type: array
          items:
            type: string
          description: Non-fatal notes, e.g. a `wait_for_selector` that never appeared.
      required:
        - url
        - screenshot_url
        - viewport
        - format
        - full_page
        - captured_at
    Meta:
      type: object
      properties:
        requestId:
          type: string
          format: uuid
          description: Unique identifier for this request.
          example: a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d
        durationMs:
          type: integer
          nullable: true
          description: Time taken to process the request in milliseconds.
          example: 1842
      required:
        - requestId
        - durationMs
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Always false. Absent, like `meta`, on authentication and rate-limit
            errors, which are answered before a request is processed.
        error:
          type: string
          description: >-
            Human-readable error message. The wording can change: branch on
            `error_code`.
          example: Credit limit exceeded
        error_code:
          type: string
          enum:
            - INVALID_REQUEST
            - PAYLOAD_TOO_LARGE
            - NOT_FOUND
            - CONFLICT
            - UNAUTHORIZED
            - FORBIDDEN
            - CREDITS_EXHAUSTED
            - RATE_LIMITED
            - CONCURRENCY_LIMITED
            - URL_BLOCKED
            - URL_NOT_PERMITTED
            - DNS_RESOLUTION_FAILED
            - TARGET_BLOCKED
            - TARGET_CONNECTION_FAILED
            - TARGET_TIMEOUT
            - TARGET_SSL_ERROR
            - TARGET_SERVER_ERROR
            - TARGET_CLIENT_ERROR
            - TARGET_NOT_A_PAGE
            - NO_LINKS_FOUND
            - TARGET_UNLOADABLE
            - RESEARCH_INCONCLUSIVE
            - TIMEOUT
            - SERVICE_BUSY
            - SERVICE_UNAVAILABLE
            - INTERNAL_ERROR
          description: >-
            What went wrong, for machines. Stable: a code keeps its meaning once
            published. See [Error handling](/concepts/errors).
          example: CREDITS_EXHAUSTED
        retryable:
          type: boolean
          description: >-
            Whether the same request can succeed if sent again after a short
            wait (honour `Retry-After` when present). False for problems with
            the request or the target.
          example: false
        retryAfterSeconds:
          type: integer
          description: 'On `RATE_LIMITED`: seconds until a request will be accepted.'
        limit:
          type: integer
          description: >-
            On `CONCURRENCY_LIMITED`: how many requests this key may have in
            flight.
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - error
        - error_code
        - retryable
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your Prefetch API key. Obtain one from the dashboard.

````

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