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

# Screenshot



## OpenAPI

````yaml POST /screenshot
openapi: 3.1.0
info:
  title: Geekflare
  description: Official OpenAPI specification for all Geekflare endpoints.
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://api.geekflare.com
security:
  - x-api-key: []
paths:
  /screenshot:
    post:
      tags:
        - api-tool
      summary: Capture a full-page screenshot of a website
      operationId: screenshot
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScreenshotDto'
      responses:
        '200':
          description: Successfully captured screenshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScreenshotResponseDto'
        '400':
          description: Invalid URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 400
                message: INVALID_URL
                details: The URL must be a valid HTTP or HTTPS URL.
        '422':
          description: Unable to connect to the target website.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 422
                message: UNABLE_TO_CONNECT
                details: >-
                  The destination server could not be resolved, refused the
                  connection, timed out, or is redirecting indefinitely.
        '500':
          description: Screenshot generation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 500
                message: SCREENSHOT_FAILED
                details: Failed to process the request during browser automation.
components:
  schemas:
    ScreenshotDto:
      type: object
      properties:
        url:
          type: string
          description: Target URL
          example: https://example.com
        device:
          type: string
          description: Device type to emulate. Defaults to desktop.
          example: desktop
          enum:
            - desktop
            - mobile
          default: desktop
        proxyCountry:
          type: string
          description: Proxy country code to route the request
          example: us
        type:
          type: string
          description: File type of screenshot. Defaults to png.
          example: png
          enum:
            - png
            - jpeg
            - webp
          default: png
        fullPage:
          type: boolean
          description: Take full-page screenshot
          example: true
          default: false
        blockAds:
          type: boolean
          description: Block ads on the page
          example: true
          default: true
        hideCookie:
          type: boolean
          description: Hide cookie popups
          example: true
          default: true
        skipCaptcha:
          type: boolean
          description: Try to bypass captcha
          example: true
          default: true
        addTimestamp:
          type: boolean
          description: Add timestamp watermark
          example: true
          default: false
        pageHeight:
          type: number
          description: Height of the page (for partial screenshot)
          example: 2000
          minimum: 100
          maximum: 5000
        viewportWidth:
          type: number
          description: Width of the viewport
          example: 1280
          minimum: 320
          maximum: 3840
        viewportHeight:
          type: number
          description: Height of the viewport
          example: 800
          minimum: 240
          maximum: 2160
        theme:
          type: string
          description: Theme to use for rendering
          example: auto
          enum:
            - light
            - dark
            - auto
          default: auto
        removeBackground:
          type: boolean
          description: Remove background from screenshot
          example: false
        highlightLinks:
          type: boolean
          description: Highlight links on the page
          example: false
        delay:
          type: number
          description: Delay before taking screenshot (in seconds)
          example: 2
          minimum: 0
          maximum: 10
        disableAnimations:
          type: boolean
          description: Disable animations on the page
          example: false
        quality:
          type: number
          description: Image quality (for JPEG/WEBP)
          example: 90
          minimum: 10
          maximum: 100
        scaleFactor:
          type: number
          description: Device scale factor
          example: 1
          minimum: 0.1
          maximum: 5
        captureBeyondViewport:
          type: boolean
          description: Capture beyond viewport if possible
          example: true
        selector:
          type: string
          description: >-
            CSS selector to capture only a specific element on the page.
            Supports class (.), ID (#), and attribute selectors.
          example: .hero-section
        fallbackToFullPage:
          type: boolean
          description: >-
            If true and the selector is not found, falls back to a full-page
            screenshot instead of returning an error. Default: false.
          example: false
          default: false
        inline:
          type: boolean
          description: >-
            If true, includes a Base64-encoded image and data URI in the
            response. Useful for AI agents and LLMs that cannot fetch URLs.
            Default: false.
          example: false
          default: false
      required:
        - url
    ScreenshotResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          description: Metadata about the request
          allOf:
            - $ref: '#/components/schemas/ScreenshotMetaDto'
        data:
          type: string
          description: URL of the captured screenshot
          example: https://geekflare.com/tests/screenshot/kbi6d206g87ituahb7icwtpr.png
        inline:
          description: >-
            Inline Base64 image data. Present only when the request included
            `inline: true`.
          allOf:
            - $ref: '#/components/schemas/ScreenshotInlineDto'
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    BaseErrorResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1778737930991
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        message:
          type: string
          description: Error message
          example: Invalid URL provided
        details:
          type: string
          description: Detailed error information
          example: The URL must be a valid HTTP or HTTPS URL
      required:
        - timestamp
        - apiStatus
        - apiCode
        - message
    ScreenshotMetaDto:
      type: object
      properties:
        url:
          type: string
          description: The target URL that was captured
          example: https://example.com
        type:
          type: string
          description: File type of screenshot
          example: png
        device:
          type: string
          description: Device type used
          example: desktop
        fullPage:
          type: boolean
          description: Whether full-page screenshot was taken
          example: false
        blockAds:
          type: boolean
          description: Whether ads were blocked
          example: false
        hideCookie:
          type: boolean
          description: Whether cookie popups were hidden
          example: false
        skipCaptcha:
          type: boolean
          description: Whether captcha was bypassed
          example: false
        addTimestamp:
          type: boolean
          description: Whether timestamp watermark was added
          example: false
        proxyCountry:
          type: string
          description: Proxy country used, if any
        pageHeight:
          type: number
          description: Height of the page
          example: 2000
        viewportWidth:
          type: number
          description: Width of the viewport
          example: 1280
        viewportHeight:
          type: number
          description: Height of the viewport
          example: 800
        theme:
          type: string
          description: Theme used
          example: auto
        removeBackground:
          type: boolean
          description: Whether background was removed
          example: false
        highlightLinks:
          type: boolean
          description: Whether links were highlighted
          example: false
        delay:
          type: number
          description: Delay before screenshot
          example: 2
        disableAnimations:
          type: boolean
          description: Whether animations were disabled
          example: false
        quality:
          type: number
          description: Image quality (JPEG/WEBP)
          example: 90
        scaleFactor:
          type: number
          description: Device scale factor
          example: 1
        captureBeyondViewport:
          type: boolean
          description: Capture beyond viewport
          example: true
        selector:
          type: string
          description: CSS selector that was targeted, if provided
          example: .hero-section
        fallbackToFullPage:
          type: boolean
          description: Whether fallback to full-page was enabled
          example: false
        inline:
          type: boolean
          description: Whether inline base64 output was requested
          example: false
        test:
          description: Test details
          allOf:
            - $ref: '#/components/schemas/TestMetaDto'
      required:
        - url
        - type
        - device
        - fullPage
        - blockAds
        - hideCookie
        - skipCaptcha
        - addTimestamp
        - test
    ScreenshotInlineDto:
      type: object
      properties:
        base64:
          type: string
          description: Raw Base64-encoded image string
          example: iVBORw0KGgoAAAANSUhEUgAA...
        dataUri:
          type: string
          description: Data URI — ready to embed in an <img> tag or pass directly to an LLM
          example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
      required:
        - base64
        - dataUri
    TestMetaDto:
      type: object
      properties:
        id:
          type: string
          description: Unique test identifier
          example: mxqx9v9y0742lap6altwdteqd28t23nq
      required:
        - id
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key required for all endpoints

````