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

# Per-asset calibration self-monitor (p95 vs band, 8d)



## OpenAPI

````yaml https://api.pegana.xyz/openapi.json get /v1/calibration
openapi: 3.1.0
info:
  title: Pegana API
  description: >-
    The peg-risk oracle for Solana. Read real-time peg state, history, alerts,
    and delivery health across the live mainnet asset universe spanning 6
    classes — LSTs, fiat / CDP / delta-neutral / yield-bearing / FX stables, and
    a leveraged synthetic. Some assets are flagged `monitoring_only` (beta):
    their alerts are live but the calibration is provisional. Public read
    endpoints require no API key but ARE rate-limited per IP (300/min global,
    10/min on /v1/audit.csv); exceeding the limit returns 429 with a Retry-After
    header. User-scoped /v1/me/* routes require a JWT obtained via Telegram
    Login. Every state transition emits a public receipt at /v1/audit/{id} with
    the methodology version, frozen inputs, and an on-chain SPL Memo commit (SAS
    deferred per ADR-0004 — SPL Memo gives 90% of the value). EVERY error
    response across the API is JSON — the envelope is `{error, message, asset?}`
    (the `ApiError` schema); branch on the stable `error` code, never on
    `message`. Malformed request bodies surface as `{error:"invalid_body"}`. Any
    endpoint may also return 500 `{error:"internal"}` on an unexpected server
    error. Value conventions: monetary and ratio amounts are exact decimal
    STRINGS (parse with a decimal library, never a float) with trailing zeros
    trimmed; USD aggregate fields (e.g. `market_cap`, `loop_exposure_usd`,
    `liquidatable_usd`) are rounded to the cent while price/discount signal
    fields keep full precision. All timestamps are RFC3339 UTC with millisecond
    precision and a `Z` suffix (`2026-07-24T15:33:14.545Z`). Every response
    carries an `x-request-id` header (quote it when reporting an issue) and the
    rate-limit budget as `RateLimit-Limit` / `RateLimit-Remaining` /
    `RateLimit-Reset` (mirrored as `X-RateLimit-*`); a 429 also sets
    `Retry-After`.
  contact:
    name: Rafael Souza
    email: rafael@pegana.xyz
  license:
    name: MIT
    identifier: MIT
  version: 1.0.0
servers:
  - url: https://api.pegana.xyz
    description: Production
security: []
tags:
  - name: Health
    description: Liveness and readiness probes
  - name: Assets
    description: Public read access to asset state, history, and metadata
  - name: Alerts
    description: Global feed of state transitions
  - name: Stats
    description: Aggregate counters and delivery health
  - name: Auth
    description: Telegram Login Widget → JWT
  - name: Me
    description: Authenticated user profile and preferences
  - name: Subscriptions
    description: User alert subscriptions
  - name: Webhooks
    description: User-managed Ed25519-signed webhooks
  - name: WebSocket
    description: Live state stream
  - name: audit
    description: >-
      Public receipts for alerts — methodology version, inputs frozen, replay
      bundles. All endpoints public, no auth, cacheable. ADR-0006 four-state
      response on /v1/audit/:id (200/202/404/410); ADR-0014 bounds (90-day max,
      100-row max, 50k-row cap).
  - name: methodology
    description: >-
      Public lifecycle status of the active methodology — version + status
      (active/deprecated/broken) + optional fix_url when broken. Consumed by
      web/app/api/methodology to power the home-page trust strip.
  - name: peg
    description: >-
      Peg-signal feed for tokens.xyz / aggregator consumption — a `data` array
      of per-asset signals (each carries its own `mint`). Public, no auth,
      cacheable. Honest beta status via `calibration` + `monitoring_only`;
      freshness via `updated_at` + `stale`.
paths:
  /v1/calibration:
    get:
      tags:
        - Stats
      summary: Per-asset calibration self-monitor (p95 vs band, 8d)
      operationId: calibration_health
      responses:
        '200':
          description: Calibration health per active asset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiList_CalibrationHealth'
        '429':
          description: Rate limit exceeded — see Retry-After header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    ApiList_CalibrationHealth:
      type: object
      description: 'List envelope: `{ ok, generated_at, count, data: [...] }`.'
      required:
        - ok
        - generated_at
        - count
        - data
      properties:
        count:
          type: integer
          description: Number of items in `data`.
          minimum: 0
        data:
          type: array
          items:
            type: object
            required:
              - symbol
              - monitoring_only
              - calibration
              - health
            properties:
              calibration:
                $ref: '#/components/schemas/Calibration'
                description: >-
                  Self-describing form of `monitoring_only`, `provisional` |
                  `calibrated`

                  — same vocabulary as the webhook canonical event and the other
                  read

                  surfaces. Always present.
              depeg_bps:
                type:
                  - integer
                  - 'null'
                format: int32
              drift_bps:
                type:
                  - integer
                  - 'null'
                format: int32
                description: >-
                  Asset's own drift / depeg bands (bps), from
                  `assets.thresholds`. `None`

                  for the CDP collateral-ratio thresholds shape (hyUSD), where
                  the bps

                  comparison does not apply.
              health:
                type: string
                description: >-
                  `ok` | `watch` (p95 in the drift band) | `miscalibrated` (p95
                  beyond the

                  depeg band) | `no_data` | `na` (non-bps thresholds).
              monitoring_only:
                type: boolean
                description: >-
                  Calibration-status flag (not a health state).
                  `monitoring_only` (beta)

                  assets now alert publicly, but their calibration is
                  provisional — the

                  flag lets clients label them as beta.
              p95_bps:
                type:
                  - integer
                  - 'null'
                format: int32
                description: >-
                  Trailing-8d p95 of the direction-sensitive effective discount
                  (bps):

                  discount side counts; benign lst/stable_yield premiums are
                  carved out;

                  premiums beyond the 10% NAV-sanity bound count as broken
                  anchors. `None`

                  when the source is dark (no snapshot, or <200 samples in the
                  8d window).
              p99_bps:
                type:
                  - integer
                  - 'null'
                format: int32
                description: >-
                  Trailing-8d p99 of the direction-sensitive effective discount
                  (bps):

                  discount side counts; benign lst/stable_yield premiums are
                  carved out;

                  premiums beyond the 10% NAV-sanity bound count as broken
                  anchors. `None`

                  when the source is dark (no snapshot, or <200 samples in the
                  8d window).
              symbol:
                type: string
        generated_at:
          type: string
          description: RFC3339 (UTC, millisecond, `Z`) build time of this response.
        ok:
          type: boolean
          description: >-
            Always `true` on a 2xx; errors use the `{error, message}` envelope
            instead.
    ApiError:
      type: object
      required:
        - error
        - message
      properties:
        asset:
          type:
            - string
            - 'null'
          description: The offending asset symbol, present only for asset-scoped errors.
        error:
          type: string
          description: Stable, machine-readable code. Branch on this, never on `message`.
        message:
          type: string
          description: >-
            Human-readable explanation. NOT stable — for humans/logs; do not
            parse.
    Calibration:
      type: string
      description: >-
        Calibration status of an asset (and of an alert that asset emitted).


        - `provisional` — a "beta" asset: released and alerting publicly, but
        its
          thresholds are not yet validated over a full post-launch calibration
          window. Equivalent to `monitoring_only=true`. Read its alerts as
          experimental.
        - `calibrated` — a fully calibrated asset that counts in the launch
          denominator.

        This is the SAME vocabulary the dispatcher emits on the webhook
        canonical

        event (`"calibration":"provisional"|"calibrated"`), so a machine
        consumer

        reading both the webhook fan-out and the REST read surfaces sees one
        word

        for the concept instead of `calibration` there and `monitoring_only`
        here.
      enum:
        - provisional
        - calibrated

````