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

# Capture Screenshot

> Capture production-ready website screenshots for previews, audits, brand libraries, and visual QA.

<Badge color="blue">1 Credit</Badge>


## OpenAPI

````yaml GET /web/screenshot
openapi: 3.1.0
info:
  title: Context API
  description: API for retrieving context data from any website
  version: 1.0.0
servers:
  - url: https://api.context.dev/v1
security: []
tags:
  - name: Batch
    description: Scrape many pages or crawl a site asynchronously.
  - name: Monitors
    description: >-
      Monitor pages, sitemaps, and extracted website data for exact or semantic
      changes. Webhook payloads are documented by the
      MonitorsChangeDetectedWebhookPayload and
      MonitorsRunCompletedWebhookPayload schemas.
  - name: WebDBs
    description: Create structured tables from web pages and keep them up to date.
  - name: News
    description: >-
      Search live first-party RSS and free historical news data by company
      identity.
paths:
  /web/screenshot:
    get:
      tags:
        - Web Scraping
      summary: Scrape Screenshot
      description: Capture a screenshot of a website.
      parameters:
        - schema:
            type: string
            minLength: 3
            description: >-
              Domain name to take screenshot of (e.g., 'example.com',
              'google.com'). The domain will be automatically normalized and
              validated. You must provide either 'domain' or 'directUrl', but
              not both.
          required: false
          description: >-
            Domain name to take screenshot of (e.g., 'example.com',
            'google.com'). The domain will be automatically normalized and
            validated. You must provide either 'domain' or 'directUrl', but not
            both.
          name: domain
          in: query
        - schema:
            type: string
            format: uri
            description: >-
              A specific URL to screenshot directly, bypassing domain resolution
              (e.g., 'https://example.com/pricing'). When provided, the
              screenshot is taken of this exact URL. You must provide either
              'domain' or 'directUrl', but not both.
          required: false
          description: >-
            A specific URL to screenshot directly, bypassing domain resolution
            (e.g., 'https://example.com/pricing'). When provided, the screenshot
            is taken of this exact URL. You must provide either 'domain' or
            'directUrl', but not both.
          name: directUrl
          in: query
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
            description: >-
              Optional parameter to determine screenshot type. If 'true', takes
              a full page screenshot capturing all content. If 'false' or not
              provided, takes a viewport screenshot (standard browser view).
          required: false
          description: >-
            Optional parameter to determine screenshot type. If 'true', takes a
            full page screenshot capturing all content. If 'false' or not
            provided, takes a viewport screenshot (standard browser view).
          name: fullScreenshot
          in: query
        - schema:
            type: string
            enum:
              - login
              - signup
              - blog
              - careers
              - pricing
              - terms
              - privacy
              - contact
            description: >-
              Optional parameter to specify which page type to screenshot. If
              provided, the system will scrape the domain's links and use
              heuristics to find the most appropriate URL for the specified page
              type (30 supported languages). If not provided, screenshots the
              main domain landing page. Only applicable when using 'domain', not
              'directUrl'.
          required: false
          description: >-
            Optional parameter to specify which page type to screenshot. If
            provided, the system will scrape the domain's links and use
            heuristics to find the most appropriate URL for the specified page
            type (30 supported languages). If not provided, screenshots the main
            domain landing page. Only applicable when using 'domain', not
            'directUrl'.
          name: page
          in: query
        - schema:
            type:
              - integer
              - 'null'
            minimum: 0
            maximum: 30000
            default: 3000
            description: >-
              Optional browser wait time in milliseconds after initial page load
              before taking the screenshot. Min: 0. Max: 30000 (30 seconds).
              Defaults to 3000 ms when omitted.
          required: false
          description: >-
            Optional browser wait time in milliseconds after initial page load
            before taking the screenshot. Min: 0. Max: 30000 (30 seconds).
            Defaults to 3000 ms when omitted.
          name: waitForMs
          in: query
        - schema:
            type: object
            properties:
              width:
                type: integer
                minimum: 240
                maximum: 7680
                default: 1920
                description: Viewport width in pixels.
              height:
                type: integer
                minimum: 240
                maximum: 4320
                default: 1080
                description: Viewport height in pixels.
            default:
              width: 1920
              height: 1080
            description: >-
              Optional browser viewport dimensions for the screenshot. Defaults
              to 1920x1080.
          required: false
          description: >-
            Optional browser viewport dimensions for the screenshot. Defaults to
            1920x1080.
          name: viewport
          in: query
        - schema:
            type: boolean
            default: false
            description: >-
              Optional parameter to control cookie/consent popup handling. If
              'true', we dismiss cookie banner before capture. If 'false' or not
              provided, captures the page without that step.
          required: false
          description: >-
            Optional parameter to control cookie/consent popup handling. If
            'true', we dismiss cookie banner before capture. If 'false' or not
            provided, captures the page without that step.
          name: handleCookiePopup
          in: query
        - schema:
            type: boolean
            default: false
            description: >-
              Optional parameter for comprehensive popup cleanup. If 'true', the
              browser dismisses detected cookie/consent UI and clears other
              detected obstructive popups and overlays before capture. If
              'false' or not provided, this parameter requests no cleanup;
              handleCookiePopup can still request cookie/consent handling
              independently.
          required: false
          description: >-
            Optional parameter for comprehensive popup cleanup. If 'true', the
            browser dismisses detected cookie/consent UI and clears other
            detected obstructive popups and overlays before capture. If 'false'
            or not provided, this parameter requests no cleanup;
            handleCookiePopup can still request cookie/consent handling
            independently.
          name: clearPopups
          in: query
        - schema:
            type: string
            enum:
              - light
              - dark
            description: >-
              Optional parameter to choose the site's visual theme in the
              screenshot. Use 'light' or 'dark' when the site offers both
              appearances.
          required: false
          description: >-
            Optional parameter to choose the site's visual theme in the
            screenshot. Use 'light' or 'dark' when the site offers both
            appearances.
          name: colorScheme
          in: query
        - schema:
            type:
              - integer
              - 'null'
            minimum: 0
            maximum: 100000
            description: >-
              Optional vertical scroll offset in pixels for capturing a long
              page in viewport-sized chunks. When provided, the full page is
              captured once and the returned image is the viewport-sized slice
              that begins at this Y offset (e.g. request scrollOffset=0, then
              1080, then 2160 to walk a 1920x1080 landing page top to bottom).
              The final slice may be shorter than the viewport height. Takes
              precedence over fullScreenshot. Max: 100000.
          required: false
          description: >-
            Optional vertical scroll offset in pixels for capturing a long page
            in viewport-sized chunks. When provided, the full page is captured
            once and the returned image is the viewport-sized slice that begins
            at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160
            to walk a 1920x1080 landing page top to bottom). The final slice may
            be shorter than the viewport height. Takes precedence over
            fullScreenshot. Max: 100000.
          name: scrollOffset
          in: query
        - schema:
            type:
              - integer
              - 'null'
            minimum: 0
            maximum: 2592000000
            default: 86400000
            description: >-
              Return a cached screenshot if a prior screenshot for the same
              parameters exists and is younger than this many milliseconds.
              Defaults to 1 day (86400000 ms) when omitted. Max is 30 days
              (2592000000 ms). Set to 0 to always capture fresh.
          required: false
          description: >-
            Return a cached screenshot if a prior screenshot for the same
            parameters exists and is younger than this many milliseconds.
            Defaults to 1 day (86400000 ms) when omitted. Max is 30 days
            (2592000000 ms). Set to 0 to always capture fresh.
          name: maxAgeMs
          in: query
        - schema:
            $ref: '#/components/schemas/BrowserCountryCode'
          required: false
          description: >-
            Fetch the target page through a residential proxy in this country
            (ISO 3166-1 alpha-2).
          name: country
          in: query
        - schema:
            $ref: '#/components/schemas/LenientTimeoutMS'
          required: false
          description: >-
            Optional timeout in milliseconds for the request. If the request
            takes longer than this value, it will be aborted with a 408 status
            code. Maximum allowed value is 300000ms (5 minutes).
          name: timeoutMS
          in: query
        - schema:
            type: string
            enum:
              - enabled
              - disabled
            default: disabled
            description: >-
              Set to enabled to bypass shared caches and omit request and
              response content from retained usage logs. Requires zero data
              retention to be enabled for your organization (contact
              support@context.dev), otherwise the request fails with
              ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR:
              true.
          required: false
          description: >-
            Set to enabled to bypass shared caches and omit request and response
            content from retained usage logs. Requires zero data retention to be
            enabled for your organization (contact support@context.dev),
            otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR
            responses include X-Context-ZDR: true.
          name: zdr
          in: query
        - $ref: '#/components/parameters/RequestTags'
      responses:
        '200':
          description: Successful response
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            X-Context-ZDR:
              description: >-
                Present with the value true when zero data retention was
                requested and honored.
              schema:
                type: string
                enum:
                  - 'true'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Status of the response, e.g., 'ok'
                  domain:
                    type: string
                    description: The normalized domain that was processed
                  screenshot:
                    type: string
                    description: >-
                      Public image URL for standard requests, or an in-memory
                      data URL when ZDR is enabled.
                  screenshotType:
                    type: string
                    enum:
                      - viewport
                      - fullPage
                    description: Type of screenshot that was captured
                  width:
                    type: integer
                    description: Width in pixels of the returned screenshot image
                  height:
                    type: integer
                    description: Height in pixels of the returned screenshot image
                  code:
                    type: integer
                    description: HTTP status code
                  cache_metadata:
                    $ref: '#/components/schemas/CacheMetadata'
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                required:
                  - cache_metadata
        '400':
          description: Bad Request
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                      - VALID
                      - NOT_FOUND
                      - FORBIDDEN
                      - USAGE_EXCEEDED
                      - RATE_LIMITED
                      - UNAUTHORIZED
                      - DISABLED
                      - INSUFFICIENT_PERMISSIONS
                      - TIMEOUT_EXCEEDS_MAXIMUM
                      - WEBSITE_ACCESS_ERROR
                      - INPUT_VALIDATION_ERROR
                    description: Error code indicating the type of error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '401':
          description: Unauthorized
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                      - VALID
                      - NOT_FOUND
                      - FORBIDDEN
                      - USAGE_EXCEEDED
                      - RATE_LIMITED
                      - UNAUTHORIZED
                      - DISABLED
                      - INSUFFICIENT_PERMISSIONS
                      - TIMEOUT_EXCEEDS_MAXIMUM
                      - WEBSITE_ACCESS_ERROR
                      - INPUT_VALIDATION_ERROR
                    description: Error code indicating the type of error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: Internal server error
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                    description: Error code indicating internal server error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import ContextDev from 'context.dev';

            const client = new ContextDev({
              apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.web.screenshot();

            console.log(response.width);
        - lang: Python
          source: |-
            import os
            from context.dev import ContextDev

            client = ContextDev(
                api_key=os.environ.get("CONTEXT_DEV_API_KEY"),  # This is the default and can be omitted
            )
            response = client.web.screenshot()
            print(response.width)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/context-dot-dev/context-go-sdk\"\n\t\"github.com/context-dot-dev/context-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := contextdev.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Web.Screenshot(context.TODO(), contextdev.WebScreenshotParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Width)\n}\n"
        - lang: Ruby
          source: |-
            require "context_dev"

            context_dev = ContextDev::Client.new(api_key: "My API Key")

            response = context_dev.web.screenshot

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use ContextDev\Client;

            use ContextDev\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My
            API Key');


            try {
              $response = $client->web->screenshot(
                clearPopups: true,
                colorScheme: 'light',
                country: 'de',
                directURL: 'https://example.com',
                domain: 'xxx',
                fullScreenshot: 'true',
                handleCookiePopup: true,
                maxAgeMs: 0,
                page: 'login',
                scrollOffset: 0,
                tags: ['production', 'team-alpha'],
                timeoutMs: 1,
                viewport: ['height' => 240, 'width' => 240],
                waitForMs: 0,
                zdr: 'enabled',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            context-dev web screenshot \
              --api-key 'My API Key'
components:
  schemas:
    BrowserCountryCode:
      type: string
      enum:
        - ad
        - ae
        - af
        - ag
        - ai
        - al
        - am
        - ao
        - ar
        - at
        - au
        - aw
        - az
        - ba
        - bb
        - bd
        - be
        - bf
        - bg
        - bh
        - bi
        - bj
        - bm
        - bn
        - bo
        - bq
        - br
        - bs
        - bw
        - by
        - bz
        - ca
        - cd
        - cf
        - cg
        - ch
        - ci
        - cl
        - cm
        - cn
        - co
        - cr
        - cv
        - cw
        - cy
        - cz
        - de
        - dj
        - dk
        - dm
        - do
        - dz
        - ec
        - ee
        - eg
        - es
        - et
        - fi
        - fj
        - fr
        - ga
        - gb
        - gd
        - ge
        - gf
        - gg
        - gh
        - gm
        - gn
        - gp
        - gq
        - gr
        - gt
        - gu
        - gw
        - gy
        - hk
        - hn
        - hr
        - ht
        - hu
        - id
        - ie
        - il
        - im
        - in
        - iq
        - ir
        - is
        - it
        - je
        - jm
        - jo
        - jp
        - ke
        - kg
        - kh
        - kn
        - kr
        - kw
        - ky
        - kz
        - la
        - lb
        - lc
        - lk
        - lr
        - ls
        - lt
        - lu
        - lv
        - ly
        - ma
        - mc
        - md
        - me
        - mf
        - mg
        - mk
        - ml
        - mm
        - mn
        - mo
        - mq
        - mr
        - mt
        - mu
        - mv
        - mw
        - mx
        - my
        - mz
        - na
        - nc
        - ne
        - ng
        - ni
        - nl
        - 'no'
        - np
        - nz
        - om
        - pa
        - pe
        - pf
        - pg
        - ph
        - pk
        - pl
        - pr
        - ps
        - pt
        - py
        - qa
        - re
        - ro
        - rs
        - ru
        - rw
        - sa
        - sc
        - sd
        - se
        - sg
        - si
        - sk
        - sl
        - sm
        - sn
        - so
        - sr
        - ss
        - st
        - sv
        - sx
        - sy
        - sz
        - tc
        - td
        - tg
        - th
        - tj
        - tl
        - tm
        - tn
        - tr
        - tt
        - tw
        - tz
        - ua
        - ug
        - us
        - uy
        - uz
        - vc
        - ve
        - vg
        - vi
        - vn
        - ye
        - yt
        - za
        - zm
        - zw
      example: de
      description: >-
        Fetch the target page through a residential proxy in this country (ISO
        3166-1 alpha-2).
    LenientTimeoutMS:
      type: integer
      minimum: 1
      maximum: 300000
      description: >-
        Optional timeout in milliseconds for the request. If the request takes
        longer than this value, it will be aborted with a 408 status code.
        Maximum allowed value is 300000ms (5 minutes).
    CacheMetadata:
      type: object
      properties:
        status:
          type: string
          enum:
            - hit
            - miss
            - zdr
          description: >-
            Whether the response was served from cache, required fresh work, or
            honored zero-data-retention cache bypass.
        age_ms:
          type: integer
          minimum: 0
          description: >-
            Age of the cached data in milliseconds. Zero for miss and zdr
            responses.
      required:
        - status
        - age_ms
      additionalProperties: false
      description: >-
        Cache outcome for this response. Composite responses are hits only when
        every cache-controlled fetch contributing to the output was a hit;
        age_ms is the oldest contributing hit.
    KeyMetadata:
      type: object
      properties:
        credits_consumed:
          type: integer
          description: The number of credits consumed by this request.
        credits_remaining:
          type: integer
          description: >-
            The number of credits remaining for your organization after this
            request.
      required:
        - credits_consumed
        - credits_remaining
      description: >-
        Metadata about the API key used for the request. Included in every
        response whenever a valid API key is provided, even when the response
        status is not 200.
    RequestTags:
      type: array
      items:
        type: string
        minLength: 1
        maxLength: 50
      maxItems: 20
      description: >-
        Optional tags for tracking usage. Up to 20 tags, each 1 to 50
        characters.
      example:
        - production
        - team-alpha
  parameters:
    RequestTags:
      name: tags
      in: query
      required: false
      style: form
      explode: false
      schema:
        $ref: '#/components/schemas/RequestTags'
      description: >-
        Optional comma-separated caller-defined tags for tracking this request.
        Tags are recorded on the request's usage log and can be used to filter
        usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.
      example: production,team-alpha
  headers:
    RateLimitLimit:
      description: >-
        Maximum requests allowed in the current fixed one-minute window.
        Returned when the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
        minimum: 1
    RateLimitRemaining:
      description: >-
        Requests remaining in the current fixed one-minute window. Returned when
        the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
        minimum: 0
    RateLimitReset:
      description: >-
        Unix timestamp in seconds when the current rate-limit window resets.
        Returned when the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
  responses:
    RateLimited:
      description: Rate limit exceeded
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
        Retry-After:
          description: Seconds until the per-minute rate limit window resets
          schema:
            type: integer
            minimum: 1
            maximum: 60
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error message
              error_code:
                type: string
                enum:
                  - RATE_LIMITED
                description: Error code indicating the rate limit was exceeded
              key_metadata:
                $ref: '#/components/schemas/KeyMetadata'
            required:
              - message
              - error_code
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <API_KEY>`, where
        `<API_KEY>` is your api key.

````