{"service":"opendoc-protocol","version":"1.0.0-headless","documentation":"https://docs.opendoc.com","openapi":"/protocol/openapi.json","capabilities":{"mcp":true,"events":{"sse":true,"webhooks":true},"transaction_state_machine":"S0-S8","identity_assurance_levels":["IA0","IA1","IA2"],"consent_layers":2,"cash_price_invariant":true,"sure_price":true,"anti_kickback_enforcement":true,"mass_revocation":true,"concentration_ceiling":0.25},"auth":{"oidc":{"scheme":"Bearer JWT","status":"durable_identity_input","documentation":"Keycloak or another approved on-prem OIDC provider authenticates identity only; OpenDoc protocol authorization remains database-owned."},"agent_token":{"scheme":"Bearer","grant_path":"POST /agent-tokens","documentation":"Patient grants a scoped token via the marketplace UI or API."}},"events":{"types":["transaction.state_changed","transaction.escrowed","transaction.service_completed","transaction.funds_released","transaction.disputed","provider.availability_changed","provider.price_changed","provider.trust_state_changed","health_key.state_changed","receipt.finalized","market.threshold_reached","agent_ecosystem.revoked"],"sse_path":"/events","webhook_path":"/event-subscriptions","signature_header":"x-opendoc-signature","signature_algorithm":"HMAC-SHA256-hex"},"permissions":["search","BOOK","CANCEL","READ_BOOKINGS","READ_TRANSACTIONS","READ_RECEIPTS","READ_PROFILE","READ_CONSENT","READ_HEALTH_KEY","pay","manage_catalog","manage_availability","view_bookings","submit_pos","manage_ehr_provider_link"],"consents":{"layer_1":[{"key":"data_tier_2","description":"Read clinical-detail data tier"},{"key":"data_tier_3","description":"Read full data tier (PHI breadth)"}],"layer_2":[{"key":"BOOK","description":"Allow agents to complete bookings"},{"key":"CANCEL","description":"Allow agents to cancel bookings"},{"key":"GRANT_AGENT_TOKEN","description":"Allow granting agent tokens"},{"key":"SHARE_RECEIPT_INSURANCE","description":"Allow exporting insurance-format receipts"},{"key":"SHARE_PROJECTION","description":"Allow sharing visit projection"},{"key":"DISPUTE","description":"Allow filing disputes on patient's behalf"}]},"error_shape":{"example":{"error":{"code":"authentication_required","message":"agent token required","correlationId":"abc123-..."}},"codes":["authentication_required","forbidden","not_found","conflict","unprocessable_entity","rate_limited","payment_required","internal_error"]},"tools":[{"name":"search","toolset":"discovery","method":"GET","path":"/search","authRequired":"none","description":"CRE-routed semantic search across providers + HSOs."},{"name":"clinical_route","toolset":"discovery","method":"GET","path":"/clinical-route","authRequired":"none","description":"Natural-language clinical routing: symptom/diagnosis → service lens → eligible specialists, with deterministic ER/urgent safety intercepts."},{"name":"list_hsos","toolset":"discovery","method":"GET","path":"/hsos","authRequired":"none","description":"Catalog list with min-price aggregate."},{"name":"get_hso","toolset":"discovery","method":"GET","path":"/hsos/:slug","authRequired":"none","description":"HSO detail + every provider offering it."},{"name":"list_providers","toolset":"discovery","method":"GET","path":"/providers","authRequired":"none","description":"Active providers with text search."},{"name":"get_provider","toolset":"discovery","method":"GET","path":"/providers/:id","authRequired":"none","description":"Provider detail + their full rate-card offerings."},{"name":"check_availability","toolset":"discovery","method":"GET","path":"/providers/:id/availability","authRequired":"none","description":"Open availability slots in a window."},{"name":"list_offers","toolset":"discovery","method":"GET","path":"/offers","authRequired":"none","description":"Flat (provider × HSO × SCP) rate-card list."},{"name":"get_sure_price","toolset":"discovery","method":"GET","path":"/sure-price","authRequired":"none","description":"Machine-verifiable ceiling guarantee per HSO × geo × payer."},{"name":"get_trust","toolset":"discovery","method":"GET","path":"/trust/scp/:scpId","authRequired":"none","description":"8-domain reliability state for an SCP."},{"name":"list_specialties","toolset":"discovery","method":"GET","path":"/specialties","authRequired":"none","description":"Distinct specialties with provider counts."},{"name":"declare_intent","toolset":"transaction","method":"POST","path":"/transactions/declare-intent","authRequired":"identity_session","permission":"BOOK","description":"S0 → S1. Declare booking intent."},{"name":"authorize","toolset":"transaction","method":"POST","path":"/transactions/:id/authorize","authRequired":"identity_session","permission":"BOOK","description":"S1 → S2. HSO Instance born; price locked."},{"name":"accept_terms","toolset":"transaction","method":"POST","path":"/transactions/:id/accept-terms","authRequired":"identity_session","permission":"BOOK","description":"S2 → S3. Bind payment method."},{"name":"commit","toolset":"transaction","method":"POST","path":"/transactions/:id/commit","authRequired":"identity_session","permission":"BOOK","description":"S3 → S4 atomic commit."},{"name":"get_transaction","toolset":"transaction","method":"GET","path":"/transactions/:id","authRequired":"identity_session","permission":"READ_TRANSACTIONS","description":"Read current state."},{"name":"cancel_booking","toolset":"transaction","method":"POST","path":"/bookings/:id/cancel","authRequired":"identity_session","permission":"CANCEL","description":"Cancel before fulfillment."},{"name":"submit_proof_of_service","toolset":"provider","method":"POST","path":"/admin/bookings/:id/fulfill","authRequired":"identity_session","permission":"submit_pos","description":"Submit proof of service / fulfill a scoped booking as workforce, provider/SCP user, or provider agent."},{"name":"create_health_key","toolset":"patient","method":"POST","path":"/health-keys","authRequired":"identity_session","description":"Create a Health Key (idempotent)."},{"name":"get_health_key","toolset":"patient","method":"GET","path":"/health-keys/me","authRequired":"identity_session","permission":"READ_HEALTH_KEY","description":"Read the patient's active Health Key."},{"name":"promote_ia2","toolset":"patient","method":"POST","path":"/health-keys/me/promote-ia2","authRequired":"identity_session","description":"Promote Health Key to IA2 (transactable)."},{"name":"list_consent","toolset":"patient","method":"GET","path":"/me/consent","authRequired":"identity_session","permission":"READ_CONSENT","description":"List active Layer 1 + Layer 2 grants."},{"name":"grant_consent","toolset":"patient","method":"POST","path":"/me/consent","authRequired":"identity_session","description":"Grant a data tier (Layer 1) or action (Layer 2) consent."},{"name":"revoke_consent","toolset":"patient","method":"POST","path":"/me/consent/:id/revoke","authRequired":"identity_session","description":"Revoke a specific grant."},{"name":"grant_agent_token","toolset":"patient","method":"POST","path":"/agent-tokens","authRequired":"identity_session","description":"Mint a scoped agent token (rawToken returned ONCE)."},{"name":"list_agent_tokens","toolset":"patient","method":"GET","path":"/agent-tokens","authRequired":"identity_session","description":"List the patient's active agent tokens."},{"name":"revoke_agent_token","toolset":"patient","method":"POST","path":"/agent-tokens/:id/revoke","authRequired":"identity_session","description":"Revoke a specific agent token."},{"name":"get_my_profile","toolset":"patient","method":"GET","path":"/me/profile","authRequired":"identity_session","permission":"READ_PROFILE","description":"Read patient self-profile."},{"name":"update_my_profile","toolset":"patient","method":"PATCH","path":"/me/profile","authRequired":"identity_session","description":"Patch patient self-profile."},{"name":"list_my_bookings","toolset":"patient","method":"GET","path":"/me/bookings","authRequired":"identity_session","permission":"READ_BOOKINGS","description":"Patient's own booking history."},{"name":"list_my_receipts","toolset":"patient","method":"GET","path":"/me/receipts","authRequired":"identity_session","permission":"READ_RECEIPTS","description":"List receipts (patient view)."},{"name":"get_my_receipt","toolset":"patient","method":"GET","path":"/me/receipts/:id","authRequired":"identity_session","permission":"READ_RECEIPTS","description":"Receipt detail. format=insurance requires SHARE_RECEIPT_INSURANCE Layer 2 consent."},{"name":"create_offer","toolset":"provider","method":"POST","path":"/offers","authRequired":"identity_session","permission":"manage_catalog","description":"Create or update a scoped provider/SCP catalog offer. Provider-agent tokens must carry manage_catalog."},{"name":"start_provider_fhir_login","toolset":"provider","method":"POST","path":"/fhir/provider/login-:provider","authRequired":"identity_session","permission":"manage_ehr_provider_link","description":"Start provider-side EHR/FHIR linking. Provider-agent tokens must carry manage_ehr_provider_link."},{"name":"events_stream","toolset":"events","method":"GET","path":"/events","authRequired":"agent_token","description":"SSE stream of canonical protocol events."},{"name":"create_event_subscription","toolset":"events","method":"POST","path":"/event-subscriptions","authRequired":"agent_token","description":"Register a webhook callback (HMAC-signed)."},{"name":"list_event_subscriptions","toolset":"events","method":"GET","path":"/event-subscriptions","authRequired":"agent_token","description":"List the calling token's subscriptions."}]}