> ## 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="orange">5 Credits</Badge>


## OpenAPI

````yaml GET /web/screenshot
openapi: 3.0.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: Monitors
    description: >-
      Monitor pages, sitemaps, and extracted website data for exact or semantic
      changes. The change.detected webhook payload is documented by the
      MonitorsChangeDetectedWebhookPayload schema.
paths:
  /web/screenshot:
    get:
      tags:
        - Web Scraping
      summary: Scrape Screenshot
      description: Capture a screenshot of a website.
      parameters:
        - name: domain
          in: query
          required: false
          schema:
            type: string
          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: directUrl
          in: query
          required: false
          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.
        - name: fullScreenshot
          in: query
          required: false
          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).
        - name: handleCookiePopup
          in: query
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
            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.
        - name: colorScheme
          in: query
          required: false
          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.
        - name: viewport
          in: query
          required: false
          style: form
          explode: false
          schema:
            type: object
            additionalProperties: false
            default:
              width: 1920
              height: 1080
            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.
          description: >-
            Optional browser viewport dimensions for the screenshot. Defaults to
            1920x1080.
        - name: maxAgeMs
          in: query
          required: false
          schema:
            type: integer
            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.
        - name: page
          in: query
          required: false
          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'.
        - name: waitForMs
          in: query
          required: false
          schema:
            type: integer
            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.
        - name: scrollOffset
          in: query
          required: false
          schema:
            type: integer
            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.
        - $ref: '#/components/parameters/BrowserCountry'
        - $ref: '#/components/parameters/TimeoutMS'
      responses:
        '200':
          description: Successful response
          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 URL of the uploaded screenshot image
                  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
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '400':
          description: Bad Request
          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
          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
          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(
                colorScheme: 'light',
                country: 'de',
                directURL: 'https://example.com',
                domain: 'domain',
                fullScreenshot: 'true',
                handleCookiePopup: 'true',
                maxAgeMs: 0,
                page: 'login',
                scrollOffset: 0,
                timeoutMs: 1000,
                viewport: ['height' => 240, 'width' => 240],
                waitForMs: 0,
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            context-dev web screenshot \
              --api-key 'My API Key'
components:
  parameters:
    BrowserCountry:
      name: country
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/BrowserCountryCode'
      description: >-
        Two-letter ISO 3166-1 alpha-2 country code for the website request
        location. When provided, Context.dev fetches the target page from that
        country.
    TimeoutMS:
      name: timeoutMS
      in: query
      required: false
      schema:
        $ref: '#/components/schemas/TimeoutMS'
      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).
  schemas:
    KeyMetadata:
      type: object
      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.
      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
    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: >-
        Two-letter ISO 3166-1 alpha-2 country code identifying a supported
        Context.dev residential proxy exit location. Must be one of
        Context.dev's supported countries. When provided, Context.dev fetches
        the target page from that country.
    TimeoutMS:
      type: integer
      minimum: 1000
      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).
  responses:
    RateLimited:
      description: Rate limit exceeded
      headers:
        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

````