# Clinical API v1 — quickstart (sandbox)

```bash
BASE=https://eyehealthintel.com/api/public/v1/clinical
KEY=<client_id>.<secret>          # from the Partner Portal, sandbox only

# 1. Create a capture session (opaque patient reference only)
curl -X POST $BASE/capture-sessions -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
  -d '{"external_patient_id":"SYN-PAT-1001","country":"SE","locale":"sv-SE","consent_attested":true,"idempotency_key":"syn-1001"}'
# → { id, patient_token, capture_url }   send capture_url to the (synthetic) patient

# 2. Poll or wait for the capture_session.completed webhook
curl $BASE/capture-sessions/$ID -H "Authorization: Bearer $KEY"

# 3. Results — always NOT_ASSESSABLE (MODEL_UNAVAILABLE) until a model is clinically released
curl $BASE/capture-sessions/$ID/results -H "Authorization: Bearer $KEY"

# 4. Report + FHIR R4 bundle
curl -X POST $BASE/reports -H "Authorization: Bearer $KEY" -H 'content-type: application/json' -d '{"capture_session_id":"'$ID'","idempotency_key":"rep-1001"}'
curl "$BASE/reports/$REPORT_ID?format=fhir" -H "Authorization: Bearer $KEY"
```
Errors: `{ "error": { "code", "correlation_id" } }` — see the OpenAPI description for the full list.
