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

# Create Monitor

> Watch a dataset endpoint on a schedule and email up to three addresses what is new. The monitor runs once right away to record what already matches (the baseline) and sends a welcome email; from then on every run reports only rows that appeared since the last one. With `schedule.cadence: "source"` (the default) each run starts after the dataset's own refresh has completed, so a daily source is checked once a day, right after new data lands. Each run spends the same credits as one request to the endpoint. An organization may have up to 20 monitors.



## OpenAPI

````yaml /api-reference/openapi.json post /monitors
openapi: 3.1.0
info:
  title: Croma Marketplace API
  version: 1.0.0
  description: >-
    Government-data APIs for Colombia, Peru, Mexico, and global web search.
    Croma normalizes public-sector data into structured JSON for product teams
    and AI agents.


    Every operation is a POST with a JSON body and an organization API key as a
    bearer token; every operation is an idempotent lookup and accepts an
    optional `Idempotency-Key` header. Paths carry their major version (`/v1`);
    the versioning and deprecation policy, including the `Deprecation` and
    `Sunset` headers a retiring endpoint sends, is at
    https://docs.usecroma.com/versioning. Rate limits are per organization and
    reported on every response (`RateLimit-Policy`, `X-RateLimit-*`):
    https://docs.usecroma.com/rate-limits.
  termsOfService: https://usecroma.com/en/terms
  contact:
    name: Croma support
    url: https://usecroma.com/en/support
    email: tomas@usecroma.com
servers:
  - url: https://api.croma.run
security: []
paths:
  /monitors:
    post:
      tags:
        - Monitors
      summary: Create Monitor
      description: >-
        Watch a dataset endpoint on a schedule and email up to three addresses
        what is new. The monitor runs once right away to record what already
        matches (the baseline) and sends a welcome email; from then on every run
        reports only rows that appeared since the last one. With
        `schedule.cadence: "source"` (the default) each run starts after the
        dataset's own refresh has completed, so a daily source is checked once a
        day, right after new data lands. Each run spends the same credits as one
        request to the endpoint. An organization may have up to 20 monitors.
      operationId: create_monitor
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MonitorCreateRequest'
            example:
              name: Contrato AD9-111
              endpoint: /co/anm/notices-search/v1
              query:
                title_number: AD9-111
              schedule:
                cadence: source
              recipients:
                - legal@example.com
              notify: always
              language: es
      responses:
        '201':
          description: The monitor, with its compiled schedule and next run.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MonitorResponse'
        '400':
          description: >-
            Invalid body: unknown endpoint, endpoint not monitorable, invalid
            query for that endpoint, schedule faster than the source, or too
            many recipients
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing or invalid API key
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Monitor limit reached for the organization
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: >-
            A monitor with the same endpoint, query and schedule already exists
            (`details.existing_id`)
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Rate limit exceeded
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: The schedule could not be created; retry
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Deprecation:
              $ref: '#/components/headers/Deprecation'
            Sunset:
              $ref: '#/components/headers/Sunset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - bearerAuth: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Optional client-chosen key for this request (any string up to 255
        characters, e.g. a UUID). Every Croma operation is an idempotent lookup:
        repeating a request with the same body returns the same result and
        creates nothing, so retrying after a timeout or network failure is
        always safe. The key is echoed back in the `Idempotency-Key` response
        header so you can correlate a retry with its first attempt. Each attempt
        that reaches the API counts against the rate limit.
      schema:
        type: string
        maxLength: 255
        example: 0f8e9a42-6b7c-4d1e-9a3f-2c5d7e8f9a0b
  schemas:
    MonitorCreateRequest:
      type: object
      required:
        - name
        - endpoint
        - recipients
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
          example: Contrato AD9-111
        endpoint:
          type: string
          description: >-
            The dataset endpoint to watch, by path or catalog id. Only endpoints
            with `monitorable: true` in `/catalog` are accepted.
          example: /co/anm/notices-search/v1
        query:
          type: object
          description: >-
            The request body the monitor sends to the endpoint, validated
            exactly as a direct request would be. `page` and `per_page` are not
            allowed.
          additionalProperties: true
          example:
            title_number: AD9-111
        schedule:
          type: object
          description: >-
            When the monitor runs. `source` (the default) runs right after the
            dataset's own refresh completes; `hourly`, `daily` and `weekly` run
            on the clock, never faster than the source refreshes.
          properties:
            cadence:
              type: string
              enum:
                - source
                - hourly
                - daily
                - weekly
              default: source
            at:
              type: string
              pattern: ^([01]\d|2[0-3]):[0-5]\d$
              description: Time of day for daily and weekly, HH:MM. Default 08:00.
              example: '08:00'
            weekday:
              type: string
              enum:
                - monday
                - tuesday
                - wednesday
                - thursday
                - friday
                - saturday
                - sunday
              description: Day for weekly. Default monday.
            timezone:
              type: string
              description: IANA timezone for `at`. Defaults to the dataset's own.
              example: America/Bogota
          additionalProperties: false
        recipients:
          type: array
          items:
            type: string
            format: email
          minItems: 1
          maxItems: 3
          description: Up to three addresses that receive the results.
        notify:
          type: string
          enum:
            - always
            - on_new
          default: always
          description: >-
            `always` sends an email on every run, including one that found
            nothing new; `on_new` only when there is something to report.
        language:
          type: string
          enum:
            - es
            - en
          default: es
          description: Language of the emails.
        relevance:
          type:
            - string
            - 'null'
          maxLength: 500
          description: >-
            Optional instruction, in plain language, that filters new results by
            relevance before they are sent (e.g. "solo avisos sobre suspensión o
            caducidad del título"). Results the filter discards stay available
            under `GET /monitors/{id}/matches?relevant=false`.
      additionalProperties: false
    MonitorResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/Monitor'
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
          properties:
            type:
              type: string
              description: >-
                Broad category: invalid_request_error, authentication_error,
                not_found_error, rate_limit_error, upstream_error, api_error.
            code:
              type: string
              description: Machine-readable specific code.
            message:
              type: string
              description: Human-readable explanation, safe to surface in UI.
            param:
              type: string
              description: Field that triggered the error. Present on validation errors.
            details:
              type: object
              description: Free-form structured detail.
    Monitor:
      type: object
      required:
        - id
        - name
        - endpoint
        - query
        - relevance
        - schedule
        - recipients
        - notify
        - language
        - status
        - created_at
        - updated_at
        - last_run
      properties:
        id:
          type: string
          example: mon_5f1c2c0a-9d1e-4a3b-8c7d-1e2f3a4b5c6d
        name:
          type: string
        endpoint:
          type: object
          required:
            - id
            - path
            - source
            - name
          properties:
            id:
              type: string
              example: anm-notices-search
            path:
              type: string
              example: /co/anm/notices-search/v1
            source:
              type: string
              example: ANM
            name:
              type: string
        query:
          type: object
          additionalProperties: true
        relevance:
          type:
            - string
            - 'null'
        schedule:
          type: object
          required:
            - cadence
            - timezone
            - cron
            - next_run_at
          properties:
            cadence:
              type: string
              enum:
                - source
                - hourly
                - daily
                - weekly
            at:
              type: string
            weekday:
              type: string
              enum:
                - monday
                - tuesday
                - wednesday
                - thursday
                - friday
                - saturday
                - sunday
            timezone:
              type: string
            cron:
              type: string
              description: The compiled schedule, five-field cron in `timezone`.
              example: 30 7 * * *
            next_run_at:
              type:
                - string
                - 'null'
              format: date-time
        recipients:
          type: array
          items:
            type: string
        notify:
          type: string
          enum:
            - always
            - on_new
        language:
          type: string
          enum:
            - es
            - en
        status:
          type: string
          enum:
            - active
            - paused
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        last_run:
          $ref: '#/components/schemas/MonitorLastRun'
    MonitorLastRun:
      type:
        - object
        - 'null'
      required:
        - id
        - at
        - status
        - new_results
        - relevant_results
        - source_as_of
        - source_stale
      properties:
        id:
          type: string
        at:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - running
            - completed
            - failed
            - skipped_plan_limit
        new_results:
          type: integer
        relevant_results:
          type: integer
        source_as_of:
          type:
            - string
            - 'null'
        source_stale:
          type: boolean
  headers:
    X-Request-Id:
      description: Unique id for the request (req_…). Include it in support reports.
      schema:
        type: string
    RateLimit-Policy:
      description: >-
        Quota policy for this endpoint as an IETF RateLimit-Policy structured
        field, e.g. `"default";q=100;w=86400` (100 requests per 86400-second
        window per organization). Endpoints with an extra hourly ceiling list
        both policies, e.g. `"webSearch";q=10;w=3600, "default";q=100;w=86400`.
        Present on every response, including 401 and 429.
      schema:
        type: string
        example: '"default";q=100;w=86400'
    Idempotency-Key:
      description: >-
        The `Idempotency-Key` the request carried, echoed back unchanged. Absent
        when the request sent none.
      schema:
        type: string
    Deprecation:
      description: >-
        Present only on an endpoint version scheduled for removal: the date the
        deprecation took effect (RFC 9745). A `Sunset` header and a `Link` with
        `rel="successor-version"` accompany it. Policy:
        https://docs.usecroma.com/versioning
      schema:
        type: string
        example: '@1767225600'
    Sunset:
      description: >-
        Present only on an endpoint version scheduled for removal: the date
        after which it answers 410 (RFC 8594). Announced in the changelog at
        least 90 days ahead.
      schema:
        type: string
        format: date-time
        example: Wed, 01 Apr 2026 00:00:00 GMT
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Use Authorization: Bearer YOUR_API_KEY'

````