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

# Rotate heartbeat ping URL



## OpenAPI

````yaml api-reference/openapi.json POST /metrics/{id}/heartbeat/rotate
openapi: 3.1.0
info:
  title: Observer API
  version: 1.0.0
  description: >-
    Public API for Observer: read services, metrics, SLOs and SLA statements;
    manage incidents, maintenance windows, manual metric status, config as code
    and Observer Agents. Bearer-auth via API keys (obs_pub_…), scoped per key.
    RFC 7807 problem-detail errors. Cursor pagination. Rate limits are per
    organization.
servers:
  - url: https://use.observer/api/v1
security:
  - bearerAuth: []
paths:
  /metrics/{id}/heartbeat/rotate:
    parameters:
      - name: id
        in: path
        required: true
        description: Metric id.
        schema:
          type: string
          format: uuid
    post:
      tags:
        - metrics
      summary: Issue a new heartbeat ping URL (the old one stops working)
      operationId: rotateMetricHeartbeatUrl
      responses:
        '200':
          description: ok, body includes the new ping_url
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Heartbeat'
        '401':
          description: >-
            `unauthenticated`: no bearer token was sent, or the key is invalid
            or revoked. `detail` distinguishes the two.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: >-
            `forbidden`: the key does not carry the scope this endpoint
            requires. `plan_does_not_permit_api`: the organization's plan does
            not include the public API.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: >-
            `not_found`: no heartbeat metric (metrics that are not heartbeats
            return 404 too) with that id is available to this key. One owned by
            another organization, or an id that is not a valid UUID, returns the
            same response, so a 404 does not confirm that the id is unused.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: >-
            `rate_limited`: the organization's per-minute or daily request limit
            is used up (`limit.window` says which). Limits are per organization,
            shared by every key. The response carries `Retry-After` and
            `retry_after`, in seconds.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '500':
          description: '`internal_error`: an unhandled server error. Safe to retry.'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - bearerAuth:
            - write:metrics
components:
  schemas:
    Heartbeat:
      type: object
      required:
        - metric_id
        - period_seconds
        - grace_seconds
        - state
        - pings
      properties:
        metric_id:
          type: string
          format: uuid
        period_seconds:
          type: integer
        grace_seconds:
          type: integer
        max_runtime_seconds:
          type:
            - integer
            - 'null'
        state:
          type: string
          enum:
            - waiting
            - up
            - running
            - late
            - failed
            - runtime_exceeded
          description: >-
            Evaluator phase. waiting = no ping received yet (no status is
            written).
        status:
          type:
            - string
            - 'null'
          enum:
            - healthy
            - degraded
            - unhealthy
            - null
        due_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the check goes late without a success ping.
        last_ping_at:
          type:
            - string
            - 'null'
          format: date-time
        last_ping_kind:
          type:
            - string
            - 'null'
          enum:
            - success
            - start
            - fail
            - null
        last_success_at:
          type:
            - string
            - 'null'
          format: date-time
        last_start_at:
          type:
            - string
            - 'null'
          format: date-time
        last_fail_at:
          type:
            - string
            - 'null'
          format: date-time
        last_exit_code:
          type:
            - integer
            - 'null'
        last_duration_ms:
          type:
            - integer
            - 'null'
        token_rotated_at:
          type:
            - string
            - 'null'
          format: date-time
        ping_url:
          type: string
          format: uri
          description: >-
            The check's ping URL. Present only for keys with write:metrics or
            write:config (a config writer creates heartbeat checks and needs the
            URL to wire up the job): anyone holding it can record pings.
        pings:
          type: array
          items:
            $ref: '#/components/schemas/HeartbeatPing'
    Problem:
      type: object
      required:
        - type
        - title
        - status
      example:
        type: https://docs.use.observer/api/getting-started/errors#forbidden
        title: forbidden
        status: 403
        detail: 'missing scope: write:incidents'
      properties:
        type:
          type: string
          format: uri
          description: Errors reference URI with the title token as the fragment.
          example: https://docs.use.observer/api/getting-started/errors#forbidden
        title:
          type: string
          description: Stable error token. Branch on this, not on detail.
        status:
          type: integer
        detail:
          type: string
          description: Human-readable explanation. Wording may change.
        retry_after:
          type: integer
          description: >-
            429 only: seconds until the exhausted window resets (mirrors
            Retry-After).
        limit:
          type: object
          description: '429 only: which organization limit was hit.'
          properties:
            scope:
              type: string
              enum:
                - organization
            window:
              type: string
              enum:
                - minute
                - day
            max:
              type: integer
            plan:
              type: string
        errors:
          type: array
          description: >-
            Validation failures (config_invalid, invalid_customer_targeting):
            one entry per problem.
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
        warnings:
          type: array
          description: >-
            config_invalid only: the same non-fatal warnings a successful apply
            returns.
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
        unknown_customers:
          type: array
          description: >-
            unknown_customers only: the submitted values that matched no
            customer in your organization.
          items:
            type: string
        referenced_by:
          type: object
          description: >-
            in_use only: what depends on the object (slos, pages: lists of { id,
            config_key, name }; subscribers: a count).
        quota:
          type: object
          description: >-
            quota_exceeded / feature_locked on a create only: the plan limit
            that blocked it.
          properties:
            capability:
              type: string
            used:
              type:
                - integer
                - 'null'
            cap:
              type:
                - integer
                - 'null'
            plan:
              type:
                - string
                - 'null'
        upgrade:
          type: object
          description: >-
            Plan-limit problems only, when a higher plan lifts the limit: the
            smallest such plan and the pricing page.
          properties:
            plan:
              type: string
            label:
              type: string
            url:
              type: string
              format: uri
    HeartbeatPing:
      type: object
      required:
        - kind
        - received_at
      properties:
        kind:
          type: string
          enum:
            - success
            - start
            - fail
        received_at:
          type: string
          format: date-time
        duration_ms:
          type:
            - integer
            - 'null'
          description: Time since the paired /start ping, when there was one.
        exit_code:
          type:
            - integer
            - 'null'
        message:
          type:
            - string
            - 'null'
          description: Request body sent with the ping (first 10 KB).
        via:
          type: string
          enum:
            - direct
            - agent
          description: >-
            direct: sent to the ping URL. agent: forwarded by an agent's
            heartbeat relay.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: obs_pub_
      description: >-
        An organization API key (obs_pub_…) sent as `Authorization: Bearer
        <key>`. Each key carries scopes; an endpoint lists the scope it needs.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.