> ## 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.

# Scrape Screenshot

> Capture a screenshot of a website.

<Badge color="orange">5 Credits</Badge>


## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/context.dev/openapi.documented.yml 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: []
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: viewport
          in: query
          required: false
          style: deepObject
          explode: true
          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.
        - $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
        '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
        '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
        '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
      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: Ruby
          source: |-
            require "context_dev"

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

            response = context_dev.web.screenshot

            puts(response)
components:
  parameters:
    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:
    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).
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````