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

# Create screenshot async

> Queue the creation of a screenshot and call the webhook with the result.



## OpenAPI

````yaml POST /v1/screenshot/async
openapi: 3.0.0
info:
  title: Doczilla
  description: ''
  version: '1.0'
  contact: {}
servers:
  - url: https://api.doczilla.app
    description: Production
security: []
tags: []
paths:
  /v1/screenshot/async:
    post:
      tags:
        - Screenshot
      description: Queue the creation of a screenshot and call the webhook with the result.
      operationId: screenshot.async
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsyncScreenshot'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncJob'
        '400':
          description: Validations failed!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
        '402':
          description: Reached subscription limit!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionLimitReachedResponse'
        '403':
          description: Token has no active subscription!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '413':
          description: Request body is too large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayloadTooLargeResponse'
        '429':
          description: Too Many Requests!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - bearer: []
components:
  schemas:
    AsyncScreenshot:
      type: object
      properties:
        page:
          description: >-
            Page options, either provide the `url`, `html` or `htmlTemplate`
            option.
          allOf:
            - $ref: '#/components/schemas/PageOptions'
        screenshot:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ScreenshotOptions'
        storage:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/StorageOptions'
        webhook:
          description: Webhook to call when screenshot is generated.
          allOf:
            - $ref: '#/components/schemas/WebhookOptions'
      required:
        - page
        - webhook
    AsyncJob:
      type: object
      properties:
        id:
          type: string
          example: 5KqYNUjbxRJ-rKbIeGsXo
          description: Id of the queued job.
        status:
          type: string
          example: PENDING
          description: Status of the job.
          enum:
            - PENDING
            - RUNNING
            - FAILED
            - COMPLETED
      required:
        - id
        - status
    BadRequestResponse:
      type: object
      properties:
        message:
          type: string
          example: Validations failed!
        code:
          type: string
          example: api.validation
        fields:
          type: object
          additionalProperties:
            type: string
          example:
            page.url: must be a URL address
      required:
        - message
        - code
        - fields
    UnauthorizedResponse:
      type: object
      properties:
        message:
          type: string
          example: Unauthorized
      required:
        - message
    SubscriptionLimitReachedResponse:
      type: object
      properties:
        message:
          type: string
          example: Reached subscription limit!
      required:
        - message
    ForbiddenResponse:
      type: object
      properties:
        message:
          type: string
          example: Token has no active subscription!
      required:
        - message
    PayloadTooLargeResponse:
      type: object
      properties:
        message:
          type: string
          example: Request body is too large
      required:
        - message
    TooManyRequestsResponse:
      type: object
      properties:
        message:
          type: string
          example: Too Many Requests!
      required:
        - message
    InternalServerErrorResponse:
      type: object
      properties:
        message:
          type: string
          example: Internal server error
      required:
        - message
    PageOptions:
      type: object
      properties:
        url:
          type: string
          description: URL to go to. Should include the scheme, e.g. `https://`
          nullable: true
        html:
          type: string
          description: HTML to render. Needs to be base64 encoded!
          nullable: true
        htmlTemplate:
          type: string
          description: >-
            HTML template to render, uses
            [Handlebars](https://handlebarsjs.com/) to render your HTML together
            with the provided `templateData`. Needs to be base64 encoded!
          nullable: true
        templateData:
          type: object
          description: Template data, only used in combination with `page.htmlTemplate`.
          nullable: true
        waitUntil:
          type: string
          example: auto
          description: >-
            When to consider waiting succeeds.

            - `auto` our smart waiting option that can handle 90% of the cases.

            - `load` waits for the 'load' event.

            - `domcontentloaded` waits for the 'DOMContentLoaded' event.

            - `networkidle0` waits till there are no more than 0 network
            connections for at least `500` ms.

            - `networkidle2` waits till there are no more than 2 network
            connections for at least `500` ms. 
          enum:
            - auto
            - load
            - domcontentloaded
            - networkidle0
            - networkidle2
          default: auto
        waitForMilliseconds:
          type: number
          description: >-
            Wait for a certain amount of milliseconds before the request
            continues.
          minimum: 0
          maximum: 5000
          nullable: true
        waitForSelector:
          description: >-
            Wait for the
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
            to appear in page. If the
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
            doesn't appear after the `timeout` milliseconds of waiting, the
            request will continue.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForSelector'
        waitForFunction:
          description: >-
            Wait for the `pageFunction` to execute in the page. If the
            `pageFunction` doesn't execute successfully after the `timeout`
            milliseconds of waiting, the request will continue.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForFunction'
        headers:
          type: object
          example:
            x-foo: bar
          description: >-
            An object containing additional HTTP headers to be sent with every
            request. All header values must be strings.
          nullable: true
        adblock:
          type: boolean
          example: true
          description: Use our build-in adblocker.
          default: true
        javascript:
          type: boolean
          example: true
          description: Whether or not to enable JavaScript on the page.
          default: true
        cookies:
          description: >-
            Cookies added to the page, Also accepted as string inside
            `headers.cookie`.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/PageCookie'
        authentication:
          description: Provide credentials for `HTTP authentication`.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageAuthentication'
        colorScheme:
          type: string
          description: Color-scheme to set on the page.
          maxLength: 20
          nullable: true
        mediaType:
          type: string
          description: Changes the CSS media type of the page.
          enum:
            - screen
            - print
          nullable: true
        timezone:
          type: string
          description: >-
            Changes the timezone of the page. See [ICU’s
            metaZones.txt](https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt)
            for a list of supported timezone IDs.
          nullable: true
    ScreenshotOptions:
      type: object
      properties:
        type:
          type: string
          example: png
          enum:
            - png
            - jpeg
            - webp
          default: png
          nullable: true
        device:
          type: string
          example: Macbook Pro 16
          description: >-
            Device preset to use, will not be set when `viewport` option is
            provided!
          nullable: true
          enum:
            - Blackberry PlayBook
            - Blackberry PlayBook landscape
            - BlackBerry Z30
            - BlackBerry Z30 landscape
            - Galaxy Note 3
            - Galaxy Note 3 landscape
            - Galaxy Note II
            - Galaxy Note II landscape
            - Galaxy S III
            - Galaxy S III landscape
            - Galaxy S5
            - Galaxy S5 landscape
            - Galaxy S8
            - Galaxy S8 landscape
            - Galaxy S9+
            - Galaxy S9+ landscape
            - Galaxy Tab S4
            - Galaxy Tab S4 landscape
            - iPad
            - iPad landscape
            - iPad (gen 6)
            - iPad (gen 6) landscape
            - iPad (gen 7)
            - iPad (gen 7) landscape
            - iPad Mini
            - iPad Mini landscape
            - iPad Pro
            - iPad Pro landscape
            - iPad Pro 11
            - iPad Pro 11 landscape
            - iPhone 4
            - iPhone 4 landscape
            - iPhone 5
            - iPhone 5 landscape
            - iPhone 6
            - iPhone 6 landscape
            - iPhone 6 Plus
            - iPhone 6 Plus landscape
            - iPhone 7
            - iPhone 7 landscape
            - iPhone 7 Plus
            - iPhone 7 Plus landscape
            - iPhone 8
            - iPhone 8 landscape
            - iPhone 8 Plus
            - iPhone 8 Plus landscape
            - iPhone SE
            - iPhone SE landscape
            - iPhone X
            - iPhone X landscape
            - iPhone XR
            - iPhone XR landscape
            - iPhone 11
            - iPhone 11 landscape
            - iPhone 11 Pro
            - iPhone 11 Pro landscape
            - iPhone 11 Pro Max
            - iPhone 11 Pro Max landscape
            - iPhone 12
            - iPhone 12 landscape
            - iPhone 12 Pro
            - iPhone 12 Pro landscape
            - iPhone 12 Pro Max
            - iPhone 12 Pro Max landscape
            - iPhone 12 Mini
            - iPhone 12 Mini landscape
            - iPhone 13
            - iPhone 13 landscape
            - iPhone 13 Pro
            - iPhone 13 Pro landscape
            - iPhone 13 Pro Max
            - iPhone 13 Pro Max landscape
            - iPhone 13 Mini
            - iPhone 13 Mini landscape
            - iPhone 14
            - iPhone 14 landscape
            - iPhone 14 Plus
            - iPhone 14 Plus landscape
            - iPhone 14 Pro
            - iPhone 14 Pro landscape
            - iPhone 14 Pro Max
            - iPhone 14 Pro Max landscape
            - iPhone 15
            - iPhone 15 landscape
            - iPhone 15 Plus
            - iPhone 15 Plus landscape
            - iPhone 15 Pro
            - iPhone 15 Pro landscape
            - iPhone 15 Pro Max
            - iPhone 15 Pro Max landscape
            - JioPhone 2
            - JioPhone 2 landscape
            - Kindle Fire HDX
            - Kindle Fire HDX landscape
            - LG Optimus L70
            - LG Optimus L70 landscape
            - Microsoft Lumia 550
            - Microsoft Lumia 950
            - Microsoft Lumia 950 landscape
            - Nexus 10
            - Nexus 10 landscape
            - Nexus 4
            - Nexus 4 landscape
            - Nexus 5
            - Nexus 5 landscape
            - Nexus 5X
            - Nexus 5X landscape
            - Nexus 6
            - Nexus 6 landscape
            - Nexus 6P
            - Nexus 6P landscape
            - Nexus 7
            - Nexus 7 landscape
            - Nokia Lumia 520
            - Nokia Lumia 520 landscape
            - Nokia N9
            - Nokia N9 landscape
            - Pixel 2
            - Pixel 2 landscape
            - Pixel 2 XL
            - Pixel 2 XL landscape
            - Pixel 3
            - Pixel 3 landscape
            - Pixel 4
            - Pixel 4 landscape
            - Pixel 4a (5G)
            - Pixel 4a (5G) landscape
            - Pixel 5
            - Pixel 5 landscape
            - Moto G4
            - Moto G4 landscape
            - Macbook Pro 13
            - Macbook Pro 15
            - Macbook Pro 16
            - iMac 21
            - iMac 21 4K
            - iMac 24 4.5K
            - iMac 27
            - iMac 27 5K
          default: Macbook Pro 16
        viewport:
          description: >-
            Define an custom viewport, when defined the `device` option will be
            ignored!
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ScreenshotViewport'
        fullPage:
          type: boolean
          example: false
          description: When `true`, takes a screenshot of the full page.
          default: false
        fromSurface:
          type: boolean
          example: true
          description: Capture the screenshot from the surface, rather than the view.
          default: true
        omitBackground:
          type: boolean
          example: false
          description: >-
            Hides default white background and allows capturing screenshots with
            transparency.
          default: false
        optimizeForSpeed:
          type: boolean
          example: true
          default: true
        quality:
          type: number
          description: Quality of the image, between 0-100. Not applicable to `png` images.
          nullable: true
          minimum: 0
          maximum: 100
        captureBeyondViewport:
          type: boolean
          example: false
          description: >-
            Capture the screenshot beyond the viewport. `false` if there is no
            `clip`. `true` otherwise.
          default: false
        clip:
          description: Specifies the region of the page to clip.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ScreenshotClip'
        element:
          type: string
          description: >-
            It captures the DOM element matching the given CSS
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors).
            This will overwrite the `clip` property and set `fullPage` to
            `false`. Will wait for the element to become visible for a maximum
            of 15 seconds.
          nullable: true
        overlay:
          description: >-
            Add an overlay to the image. Cannot be used together with the
            `fullPage` option!
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ScreenshotOverlay'
    StorageOptions:
      type: object
      properties:
        preSignedUrl:
          type: string
          description: >-
            Pre-signed url to upload the generated pdf/screenshot to. Should
            include the scheme, e.g. `https://`
      required:
        - preSignedUrl
    WebhookOptions:
      type: object
      properties:
        receiveType:
          type: string
          example: URL
          description: >-
            The way this webhook wants to receive the result.

            - When `URL` is used an temporary URL will be provided to download
            the file (the file will be automatically deleted after 1 hour).

            - When `base64` is used make sure your webhook can receive the size
            of the file!
          enum:
            - base64
            - URL
          default: URL
        url:
          type: string
          description: The webhook's URL. Should include the scheme, e.g. `https://`
        method:
          type: string
          example: POST
          description: Method to use when calling the webhook.
          enum:
            - POST
            - PUT
          default: POST
        headers:
          type: object
          description: >-
            An object containing additional HTTP headers to be sent with the
            webhook. All header values must be strings.
          nullable: true
        metadata:
          type: object
          description: >-
            Additional metadata that will be inside the request when the webhook
            is called. All values must be strings. Max 1kB.
          nullable: true
      required:
        - url
    PageWaitForSelector:
      type: object
      properties:
        selector:
          type: string
          description: >-
            The
            [selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors)
            of an element to wait for.
          minLength: 1
          maxLength: 1024
        options:
          description: Options for configuring waiting behavior.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForSelectorOptions'
      required:
        - selector
    PageWaitForFunction:
      type: object
      properties:
        pageFunction:
          type: string
          example: window.innerWidth < 100
          description: >-
            Function to be evaluated in browser context until it returns a
            truthy value.
          minLength: 1
          maxLength: 1024
        options:
          description: Options for configuring waiting behavior.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PageWaitForFunctionOptions'
      required:
        - pageFunction
    PageCookie:
      type: object
      properties:
        name:
          type: string
          description: Cookie name.
          minLength: 1
          maxLength: 1024
        value:
          type: string
          description: Cookie value.
          minLength: 1
          maxLength: 4096
        domain:
          type: string
          description: Cookie domain.
          minLength: 1
          maxLength: 512
        url:
          type: string
          description: >-
            The request-URI to associate with the setting of the cookie. This
            value can affect the default domain, path, source port, and source
            scheme values of the created cookie. Should include the scheme, e.g.
            `https://`
          nullable: true
        path:
          type: string
          description: Cookie path.
          minLength: 1
          maxLength: 512
          nullable: true
        secure:
          type: boolean
          description: '`true` if cookie is secure.'
          nullable: true
        httpOnly:
          type: boolean
          description: '`true` if cookie is http-only.'
          nullable: true
        sameSite:
          type: string
          description: Cookie SameSite type.
          enum:
            - Strict
            - Lax
            - None
          nullable: true
        expires:
          type: number
          description: >-
            Cookie expiration date (UTC time in seconds, counted from January 1,
            1970.), session cookie if not set. 
          nullable: true
      required:
        - name
        - value
        - domain
    PageAuthentication:
      type: object
      properties:
        username:
          type: string
          minLength: 1
          maxLength: 1024
        password:
          type: string
          minLength: 1
          maxLength: 4096
      required:
        - username
        - password
    ScreenshotViewport:
      type: object
      properties:
        width:
          type: number
          description: The page width in CSS pixels.
          minimum: 0
          maximum: 4480
        height:
          type: number
          description: The page height in CSS pixels.
          minimum: 0
          maximum: 2520
        deviceScaleFactor:
          type: number
          example: 1
          description: >-
            Specify device scale factor. See
            [devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio)
            for more info.
          default: 1
          minimum: 1
          maximum: 3
        isMobile:
          type: boolean
          example: false
          description: Whether the `meta viewport` tag is taken into account.
          default: false
        hasTouch:
          type: boolean
          example: false
          description: Specify if the viewport supports touch events.
          default: false
        isLandscape:
          type: boolean
          example: false
          description: Specifies if the viewport is in landscape mode.
          default: false
      required:
        - width
        - height
    ScreenshotClip:
      type: object
      properties:
        scale:
          type: number
          example: 1
          default: 1
          minimum: 0
        width:
          type: number
          description: The width of the element in pixels.
          minimum: 0
          maximum: 4480
        height:
          type: number
          description: The height of the element in pixels.
          minimum: 0
          maximum: 2520
        x:
          type: number
        'y':
          type: number
      required:
        - width
        - height
        - x
        - 'y'
    ScreenshotOverlay:
      type: object
      properties:
        background:
          type: string
          description: >-
            Color to apply as background, can be an an hexadecimal/rgb/rgba
            color code or CSS gradient.
          nullable: true
        filter:
          type: string
          example: none
          description: >-
            Apply [CSS
            Filter](https://developer.mozilla.org/en-US/docs/Web/CSS/filter) to
            background.
          default: none
          nullable: true
        margin:
          type: number
          example: 0.2
          description: Margin to apply.
          default: 0.2
          minimum: 0
          maximum: 1
        browser:
          type: string
          description: Browser to apply.
          enum:
            - light
            - dark
          nullable: true
        screenshotBorderRadius:
          type: number
          example: 0
          description: >-
            The border radius, specified in CSS pixels, is applied to the
            screenshot only when the `device` option is not set.
          default: 0
    PageWaitForSelectorOptions:
      type: object
      properties:
        visible:
          type: boolean
          example: false
          description: >-
            Wait for the selected element to be present in DOM and to be
            visibleAn element is considered to be visible if all of the
            following is true:

            - the element has [computed
            styles](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)

            - the element has a non-empty [bounding client
            rect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)

            - the element's
            [visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility)
            is not `hidden` or `collapse`
          default: false
        hidden:
          type: boolean
          example: false
          description: >-
            Wait for the selected element to not be found in the DOM or to be
            hidden.An element is considered to be hidden if at least one of the
            following is true:

            - the element has no [computed
            styles](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)

            - the element has an empty [bounding client
            rect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)

            - the element's
            [visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility)
            is `hidden` or `collapse`
          default: false
        timeout:
          type: number
          example: 10000
          description: Maximum time to wait in milliseconds.
          minimum: 1
          maximum: 30000
          default: 10000
    PageWaitForFunctionOptions:
      type: object
      properties:
        polling:
          example: raf
          description: >-
            An interval at which the `pageFunction` is executed, defaults to
            `raf`. If `polling` is a number, then it is treated as an interval
            in milliseconds at which the function would be executed. If
            `polling` is a string, then it can be one of the following values:

            - `raf` to constantly execute `pageFunction` in
            `requestAnimationFrame` callback. This is the tightest polling mode
            which is suitable to observe styling changes.

            - `mutation` to execute `pageFunction` on every DOM mutation.
          default: raf
          oneOf:
            - type: string
              enum:
                - raf
                - mutation
            - type: number
        timeout:
          type: number
          example: 10000
          description: Maximum time to wait in milliseconds.
          minimum: 1
          maximum: 30000
          default: 10000
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````