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

# List Monitor Runs

> List a monitor's run history with status, timing, credits charged, and any detected change per run.

<Badge color="green">0 Credits</Badge>


## OpenAPI

````yaml GET /monitors/{monitor_id}/runs
openapi: 3.1.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: Batch
    description: Scrape many pages or crawl a site asynchronously.
  - name: Monitors
    description: >-
      Monitor pages, sitemaps, and extracted website data for exact or semantic
      changes. Webhook payloads are documented by the
      MonitorsChangeDetectedWebhookPayload and
      MonitorsRunCompletedWebhookPayload schemas.
  - name: WebDBs
    description: Create structured tables from web pages and keep them up to date.
  - name: News
    description: >-
      Search live first-party RSS and free historical news data by company
      identity.
paths:
  /monitors/{monitor_id}/runs:
    get:
      tags:
        - Monitors
      summary: List monitor runs
      operationId: listMonitorRuns
      parameters:
        - schema:
            type: string
            example: mon_123
          required: true
          name: monitor_id
          in: path
        - schema:
            type: string
            enum:
              - queued
              - running
              - completed
              - failed
              - skipped
            description: Filter runs by lifecycle status.
          required: false
          description: Filter runs by lifecycle status.
          name: status
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            description: >-
              Maximum number of items to return per page (1-100). Defaults to
              25.
          required: false
          description: Maximum number of items to return per page (1-100). Defaults to 25.
          name: limit
          in: query
        - schema:
            type: string
            description: Opaque pagination cursor from a previous response.
          required: false
          description: Opaque pagination cursor from a previous response.
          name: cursor
          in: query
      responses:
        '200':
          description: A paginated list of runs for the monitor
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MonitorsListRunsResponse'
        '401':
          $ref: '#/components/responses/MonitorsUnauthorized'
        '404':
          $ref: '#/components/responses/MonitorsNotFound'
      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.monitors.listRuns('mon_123');

            console.log(response.data);
        - 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.monitors.list_runs(
                monitor_id="mon_123",
            )
            print(response.data)
        - 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.Monitors.ListRuns(\n\t\tcontext.TODO(),\n\t\t\"mon_123\",\n\t\tcontextdev.MonitorListRunsParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Ruby
          source: |-
            require "context_dev"

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

            response = context_dev.monitors.list_runs("mon_123")

            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->monitors->listRuns(
                'mon_123', cursor: 'cursor', limit: 1, status: 'queued'
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            context-dev monitors list-runs \
              --api-key 'My API Key' \
              --monitor-id mon_123
components:
  headers:
    RateLimitLimit:
      description: >-
        Maximum requests allowed in the current fixed one-minute window.
        Returned when the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
        minimum: 1
    RateLimitRemaining:
      description: >-
        Requests remaining in the current fixed one-minute window. Returned when
        the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
        minimum: 0
    RateLimitReset:
      description: >-
        Unix timestamp in seconds when the current rate-limit window resets.
        Returned when the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
  schemas:
    MonitorsListRunsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MonitorsRun'
        has_more:
          type: boolean
        next_cursor:
          type:
            - string
            - 'null'
      required:
        - data
        - has_more
        - next_cursor
      additionalProperties: false
    MonitorsRun:
      type: object
      properties:
        id:
          type: string
          example: run_123
        monitor_id:
          type: string
          example: mon_123
        status:
          $ref: '#/components/schemas/MonitorsRunStatus'
        run_type:
          type: string
          enum:
            - baseline
            - scheduled
          description: The first run after monitor creation is a baseline run.
        target_type:
          $ref: '#/components/schemas/MonitorsTargetType'
        change_detection_type:
          $ref: '#/components/schemas/MonitorsChangeDetectionType'
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        change_detected:
          type: boolean
          example: true
        change_id:
          type:
            - string
            - 'null'
          example: chg_123
        baseline_created:
          type: boolean
          description: >-
            True when this run established the monitor's initial baseline;
            baseline runs perform no change detection.
        credits_charged:
          type: integer
          minimum: 0
          description: Credits charged for this run (0 for skipped/failed runs).
          example: 1
        skip_reason:
          type:
            - string
            - 'null'
          enum:
            - insufficient_credits
            - monitor_paused
            - superseded
            - null
          description: Why a skipped run never executed; null unless status is `skipped`.
        error:
          $ref: '#/components/schemas/MonitorsNullableRunError'
        webhook_delivery:
          $ref: '#/components/schemas/MonitorsWebhookDelivery'
          deprecated: true
          description: >-
            Deprecated: use `webhook_deliveries`, which records every attempt
            now that a run can deliver multiple events. Omitted when no webhook
            was attempted, including historical runs created before delivery
            tracking was added.
        webhook_deliveries:
          type: array
          items:
            $ref: '#/components/schemas/MonitorsWebhookDelivery'
          description: >-
            All webhook deliveries attempted by this run — one per subscribed
            event that fired. Omitted when no webhook was attempted, including
            runs created before event selection was added.
      required:
        - id
        - monitor_id
        - status
        - run_type
        - target_type
        - change_detection_type
        - change_detected
        - baseline_created
        - credits_charged
      additionalProperties: false
    ErrorResponse:
      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
            - PAID_PLAN_REQUIRED
            - INSUFFICIENT_PERMISSIONS
            - TIMEOUT_EXCEEDS_MAXIMUM
            - WEBSITE_ACCESS_ERROR
            - WEBSITE_NOT_FOUND
            - PDF_SKIPPED
            - PDF_IMAGES_ONLY
            - EXTERNAL_PROVIDER_ERROR
            - INPUT_VALIDATION_ERROR
            - ZDR_NOT_SUPPORTED
            - ZDR_NOT_ENABLED
            - FREE_EMAIL_DETECTED
            - DISPOSABLE_EMAIL_DETECTED
            - REQUEST_TIMEOUT
            - COLD_DOMAIN_TIMEOUT_TOO_LOW
            - UNSUPPORTED_CONTENT
            - CONTENT_TOO_LARGE
            - MONITOR_PAUSED
            - MONITOR_NO_WEBHOOK
            - COLLECTION_PAUSED
            - MONITOR_LIMIT_EXCEEDED
            - SEARCH_UNAVAILABLE
            - BATCH_LIMIT_EXCEEDED
            - BATCH_NOT_CANCELLABLE
            - BATCH_NOT_COMPLETED
            - IDEMPOTENCY_KEY_CONFLICT
          description: Error code indicating the type of error
        key_metadata:
          $ref: '#/components/schemas/KeyMetadata'
    MonitorsRunStatus:
      type: string
      enum:
        - queued
        - running
        - completed
        - failed
        - skipped
      description: >-
        Lifecycle status of a run. `skipped` runs never executed — see
        `skip_reason` (insufficient credits, monitor paused, or superseded by a
        concurrent run).
    MonitorsTargetType:
      type: string
      enum:
        - page
        - sitemap
        - extract
    MonitorsChangeDetectionType:
      type: string
      enum:
        - exact
        - semantic
    MonitorsNullableRunError:
      anyOf:
        - allOf:
            - $ref: '#/components/schemas/MonitorsRunError'
        - type: 'null'
    MonitorsWebhookDelivery:
      type: object
      properties:
        event_id:
          type: string
          description: Identifier sent in the X-Context-Id header.
          example: evt_123
        event:
          type: string
          enum:
            - change.detected
            - run.completed
          description: >-
            The event this delivery carried. Deliveries recorded before event
            selection existed report change.detected.
        status:
          type: string
          enum:
            - delivered
            - rejected
            - failed
            - skipped_unsafe_url
          description: >-
            Delivery outcome. delivered means any 2xx response; rejected means a
            non-2xx response; failed means no HTTP response was received;
            skipped_unsafe_url means the URL failed the public-endpoint safety
            check.
        http_status:
          type:
            - integer
            - 'null'
          minimum: 100
          maximum: 599
          description: >-
            The endpoint's final HTTP response status, or null when no response
            was received.
          example: 200
        attempted_at:
          type: string
          format: date-time
        error:
          $ref: '#/components/schemas/MonitorsNullableRunError'
      required:
        - event_id
        - event
        - status
        - http_status
        - attempted_at
        - error
      additionalProperties: false
      x-stainless-model: monitors.webhook_delivery
    KeyMetadata:
      type: object
      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
      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.
    MonitorsRunError:
      type: object
      properties:
        code:
          type: string
          example: fetch_failed
        message:
          type: string
          example: The target URL could not be fetched.
      required:
        - code
        - message
      additionalProperties: false
  responses:
    MonitorsUnauthorized:
      description: Unauthorized
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    MonitorsNotFound:
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <API_KEY>`, where
        `<API_KEY>` is your api key.

````