# OpenAPI 3.1 contract reference

Canonical URL: https://docs.chartvoyant.com/openapi/
Endpoint: `GET https://chartvoyant.com/api/openapi.json`

ChartVoyant serves a live, machine-readable OpenAPI 3.1 document from the API container with no authentication required. Import it into Postman, Bruno, Insomnia, or typed client generators.

## Fetch the live specification

```
curl -sS "https://chartvoyant.com/api/openapi.json" | jq '.info, (.paths | keys)'
```

Note on routing: at the public apex, nginx strips the `/api` prefix before forwarding to the API container, so a path listed in `openapi.json` as `/v1/patients` is called externally at `https://chartvoyant.com/api/v1/patients` (and `/openapi.json` is served at `https://chartvoyant.com/api/openapi.json`).

## Security schemes in `components.securitySchemes`

| Scheme Name | Type | Description |
| --- | --- | --- |
| `platformApiKey` | `http` (`bearer`, format `cvk`) | ChartVoyant practice API key (`cvk_ _ `), bound to one office, `read_only` or `full`. |
| `patientMcpKey` | `http` (`bearer`, format `cvpk`) | Patient MCP key (`cvpk_ _ `), read-only, bound to one patient at one practice. |
| `bearerAuth` | `http` (`bearer`, format `AIMR-HMAC`) | Signed session token from `/v1/auth/login` (staff and portal web sessions; not for third-party server integrations). |
| `devHeaderTenant` / `devHeaderPrincipal` | `apiKey` (header) | Local synthetic development identity headers only (disabled in secure/production mode). |

## Operations in the OpenAPI 3.1 contract

| OpenAPI Path | External Production URL | Methods | Summary |
| --- | --- | --- | --- |
| `/healthz` | `/api/healthz` | `GET` | Liveness probe (unauthenticated). |
| `/readyz` | `/api/readyz` | `GET` | Readiness probe verifying database connectivity (unauthenticated). |
| `/openapi.json` | `/api/openapi.json` | `GET` | Returns the OpenAPI 3.1 JSON document itself (unauthenticated). |
| `/v1/system/status` | `/api/v1/system/status` | `GET` | Public platform component status snapshot (unauthenticated). See [Public Status API](https://docs.chartvoyant.com/status-api/). |
| `/v1/system/practice-status` | `/api/v1/system/practice-status` | `GET` | Public PHI-free per-practice health lookup by Practice ID query param `id`. |
| `/v1/context` | `/api/v1/context` | `GET` | Resolved tenant and principal context for the caller's credential. |
| `/v1/practitioners` | `/api/v1/practitioners` | `GET` | List practitioners in the practice (optional `limit`, `locationId`). |
| `/v1/practitioners/{id}` | `/api/v1/practitioners/{id}` | `GET` | Read one practitioner by UUID. |
| `/v1/locations/{id}/providers` | `/api/v1/locations/{id}/providers` | `PUT` | Set which providers work at a clinic site (administrator only). |
| `/v1/patients` | `/api/v1/patients` | `GET`, `POST` | Search patients (`mrn`, `q`, `limit`) or create a patient (`PatientCreate`). |
| `/v1/patients/{id}` | `/api/v1/patients/{id}` | `GET` | Read one patient by UUID. |
| `/v1/encounters` | `/api/v1/encounters` | `POST` | Create an encounter (`EncounterCreate`; publishes `visit.encounter.started`). |
| `/v1/documents` | `/api/v1/documents` | `POST` | Register document upload metadata (`DocumentRegister`). |
| `/v1/inbound-documents/awaiting-confirmation` | `/api/v1/inbound-documents/awaiting-confirmation` | `GET` | List inbound faxes/referrals awaiting patient confirmation. |
| `/v1/inbound-documents/{id}/confirm` | `/api/v1/inbound-documents/{id}/confirm` | `POST` | Record patient confirmation or field corrections on an extracted document. |
| `/v1/mcp` | `/api/v1/mcp` | `POST` | Stateless Streamable HTTP JSON-RPC 2.0 Practice MCP server. See [Practice MCP](https://docs.chartvoyant.com/mcp/). |
| `/v1/portal/mcp` | `/api/v1/portal/mcp` | `POST` | Stateless Streamable HTTP JSON-RPC 2.0 Patient MCP server. See [Patient MCP](https://docs.chartvoyant.com/patient-mcp/). |
| `/v1/portal/mcp/{key}` | `/api/v1/portal/mcp/{key}` | `POST` | Patient MCP server with `cvpk_…` key in the final URL path segment. |
| `/v1/portal/mcp-keys` | `/api/v1/portal/mcp-keys` | `GET`, `POST` | List or create a signed-in patient's MCP keys (portal session + password). |
| `/v1/portal/mcp-keys/{id}/revoke` | `/api/v1/portal/mcp-keys/{id}/revoke` | `POST` | Immediately revoke one of the signed-in patient's MCP keys. |

## Core component schemas

| Schema | Required Fields | Properties |
| --- | --- | --- |
| `ErrorEnvelope` | `error.code`, `error.message`, `error.correlationId` | `details` (optional structured validation or context details) |
| `HumanName` | — | `family` (string), `given` (string[]) |
| `Patient` | — | `id` (uuid), `mrn`, `name` (`HumanName`), `birth_date` (date), `language`, `version` (integer) |
| `PatientCreate` | `mrn`, `name` | `mrn`, `name` (`HumanName`), `birthDate` (date), `language` |
| `EncounterCreate` | `patientId`, `encounterType` | `patientId` (uuid), `practitionerId` (uuid), `encounterType`, `status`, `startsAt` (date-time) |
| `DocumentRegister` | `docType` | `patientId` (uuid), `encounterId` (uuid), `docType`, `description` |

The OpenAPI document covers the core contract routes and does not yet enumerate every route in the application; email [info@chartvoyant.com](mailto:info@chartvoyant.com) if your integration needs additional endpoints.
