---
title: "Monitor for a condition"
method: POST
path: "/v1/sessions/{sessionId}/windows/{windowId}/monitor"
tags: ["windows"]
---

# Monitor for a condition

`POST /v1/sessions/{sessionId}/windows/{windowId}/monitor`

## Path parameters

- `sessionId` string, required
- `windowId` string, required

## Headers

- `Authorization` string, required

## Request body

- object
  - `clientRequestId` string
  - `condition` string, required — A natural language description of the condition to monitor for in the browser window.
  - `configuration` TypeMonitorConfig
    - `includeVisualAnalysis` 'auto' | 'disabled' | 'enabled' — If set to 'enabled', Airtop AI will also analyze the web page visually when executing the condition check. If set to 'disabled', no visual analysis will be conducted.
    - `interval` TypeIntervalMonitorConfig
      - `intervalSeconds` integer — The interval in seconds between condition checks. Defaults to 5 seconds.
      - `timeoutSeconds` integer — The timeout in seconds after which the monitor will stop checking the condition. Defaults to 30 seconds.
  - `costThresholdCredits` integer — A credit threshold that, once exceeded, will cause the operation to be cancelled. Note that this is *not* a hard limit, but a threshold that is checked periodically during the course of fulfilling the request. A default threshold is used if not specified, but you can use this option to increase or decrease as needed. Set to 0 to disable this feature entirely (not recommended).
  - `timeThresholdSeconds` integer — A time threshold in seconds that, once exceeded, will cause the operation to be cancelled. Note that this is *not* a hard limit, but a threshold that is checked periodically during the course of fulfilling the request. A default threshold is used if not specified, but you can use this option to increase or decrease as needed. Set to 0 to disable this feature entirely (not recommended). This setting does not extend the maximum session duration provided at the time of session creation.

## Response `201`

Created

- TypeAiPromptResponse
  - `data` TypeAiResponseEnvelope, required
    - `modelResponse` string, required
  - `errors` TypeIssue[]
    - `code` string — Issue code.
    - `details` object — Any associated details.
    - `message` string, required — Message describing the issue.
    - `reason` string — Underlying reason for the issue.
  - `meta` TypeExternalSessionAiResponseMetadata, required
    - `clientProvided` TypeClientProvidedResponseMetadata
      - `clientRequestId` string
    - `requestId` string
    - `screenshots` TypeScreenshotMetadata[] — Array containing any requested screenshots from the operation.
      - `dataUrl` string — Base64 encoded data URL of screenshot image data
      - `fileId` string — Unique identifier for the uploaded file
      - `fileName` string — Name of the screenshot file
      - `format` 'base64' | 'url' — Format of the screenshot data
      - `scrollPosition` TypeScreenshotScrollPosition
        - `left` integer, required — Horizontal scroll position in pixels
        - `top` integer, required — Vertical scroll position in pixels
      - `signedDownloadUrl` string — Signed URL for downloading the screenshot (when format is 'url')
      - `urlExpiry` string — Expiration time for the signed URL in ISO format
      - `viewportDimensions` TypeScreenshotViewportDimensions
        - `height` integer, required — Height of the viewport in pixels
        - `width` integer, required — Width of the viewport in pixels
    - `status` 'success' | 'partial' | 'failure', required — Outcome of the operation.
    - `usage` TypeExternalSessionAiResponseMetadataUsage, required
      - `credits` integer, required — The credit usage for this request
      - `id` string, required — The id of the request
  - `warnings` TypeIssue[]
    - `code` string — Issue code.
    - `details` object — Any associated details.
    - `message` string, required — Message describing the issue.
    - `reason` string — Underlying reason for the issue.

---

[API](https://skmtc.net/airtop/apis/airtop-api.md) · [All operations](https://skmtc.net/airtop/apis/airtop-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/airtop/airtop-api/versions/77d6e0f03453/schema)
