---
title: "Build an AI-ready, provenance-labelled context for a patient"
method: POST
path: "/v1/context"
tags: ["REST v1"]
---

# Build an AI-ready, provenance-labelled context for a patient

`POST /v1/context`

## Request

- Base URL: `https://platform.anpheros.com`
- URL: `https://platform.anpheros.com/v1/context`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Api-Key`
  - OAuth 2 (authorization code, authorization URL `https://platform.anpheros.com/oauth/authorize`, token URL `https://platform.anpheros.com/oauth/token`; client credentials, token URL `https://platform.anpheros.com/oauth/token`, scopes: `patient/*.rs`, `patient/Observation.rs`, `patient/Observation.rs?category=laboratory`, `patient/Condition.rs`, `patient/MedicationStatement.rs`, `patient/DocumentReference.rs`, `patient/AllergyIntolerance.rs`, `offline_access`, `openid`, `fhirUser`, `anpheros/patterns`)

## Headers

- `authorization` string, nullable
- `X-Api-Key` string, nullable
- `X-Anpheros-Acting-As` string, nullable
- `X-Anpheros-On-Behalf-Of` string, nullable

## Response `200`

Successful Response

- ContextOut: Răspunsul `POST /v1/context`: secțiuni etichetate cu proveniență, într-un buget de tokeni.
  - `manifest_id` string, required
  - `patient` string, required
  - `budget_tokens` integer, required
  - `tokens_used` integer, required
  - `needs` object, required
  - `sections` ContextSection[], required
    - `kind` string, required
    - `tokens` integer, required
    - `items` object[], required
    - `text` string, nullable
    - `note` string, nullable
    - `sources` object
  - `omitted` string[], required
  - `warnings` string[], required
  - `provenance_note` string, required
  - `text` string, nullable

## Other responses

- `401`: Missing, invalid, expired or revoked credential (`WWW-Authenticate: Bearer`).
- `403`: The consent behind this token does not allow reading observations, conditions, medications and allergies.
- `422`: Validation Error
- `429`: Rate limit exceeded; wait `Retry-After` seconds.

---

[API](https://skmtc.dev/anpheros/apis/anpheros-platform.md) · [All operations](https://skmtc.dev/anpheros/apis/anpheros-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/anpheros/apis/anpheros-platform/revisions/ff567b232dc3?raw)
