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

# Create a monitor

> Creates a monitor and its public component. `type` selects the kind: `http` (default, polls a URL), `heartbeat` (a scheduled job pings us; the response includes a `pingUrl` to wire into the job), or `tcp` (connects to a host:port). The first check runs on the next poll cycle (within ~2 minutes).



## OpenAPI

````yaml https://www.sentivel.com/api/v1/openapi.json post /monitors
openapi: 3.1.0
info:
  title: Sentivel API
  version: 1.0.0
  description: >-
    Provision and read your Sentivel workspace programmatically: components,
    monitors, status pages and incidents. Authenticate with an org API token
    (create one under Developers → API tokens in the dashboard).
  contact:
    name: Sentivel
    url: https://www.sentivel.com
servers:
  - url: https://www.sentivel.com/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Identity
    description: Who the token is
  - name: Components
    description: Status-page components (status units)
  - name: Monitors
    description: Uptime/HTTP checks
  - name: Status pages
    description: Public status pages
  - name: Incidents
    description: Incidents (read + manual create)
  - name: People
    description: Workspace members
  - name: Integrations
    description: Outbound alert destinations
  - name: On-call
    description: On-call schedules
paths:
  /monitors:
    post:
      tags:
        - Monitors
      summary: Create a monitor
      description: >-
        Creates a monitor and its public component. `type` selects the kind:
        `http` (default, polls a URL), `heartbeat` (a scheduled job pings us;
        the response includes a `pingUrl` to wire into the job), or `tcp`
        (connects to a host:port). The first check runs on the next poll cycle
        (within ~2 minutes).
      operationId: createMonitor
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MonitorCreate'
      responses:
        '201':
          description: The created monitor.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Monitor'
        '400':
          description: >-
            Validation failed, or the target is not a public http(s)
            address/host.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The token's role can't manage monitors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Opt-in safe retries. Send a unique value (a UUID); a retry with the same
        key replays the first response (header `Idempotent-Replayed: true`)
        instead of acting twice. Reusing a key with a different body is rejected
        (400); a retry while the first is in flight gets 409. Scoped to the
        workspace, expires after 24h.
      schema:
        type: string
        maxLength: 255
  schemas:
    MonitorCreate:
      description: >-
        Discriminated on `type`. Omit `type` for an HTTP monitor
        (backward-compatible).
      oneOf:
        - $ref: '#/components/schemas/HttpMonitorCreate'
        - $ref: '#/components/schemas/HeartbeatMonitorCreate'
        - $ref: '#/components/schemas/TcpMonitorCreate'
      discriminator:
        propertyName: type
    Monitor:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type:
            - string
            - 'null'
        componentId:
          type:
            - string
            - 'null'
          format: uuid
        type:
          type: string
          enum:
            - http
            - heartbeat
            - tcp
            - dns
        target:
          type: string
        method:
          type: string
        intervalSeconds:
          type: integer
        timeoutMs:
          type: integer
        openThreshold:
          type: integer
        resolveThreshold:
          type: integer
        environment:
          type:
            - string
            - 'null'
        enabled:
          type: boolean
        lastCheckedAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
        pingUrl:
          type: string
          format: uri
          description: >-
            Heartbeat only, returned on create. The URL the scheduled job pings.
            It's a secret credential, so it is not returned by the list/get
            endpoints.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - unauthorized
                - forbidden
                - not_found
                - invalid_request
                - rate_limited
                - conflict
                - internal
            message:
              type: string
            details:
              type: object
          required:
            - code
            - message
    HttpMonitorCreate:
      type: object
      required:
        - name
        - target
      properties:
        type:
          type: string
          enum:
            - http
          default: http
        name:
          type: string
          minLength: 1
          maxLength: 120
        target:
          type: string
          format: uri
          description: The URL to poll. http/https only; SSRF-validated.
        method:
          type: string
          enum:
            - GET
            - HEAD
            - POST
        intervalSeconds:
          type: integer
          minimum: 60
          maximum: 86400
          description: Poll cadence (60s floor).
        timeoutMs:
          type: integer
          minimum: 1000
          maximum: 60000
        openThreshold:
          type: integer
          minimum: 1
          maximum: 10
        resolveThreshold:
          type: integer
          minimum: 1
          maximum: 10
        expectedStatusCodes:
          type: array
          items:
            type: integer
            minimum: 100
            maximum: 599
          description: Healthy status codes. Empty/absent = any 2xx–3xx.
        keyword:
          type: string
          maxLength: 200
        keywordAbsent:
          type: string
          maxLength: 200
        jsonAssertion:
          type: object
          description: >-
            Assert on a JSON response: navigate `path` (dot/bracket, leading $.
            optional) and compare with `op`.
          required:
            - path
            - op
          properties:
            path:
              type: string
              maxLength: 200
            op:
              type: string
              enum:
                - eq
                - ne
                - contains
                - gt
                - lt
                - exists
            value:
              type: string
              maxLength: 500
        degradedAfterMs:
          type: integer
          minimum: 1
          maximum: 60000
          description: A passing check slower than this is reported degraded (still up).
        latencyThresholdMs:
          type: integer
          minimum: 1
          maximum: 60000
          description: >-
            A check slower than this FAILS (opens an incident after the flap
            threshold).
        headers:
          type: object
          additionalProperties:
            type: string
          description: >-
            Custom request headers (e.g. Authorization). Stored encrypted; sent
            only to the original host (dropped on a cross-host redirect).
        body:
          type: string
          maxLength: 32768
          description: >-
            Request body for a POST/PUT check. Stored encrypted (may carry
            secrets).
        contentType:
          type: string
          maxLength: 200
          description: Content-Type for `body` (default application/json).
        environment:
          type:
            - string
            - 'null'
          maxLength: 60
        metadata:
          type: object
          additionalProperties:
            type: string
    HeartbeatMonitorCreate:
      type: object
      required:
        - type
        - name
        - intervalSeconds
      description: >-
        A dead-man's-switch: no outbound poll. The scheduled job pings the
        returned `pingUrl`; we alarm when a ping is overdue.
      properties:
        type:
          type: string
          enum:
            - heartbeat
        name:
          type: string
          minLength: 1
          maxLength: 120
        intervalSeconds:
          type: integer
          minimum: 60
          maximum: 2592000
          description: Expected period between pings (up to 30 days).
        graceSeconds:
          type: integer
          minimum: 0
          maximum: 86400
          description: Slack beyond the interval before a missing ping is a miss.
        environment:
          type:
            - string
            - 'null'
          maxLength: 60
    TcpMonitorCreate:
      type: object
      required:
        - type
        - name
        - host
        - port
      description: Opens a TCP socket to host:port on a cadence.
      properties:
        type:
          type: string
          enum:
            - tcp
        name:
          type: string
          minLength: 1
          maxLength: 120
        host:
          type: string
          minLength: 1
          maxLength: 255
          description: Public host (not localhost or a private IP).
        port:
          type: integer
          minimum: 1
          maximum: 65535
        intervalSeconds:
          type: integer
          minimum: 60
          maximum: 86400
        timeoutMs:
          type: integer
          minimum: 1000
          maximum: 60000
        openThreshold:
          type: integer
          minimum: 1
          maximum: 10
        resolveThreshold:
          type: integer
          minimum: 1
          maximum: 10
        environment:
          type:
            - string
            - 'null'
          maxLength: 60
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'An org API token (`sv_…`), sent as `Authorization: Bearer <token>`.'

````