{"openapi":"3.1.0","info":{"title":"NHS-SIM API","version":"1.0.0","description":"Synthetic healthcare simulation APIs. Start with POST /api/keys, copy apiKey, then authorize using TeamKey. Try it out performs real changes within your team's simulated world. No real patient data, NHS credentials or clinical advice. Staff Identity access tokens and operator tokens are separate credentials. JSON request bodies are limited to 65,536 bytes, except authenticated bulk team deletion and all-team incidents, which allow 1,048,576 bytes for up to 5,000 teams. Site actions use optimistic versions and idempotency. Browser origin checks permit only the deployed application origin for mutations. Legacy HTML form integration is documented in the handbook and has no REST action API."},"servers":[{"url":"/","description":"This deployment (same origin)"}],"tags":[{"name":"Discovery"},{"name":"Team"},{"name":"Service workspaces"},{"name":"Primary care"},{"name":"Hospital"},{"name":"Secondary care"},{"name":"Pharmacy"},{"name":"Messaging"},{"name":"Wearables"},{"name":"Simulation time"},{"name":"NHS-shaped adapters"},{"name":"FHIR read-only subsets"},{"name":"Staff Identity"},{"name":"Operator"}],"paths":{"/healthz":{"get":{"operationId":"health","tags":["Discovery"],"summary":"Check application and PostgreSQL health","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"database":{"const":"postgresql"},"mode":{"const":"synthetic"}},"required":["ok","database","mode"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/catalogue":{"get":{"operationId":"catalogue","tags":["Discovery"],"summary":"List live sites, active adapters and simulation incidents","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"sites":{"type":"array","items":{"type":"object","additionalProperties":true}},"workspaces":{"type":"array","items":{"type":"object","additionalProperties":true}},"messaging":{"type":"object","properties":{"name":{"type":"string"},"practice":{"const":"/api/sites/gp/messages"},"patient":{"const":"/api/sites/patient/messages"},"replyPresets":{"const":"/api/messaging/reply-presets"},"scope":{"const":"gp"}},"required":["name","practice","patient","replyPresets","scope"]},"primaryCare":{"type":"object","properties":{"name":{"type":"string"},"site":{"const":"gp"},"description":{"type":"string"},"prescriptions":{"const":"/api/sites/gp/prescriptions"},"actions":{"const":"/api/sites/gp/actions"}},"required":["name","site","description","prescriptions","actions"]},"secondaryCare":{"type":"object","properties":{"name":{"type":"string"},"site":{"const":"hospital"},"description":{"type":"string"},"consultations":{"const":"/api/sites/hospital/consultations"},"genomes":{"const":"/api/sites/hospital/genomes"}},"required":["name","site","description","consultations","genomes"]},"wearables":{"type":"object","properties":{"name":{"type":"string"},"site":{"const":"wearables"},"description":{"type":"string"},"devices":{"const":"/api/sites/wearables/devices"},"readings":{"const":"/api/sites/wearables/readings"}},"required":["name","site","description","devices","readings"]},"apis":{"type":"array","items":{"type":"object","additionalProperties":true}},"scenarios":{"type":"array","items":{"type":"object","additionalProperties":true}},"identity":{"type":"object","properties":{"issuer":{"type":"string"},"clientId":{"type":"string"}},"required":["issuer","clientId"]},"notice":{"type":"string"},"documentation":{"type":"object","properties":{"handbook":{"type":"string"},"explorer":{"type":"string"},"openapi":{"type":"string"}},"required":["handbook","explorer","openapi"]}},"required":["sites","workspaces","messaging","primaryCare","secondaryCare","wearables","apis","scenarios","identity","notice","documentation"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/telephony/live":{"get":{"operationId":"telephonyLive","tags":["Service workspaces"],"summary":"Join the team's live reception switchboard over WebSocket","security":[],"description":"Upgrade to WebSocket on the same origin. Within five seconds send TelephonyClientMessage kind authenticate with a GP-scoped team API key and receptionist name. Credentials never belong in the URL. The server assigns a memberId and broadcasts TelephonyServerMessage snapshots scoped to that world. Send command messages with unique requestId values; use the current call version for claims, hold, transfer, callback, end and end-and-next. Acknowledgements include requestId. Reuse a requestId only for the same command. Reconnect by authenticating again; calls held by a disconnected member return to the queue. Phone timestamps use wall-clock milliseconds, independent of simulation speed. HTTP clients without a WebSocket upgrade receive 426.","responses":{"101":{"description":"WebSocket connection established. Authentication required in first frame."},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"426":{"description":"WebSocket upgrade required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"openapiAlias","tags":["Discovery"],"summary":"Download the OpenAPI JSON (alias)","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/openapi.json":{"get":{"operationId":"openapi","tags":["Discovery"],"summary":"Download this OpenAPI 3.1 document as JSON","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/keys":{"post":{"operationId":"createTeam","tags":["Team"],"summary":"Create or join a team world by name","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"teamName":{"type":"string","description":"Lowercased with all whitespace removed before validation. The normalised name must contain 2–80 characters."},"site":{"type":"string","enum":["gp","hospital","community","pharmacy","diagnostics","referrals","wearables"]}},"required":["teamName"]},"examples":{"team":{"summary":"Create or join a team","value":{"teamName":"My integration team"}}}}}},"responses":{"201":{"description":"Team created or joined; copy apiKey","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Key"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"Legacy is browser-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Creates or joins a persistent world using a lowercase name with all whitespace removed. Anyone who knows the name can join its simulation world. Repeat requests return the same reusable key and world. Older hash-only teams receive a reusable key for their existing world; previous keys remain valid. Ambiguous historical names spanning multiple worlds return 409: use an existing key. Up to 5,000 distinct team worlds; existing teams can rejoin at capacity. No per-IP or time-based throttle. Omit site to create a team with all participant scopes. Rejoining preserves existing scopes. Legacy has no API key scope."}},"/api/team":{"get":{"operationId":"team","tags":["Team"],"summary":"Read the authenticated team and scopes","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/session":{"post":{"operationId":"createBrowserSession","tags":["Team"],"summary":"Create a one-hour browser integration session","security":[{"TeamKey":[]},{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Send a bearer token. Sets HttpOnly sim_session cookie for /browser/legacy. Cookie sessions are process-local and expire after one hour; the legacy form supplies its own CSRF field."}},"/api/clock":{"get":{"operationId":"readClock","tags":["Simulation time"],"summary":"Read time and up to 100 visible recent events","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Clock"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]},"post":{"operationId":"changeClock","tags":["Simulation time"],"summary":"Pause, change speed or advance the team world","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"paused":{"type":"boolean"},"speed":{"type":"number","minimum":0,"maximum":3600},"advanceMinutes":{"type":"number","minimum":0,"maximum":10080}},"required":[]},"examples":{"advance":{"summary":"Run delayed test results","value":{"paused":true,"advanceMinutes":121}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Clock"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"A real mutation of the current simulation world. Manual advance requires paused:true (set it in the same request if needed); otherwise 409. Advancing time executes due jobs. Clock events and visible action events are returned here; there is no separate event-stream endpoint."}},"/api/plan-lab":{"get":{"operationId":"retiredChallengeWorkbook","tags":["Discovery"],"summary":"Retired challenge workbook","security":[],"responses":{"410":{"description":"Retired; explore /control/ and service APIs","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"href":{"type":"string"}},"required":["error","href"]}}}}},"deprecated":true}},"/api/sites/{site}/view":{"get":{"operationId":"siteView","tags":["Service workspaces"],"summary":"Read scoped resources, events and simulation context","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/View"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"site","in":"path","required":true,"description":"Service scope. control requires an operator token. legacy is browser-only.","schema":{"type":"string","enum":["control","gp","hospital","community","pharmacy","diagnostics","referrals","wearables","patient"],"default":"gp"}},{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"offset","in":"query","required":false,"description":"Resource page offset.","schema":{"type":"integer","minimum":0,"default":0}},{"name":"limit","in":"query","required":false,"description":"Resource page size.","schema":{"type":"integer","minimum":1,"maximum":500,"default":500}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Patient portal uses the GP scope and removes staff-only conversation content. patient filtering includes shared service resources with no patient ID."}},"/api/sites/{site}/patients":{"get":{"operationId":"sitePatients","tags":["Service workspaces"],"summary":"Search the synthetic patient directory","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"items":{"type":"array","items":{"$ref":"#/components/schemas/Patient"}}},"required":["total","items"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"site","in":"path","required":true,"description":"Service scope. control requires an operator token. legacy is browser-only.","schema":{"type":"string","enum":["control","gp","hospital","community","pharmacy","diagnostics","referrals","wearables"],"default":"gp"}},{"name":"q","in":"query","required":false,"description":"Name, ID, condition, need or goal search; prefix/full-text matching.","schema":{"type":"string"}},{"name":"offset","in":"query","required":false,"description":"Offset; fixed page size 30.","schema":{"type":"integer","minimum":0,"default":0}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/sites/{site}/actions":{"post":{"operationId":"siteAction","tags":["Service workspaces"],"summary":"Execute a scoped clinical or operational action","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"},"examples":{"task":{"summary":"Create a GP or hospital task","value":{"type":"create_task","patientId":"SIM-000006","title":"Review synthetic discharge correspondence","text":"Check the simulation record and arrange follow-up."}},"connectDevice":{"summary":"Wearables: connect a synthetic activity watch for a patient","value":{"type":"connect_device","patientId":"SIM-000003"}},"consultation":{"summary":"Save a GP consultation","value":{"type":"save_consultation","patientId":"SIM-000006","title":"Synthetic telephone review","text":"Fictional review for integration testing.","consultationStatus":"saved"}},"problem":{"summary":"Add a GP problem","value":{"type":"save_problem","patientId":"SIM-000006","title":"Synthetic mobility concern","problemStatus":"active"}},"note":{"summary":"Save a hospital note draft (hospital)","value":{"type":"hospital_note","patientId":"SIM-000006","title":"Synthetic progress note","hospitalNoteCommand":{"kind":"save","template":"free-text","sections":[{"id":"clinical-note","heading":"Clinical note","text":"Fictional record for integration testing."}]}}},"bloodTest":{"summary":"Request a blood test (hospital or GP)","value":{"type":"order_test","patientId":"SIM-000006","title":"Full blood count","bloodTestOrder":{"panelId":"fbc","panel":"Full blood count","specimen":"EDTA blood","priority":"routine","collection":"now","clinicalDetails":"Synthetic follow-up request."}}},"supplierOrder":{"summary":"Pharmacy: order packs (replace quote ID/version; meet its minimumPacks)","value":{"type":"place_pharmacy_order","resourceId":"REPLACE_WITH_PHARMACY_QUOTE_ID","expectedVersion":1,"quantity":2}},"basketLine":{"summary":"Pharmacy: add offer to basket (replace basket/quote IDs and versions; packs must cover requiredUnits)","value":{"type":"update_pharmacy_basket","resourceId":"REPLACE_WITH_PHARMACY_BASKET_ID","expectedVersion":1,"quoteId":"REPLACE_WITH_PHARMACY_QUOTE_ID","quoteVersion":1,"quantity":2,"requiredUnits":1}},"checkout":{"summary":"Pharmacy: place all basket orders (replace basket ID/latest version; current offers required)","value":{"type":"checkout_pharmacy_basket","resourceId":"REPLACE_WITH_PHARMACY_BASKET_ID","expectedVersion":1}},"receiveOrder":{"summary":"Pharmacy: receive one pack after dueAt (replace purchase-order ID/latest version)","value":{"type":"receive_pharmacy_order","resourceId":"REPLACE_WITH_PHARMACY_ORDER_ID","expectedVersion":1,"quantity":1,"text":"Synthetic delivery reference DEMO-001"}},"pharmacyReferral":{"summary":"Create a fictional Pharmacy First referral (GP, hospital or pharmacy)","value":{"type":"receive_pharmacy_referral","patientId":"SIM-000006","title":"Synthetic sore throat referral","pharmacyPathway":"Sore throat","referralSource":"gp"}},"reviewDischarge":{"summary":"GP: review a sent discharge document (replace ID/latest version)","value":{"type":"process_document","resourceId":"REPLACE_WITH_SENT_DISCHARGE_SUMMARY_ID","expectedVersion":1,"documentCommand":"review","text":"Synthetic correspondence reviewed; follow-up actions recorded in the simulation."}},"fileDischarge":{"summary":"GP: file a reviewed discharge document (replace ID/latest version after review)","value":{"type":"process_document","resourceId":"REPLACE_WITH_REVIEWED_DISCHARGE_SUMMARY_ID","expectedVersion":1,"documentCommand":"file","text":"Filed to the synthetic patient record."}},"message":{"summary":"GP: start a simulated SMS conversation (queued; no real SMS sent)","value":{"type":"messaging_action","patientId":"SIM-000006","messagingCommand":{"kind":"create","subject":"Simulation follow-up","body":"This is a fictional practice message for integration testing.","channel":"sms","allowReply":true}}},"deliverMessage":{"summary":"GP: mark a queued message delivered (replace conversation ID/version and outgoing entry ID)","value":{"type":"messaging_action","resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":1,"messagingCommand":{"kind":"delivery","entryId":"REPLACE_WITH_OUTGOING_ENTRY_ID","status":"delivered"}}},"patientReply":{"summary":"patient site: reply after delivery (replace conversation ID/version; must belong to selected patient)","value":{"type":"messaging_action","patientId":"SIM-000006","resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":1,"messagingCommand":{"kind":"reply","body":"Synthetic patient reply for testing."}}},"prescriptionReview":{"summary":"GP: review a GP-issued prescription (replace ID and latest version)","value":{"type":"review","resourceId":"REPLACE_WITH_PRESCRIPTION_ID","expectedVersion":1}},"prescriptionApproval":{"summary":"GP: approve a reviewed GP-issued prescription (replace ID and latest version)","value":{"type":"accept","resourceId":"REPLACE_WITH_PRESCRIPTION_ID","expectedVersion":2}},"prescription":{"summary":"Issue a draft prescription from GP or hospital","value":{"type":"draft_prescription","patientId":"SIM-000006","title":"Synthetic medication order","medicationOrder":{"drug":"Example medicine","dose":"1","unit":"tablet","route":"Oral","frequency":"Once daily","duration":"7 days","quantity":7,"indication":"Fictional workflow testing; not a prescribing recommendation."}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"site","in":"path","required":true,"description":"Service scope. control requires an operator token. legacy is browser-only.","schema":{"type":"string","enum":["control","gp","hospital","community","pharmacy","diagnostics","referrals","wearables","patient"],"default":"gp"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Persists a change and records team attribution. Action permissions depend on site, resource visibility and current state; not every action type is valid at every site. For editing, use resourceId and the latest expectedVersion. Signed hospital notes accept addenda only. Clinical orders, discharge/document processing, pharmacy stock/supplier/basket operations, appointments and messaging all use this endpoint. See the complete Action schema. CIS2 tokens do not grant team API access."}},"/api/sites/gp/prescriptions":{"get":{"operationId":"primaryCarePrescriptions","tags":["Primary care"],"summary":"Retrieve prescriptions visible to primary care","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrimaryCarePrescriptionsPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Read-only endpoint; use GET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID; unknown patients return an empty page.","schema":{"type":"string","minLength":1,"example":"SIM-000001"}},{"name":"offset","in":"query","required":false,"description":"Matching prescriptions to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum prescriptions in this page.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires GP scope. Returns GP-visible prescriptions in your team's world, in storage order, with medication details, status, version and provenance. Issue through POST /api/sites/gp/actions using draft_prescription and patientId. Review using review, then approve using accept; send resourceId and the latest expectedVersion with both actions. GP approval is limited to prescriptions originally drafted by GP. Approval changes reviewed to approved. Pharmacy retains ownership and dispensing permissions. Use the actions endpoint's prescription, prescriptionReview and prescriptionApproval examples."}},"/api/sites/{site}/appointments":{"get":{"operationId":"siteAppointments","tags":["Service workspaces"],"summary":"Read a day of appointments and appointment sessions","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"appointments":{"type":"array","items":{"$ref":"#/components/schemas/Resource"}},"patients":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/Resource"}}},"required":["appointments","patients","sessions"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"site","in":"path","required":true,"description":"Service scope. control requires an operator token. legacy is browser-only.","schema":{"type":"string","enum":["control","gp","hospital","community","pharmacy","diagnostics","referrals","wearables"],"default":"gp"}},{"name":"date","in":"query","required":true,"description":"UTC calendar day; required and validated.","schema":{"type":"string","format":"date","example":"2026-09-12"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/sites/hospital/attendances":{"get":{"operationId":"hospital_attendances","tags":["Hospital"],"summary":"Read the hospital take, ED and inpatient list","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Mutations use the site actions endpoint; no separate CRUD endpoints are provided."}},"/api/sites/hospital/documents":{"get":{"operationId":"hospital_documents","tags":["Hospital"],"summary":"Read hospital discharge summaries","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Mutations use the site actions endpoint; no separate CRUD endpoints are provided."}},"/api/sites/gp/documents":{"get":{"operationId":"gp_documents","tags":["Primary care"],"summary":"Read discharge correspondence visible to GP","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Mutations use the site actions endpoint; no separate CRUD endpoints are provided."}},"/api/sites/pharmacy/pharmacy-workspace":{"get":{"operationId":"pharmacy_pharmacy_workspace","tags":["Pharmacy"],"summary":"Read prescriptions, referrals, products, stock movements, supplier quotes, orders and baskets","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Mutations use the site actions endpoint; no separate CRUD endpoints are provided."}},"/api/sites/gp/messaging-workspace":{"get":{"operationId":"gp_messaging_workspace","tags":["Messaging"],"summary":"Read practice conversations and message templates","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Mutations use the site actions endpoint; no separate CRUD endpoints are provided."}},"/api/sites/patient/messaging-workspace":{"get":{"operationId":"patient_messaging_workspace","tags":["Messaging"],"summary":"Read one patient's visible conversations","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patientId","in":"query","required":true,"description":"Exact synthetic patient ID.","schema":{"type":"string","example":"SIM-000006"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires GP scope. Staff-only entries and empty conversations are excluded."}},"/api/messaging/reply-presets":{"get":{"operationId":"patientReplyPresets","tags":["Messaging"],"summary":"List editable scripted patient reply presets","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"presets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"steps":{"type":"array","items":{"type":"object","properties":{"body":{"type":"string"},"delayMinutes":{"type":"number","minimum":0,"maximum":10080}},"required":["body","delayMinutes"]}}},"required":["id","title","steps"]}}},"required":["presets"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Administrative simulation text only. Copy a preset's steps into the practice configure_auto_reply command. Listing presets does not enable them or send messages."}},"/api/sites/gp/messages":{"get":{"operationId":"practiceMessages","tags":["Messaging"],"summary":"Read practice conversations","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationsPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patientId","in":"query","required":false,"description":"Exact synthetic patient ID.","schema":{"type":"string","minLength":1,"example":"SIM-000003"}},{"name":"offset","in":"query","required":false,"description":"Matching conversations to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum conversations in this page.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires GP scope. Team keys stay in their own world. Returns conversations in storage order. Patient reads omit internal notes, assignments, queued/failed outgoing messages and automation configuration. The team key permits role-playing synthetic patients; this is not patient identity authentication. Templates remain available through the practice messaging-workspace operation."},"post":{"operationId":"sendPracticeMessage","tags":["Messaging"],"summary":"Send practice messages and configure scripted patient replies","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PracticeMessageRequest"},"examples":{"create":{"summary":"Start a practice conversation","value":{"patientId":"SIM-000003","command":{"kind":"create","subject":"Appointment preference","body":"Would a morning or afternoon appointment suit you?","channel":"sms","allowReply":true}}},"send":{"summary":"Send another practice message","value":{"resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":1,"command":{"kind":"send","body":"Please confirm your preferred day.","channel":"sms"}}},"script":{"summary":"Configure a scripted patient response before delivery","value":{"resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":1,"command":{"kind":"configure_auto_reply","steps":[{"body":"An afternoon appointment would suit me, thank you.","delayMinutes":2}]}}},"deliver":{"summary":"Deliver a queued message and schedule its scripted reply","value":{"resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":2,"command":{"kind":"delivery","entryId":"REPLACE_WITH_OUTGOING_ENTRY_ID","status":"delivered"}}},"disable":{"summary":"Disable automation and cancel pending replies","value":{"resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":3,"command":{"kind":"configure_auto_reply","steps":[]}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires GP scope. Existing conversations/templates require resourceId and their latest expectedVersion. New conversations require patientId. Commands are validated by role. Mutations are attributed to the authenticated team; incoming/outgoing direction identifies the simulated role. Patient responses omit private practice information. Practice messages are queued until a delivery command marks them delivered. configure_auto_reply sets an ordered script for future successful deliveries: each delivered outgoing message consumes one step and schedules a reply after delayMinutes of simulation time. Configure before delivery, then POST /api/clock with paused:true and advanceMinutes. Reconfiguration resets the script and cancels pending replies; empty steps disable it. Manual patient replies and completing a conversation cancel pending replies without reusing consumed steps. Read the latest conversation version after clock changes. Existing generic messaging_action commands remain supported."}},"/api/sites/patient/messages":{"get":{"operationId":"patientMessages","tags":["Messaging"],"summary":"Read one patient's visible conversations","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationsPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patientId","in":"query","required":true,"description":"Exact synthetic patient ID.","schema":{"type":"string","minLength":1,"example":"SIM-000003"}},{"name":"offset","in":"query","required":false,"description":"Matching conversations to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum conversations in this page.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires GP scope. Team keys stay in their own world. Returns conversations in storage order. Patient reads omit internal notes, assignments, queued/failed outgoing messages and automation configuration. The team key permits role-playing synthetic patients; this is not patient identity authentication. Templates remain available through the practice messaging-workspace operation."},"post":{"operationId":"sendPatientMessage","tags":["Messaging"],"summary":"Start a patient conversation or send a patient reply","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientMessageRequest"},"examples":{"create":{"summary":"Patient starts a conversation with the practice","value":{"patientId":"SIM-000003","command":{"kind":"patient_create","subject":"Appointment request","body":"Could I arrange an afternoon appointment?","channel":"sms"}}},"reply":{"summary":"Patient replies to a delivered practice message","value":{"patientId":"SIM-000003","resourceId":"REPLACE_WITH_CONVERSATION_ID","expectedVersion":3,"command":{"kind":"reply","body":"Tuesday afternoon works for me."}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires GP scope. Existing conversations/templates require resourceId and their latest expectedVersion. New conversations require patientId. Commands are validated by role. Mutations are attributed to the authenticated team; incoming/outgoing direction identifies the simulated role. Patient responses omit private practice information. Practice messages are queued until a delivery command marks them delivered. configure_auto_reply sets an ordered script for future successful deliveries: each delivered outgoing message consumes one step and schedules a reply after delayMinutes of simulation time. Configure before delivery, then POST /api/clock with paused:true and advanceMinutes. Reconfiguration resets the script and cancels pending replies; empty steps disable it. Manual patient replies and completing a conversation cancel pending replies without reusing consumed steps. Read the latest conversation version after clock changes. Existing generic messaging_action commands remain supported."}},"/api/sites/wearables/devices":{"get":{"operationId":"wearableDevices","tags":["Wearables"],"summary":"List connected synthetic wearable devices","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WearableDevicesPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Read-only endpoint; use GET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID; unknown patients return an empty page.","schema":{"type":"string","minLength":1,"example":"SIM-000006"}},{"name":"offset","in":"query","required":false,"description":"Number of matching records to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum number of records to return.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires wearables scope. Returns stored synthetic records owned by and visible to wearables in your team's world, including data, versions and provenance. total counts all matching records before pagination. Records retain storage insertion order (not observation-time order); advance offset by the number of items returned until offset reaches total. Pausing simulation time avoids new readings appearing during pagination. No real devices or external health accounts are accessed. Device data includes available battery, quality, metric and lastSyncedAt fields; absent metadata is omitted. Connect a watch using POST /api/sites/wearables/actions with type connect_device and patientId."}},"/api/sites/wearables/readings":{"get":{"operationId":"wearableReadings","tags":["Wearables"],"summary":"Read stored wearable measurements and history","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WearableReadingsPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Read-only endpoint; use GET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID; unknown patients return an empty page.","schema":{"type":"string","minLength":1,"example":"SIM-000006"}},{"name":"offset","in":"query","required":false,"description":"Number of matching records to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum number of records to return.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}},{"name":"metric","in":"query","required":false,"description":"Exact metric filter. Seeded metrics include steps, heart-rate and sleep; unknown metrics return an empty page.","schema":{"type":"string","minLength":1,"example":"steps"}}],"description":"Requires wearables scope. Returns stored synthetic records owned by and visible to wearables in your team's world, including data, versions and provenance. total counts all matching records before pagination. Records retain storage insertion order (not observation-time order); advance offset by the number of items returned until offset reaches total. Pausing simulation time avoids new readings appearing during pagination. No real devices or external health accounts are accessed. data includes metric, value, unit, quality and observedAt (Unix milliseconds); baseline is present only when stored. A disconnected device produces quality=missing with value=null. Seeded history includes steps, heart rate and sleep; connected watches generate steps readings as simulation time advances. This API does not imply that the seeded glucose monitor has glucose measurements."}},"/api/sites/hospital/consultations":{"get":{"operationId":"secondaryCareConsultations","tags":["Secondary care"],"summary":"Read raw secondary care consultation records","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecondaryCareConsultationsPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Read-only endpoint; use GET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID; unknown patients return an empty page.","schema":{"type":"string","minLength":1,"example":"SIM-000006"}},{"name":"offset","in":"query","required":false,"description":"Number of matching records to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum number of records to return.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires hospital scope. Returns complete stored synthetic resources owned by and visible to hospital in your team's world without truncating or projecting their data or provenance. Exact patient filtering excludes records without that patient ID; unknown patients return an empty page. total counts matching records before pagination. Records retain storage insertion order; advance offset by items.length until reaching total. Pause simulation time for stable pagination. Includes hospital-note, clinical-note, consultation and encounter records owned by hospital. Preserves narrative text, sections, draft/signed status, signedBy, signedAt and addenda when stored. GP encounters, GP consultations and longitudinal GP EHR records are excluded. Discharge correspondence is available separately through /api/sites/hospital/documents. Hospital-note data follows HospitalNote."}},"/api/sites/hospital/genomes":{"get":{"operationId":"secondaryCareGenomes","tags":["Secondary care"],"summary":"Read raw secondary care genome records","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecondaryCareGenomesPage"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Read-only endpoint; use GET","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID; unknown patients return an empty page.","schema":{"type":"string","minLength":1,"example":"SIM-000006"}},{"name":"offset","in":"query","required":false,"description":"Number of matching records to skip.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0}},{"name":"limit","in":"query","required":false,"description":"Maximum number of records to return.","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Requires hospital scope. Returns complete stored synthetic resources owned by and visible to hospital in your team's world without truncating or projecting their data or provenance. Exact patient filtering excludes records without that patient ID; unknown patients return an empty page. total counts matching records before pagination. Records retain storage insertion order; advance offset by items.length until reaching total. Pause simulation time for stable pagination. Includes genome-record resources with synthetic CYP2C19 SNP calls for clopidogrel sensitivity. Returns the complete stored variant fields and provenance. These records are restricted to secondary care. Legacy genomic-test workflow/consent records are excluded because they do not contain raw variant calls. Synthetic fixtures are not clinical advice or full genome sequences."}},"/api/nhs/pds":{"get":{"operationId":"adapter_pds","tags":["NHS-shaped adapters"],"summary":"Personal Demographics Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"FHIR Patient search and read with local SIM identifiers. Requires gp scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/pds/actions":{"post":{"operationId":"adapter_pds_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Personal Demographics Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the gp site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/ods":{"get":{"operationId":"adapter_ods","tags":["NHS-shaped adapters"],"summary":"Organisation Data Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"FHIR Organization search and read for the fictional care network. Requires referrals scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/ods/actions":{"post":{"operationId":"adapter_ods_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Organisation Data Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the referrals site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/dos":{"get":{"operationId":"adapter_dos","tags":["NHS-shaped adapters"],"summary":"Directory of Services","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Service discovery and availability. Requires referrals scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/dos/actions":{"post":{"operationId":"adapter_dos_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Directory of Services","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the referrals site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/ers":{"get":{"operationId":"adapter_ers","tags":["NHS-shaped adapters"],"summary":"e-Referral Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Create, read, accept and reject referrals. Requires referrals scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/ers/actions":{"post":{"operationId":"adapter_ers_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through e-Referral Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the referrals site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/eps":{"get":{"operationId":"adapter_eps","tags":["NHS-shaped adapters"],"summary":"Electronic Prescription Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Draft, approve, dispense and collect. Requires pharmacy scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/eps/actions":{"post":{"operationId":"adapter_eps_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Electronic Prescription Service","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the pharmacy site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/eps-tracker":{"get":{"operationId":"adapter_eps_tracker","tags":["NHS-shaped adapters"],"summary":"Electronic Prescription Tracker","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Read prescription lifecycle. Requires pharmacy scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/eps-tracker/actions":{"post":{"operationId":"adapter_eps_tracker_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Electronic Prescription Tracker","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the pharmacy site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/gp-connect":{"get":{"operationId":"adapter_gp_connect","tags":["NHS-shaped adapters"],"summary":"GP Connect task adapter","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Local primary-care task projection. Requires gp scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/gp-connect/actions":{"post":{"operationId":"adapter_gp_connect_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through GP Connect task adapter","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the gp site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/mesh":{"get":{"operationId":"adapter_mesh","tags":["NHS-shaped adapters"],"summary":"MESH message adapter","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Simplified JSON mailbox; not real MESH protocol. Requires gp scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/mesh/actions":{"post":{"operationId":"adapter_mesh_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through MESH message adapter","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the gp site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/scr":{"get":{"operationId":"adapter_scr","tags":["NHS-shaped adapters"],"summary":"Shared Care Documents","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Visible shared documents only. Requires gp scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/scr/actions":{"post":{"operationId":"adapter_scr_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Shared Care Documents","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the gp site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/pathology":{"get":{"operationId":"adapter_pathology","tags":["NHS-shaped adapters"],"summary":"Pathology results","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delayed laboratory results. Requires diagnostics scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/pathology/actions":{"post":{"operationId":"adapter_pathology_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Pathology results","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the diagnostics site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/radiology":{"get":{"operationId":"adapter_radiology","tags":["NHS-shaped adapters"],"summary":"Radiology reports","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Synthetic report metadata; no DICOM server. Requires diagnostics scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/radiology/actions":{"post":{"operationId":"adapter_radiology_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Radiology reports","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the diagnostics site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/appointments":{"get":{"operationId":"adapter_appointments","tags":["NHS-shaped adapters"],"summary":"Appointments","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"patient","in":"query","required":false,"description":"Exact synthetic patient ID. Site view also includes service resources without a patient.","schema":{"type":"string","example":"SIM-000006"}},{"name":"q","in":"query","required":false,"description":"Alias for patient. PDS searches demographics; most other adapters filter exact patient ID. ODS/DoS return their fixed fictional directory.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Capacity-backed booking. Requires gp scope. Simplified JSON projection, not a certified NHS API or full FHIR implementation. At most 100 workflow resources are returned; total may be larger. PDS/ODS FHIR search/read routes are documented separately."}},"/api/nhs/appointments/actions":{"post":{"operationId":"adapter_appointments_action","tags":["NHS-shaped adapters"],"summary":"Submit an action through Appointments","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Stable unique value for retries of the same action. Reuse it after an uncertain response; use a new value for a new action. Takes precedence over body clientRequestId.","schema":{"type":"string"}},{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"Delegates to the gp site action engine with that scope and its existing permissions. This is the simulator's action envelope, not the production NHS API's write protocol."}},"/api/nhs/pds/metadata":{"get":{"operationId":"pdsCapability","tags":["FHIR read-only subsets"],"summary":"Patient capability statement","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Synthetic FHIR-shaped result","content":{"application/fhir+json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"401":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"403":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"404":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"405":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}}},"description":"Local subset capabilities. Requires gp scope. No query parameters are accepted, including world."}},"/api/nhs/pds/Patient":{"get":{"operationId":"pdsSearch","tags":["FHIR read-only subsets"],"summary":"Search synthetic Patient records","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Synthetic FHIR-shaped result","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"401":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"403":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"404":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"405":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}}},"description":"Read-only FHIR R4-shaped subset; requires gp scope. Uses local SIM identifiers, not NHS numbers/ODS codes. No NHS profile validation, fuzzy tracing, record updates or real network access. Unsupported, repeated or empty query parameters return 400.","parameters":[{"name":"family","in":"query","required":false,"description":"Case-insensitive family-name prefix.","schema":{"type":"string"}},{"name":"given","in":"query","required":false,"description":"Case-insensitive given-name prefix.","schema":{"type":"string"}},{"name":"birthdate","in":"query","required":false,"description":"Exact valid date; no FHIR date prefixes.","schema":{"type":"string","format":"date"}},{"name":"identifier","in":"query","required":false,"description":"Exact value or system|value. Patient system https://nhs-sim.example/identifier/patient; organisation system https://nhs-sim.example/identifier/organisation.","schema":{"type":"string"}},{"name":"_count","in":"query","required":false,"description":"Page size.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"_offset","in":"query","required":false,"description":"Local offset extension; not a production API claim.","schema":{"type":"integer","minimum":0,"default":0}}]}},"/api/nhs/pds/Patient/{id}":{"get":{"operationId":"pdsRead","tags":["FHIR read-only subsets"],"summary":"Read one synthetic Patient","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Synthetic FHIR-shaped result","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/FhirPatient"}}}},"400":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"401":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"403":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"404":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"405":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}}},"description":"Read-only FHIR R4-shaped subset; requires gp scope. Uses local SIM identifiers, not NHS numbers/ODS codes. No NHS profile validation, fuzzy tracing, record updates or real network access. Unsupported, repeated or empty query parameters return 400.","parameters":[{"name":"id","in":"path","required":true,"description":"Local identifier. Read accepts no query parameters.","schema":{"type":"string","pattern":"^SIM-\\d{6}$","example":"SIM-000006"}}]}},"/api/nhs/ods/metadata":{"get":{"operationId":"odsCapability","tags":["FHIR read-only subsets"],"summary":"Organization capability statement","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Synthetic FHIR-shaped result","content":{"application/fhir+json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"401":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"403":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"404":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"405":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}}},"description":"Local subset capabilities. Requires referrals scope. No query parameters are accepted, including world."}},"/api/nhs/ods/Organization":{"get":{"operationId":"odsSearch","tags":["FHIR read-only subsets"],"summary":"Search synthetic Organization records","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Synthetic FHIR-shaped result","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/Bundle"}}}},"400":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"401":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"403":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"404":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"405":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}}},"description":"Read-only FHIR R4-shaped subset; requires referrals scope. Uses local SIM identifiers, not NHS numbers/ODS codes. No NHS profile validation, fuzzy tracing, record updates or real network access. Unsupported, repeated or empty query parameters return 400.","parameters":[{"name":"name","in":"query","required":false,"description":"Case-insensitive organisation-name prefix.","schema":{"type":"string"}},{"name":"active","in":"query","required":false,"description":"All synthetic organisations are active; false returns none.","schema":{"type":"string","enum":["true","false"]}},{"name":"identifier","in":"query","required":false,"description":"Exact value or system|value. Patient system https://nhs-sim.example/identifier/patient; organisation system https://nhs-sim.example/identifier/organisation.","schema":{"type":"string"}},{"name":"_count","in":"query","required":false,"description":"Page size.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"_offset","in":"query","required":false,"description":"Local offset extension; not a production API claim.","schema":{"type":"integer","minimum":0,"default":0}}]}},"/api/nhs/ods/Organization/{id}":{"get":{"operationId":"odsRead","tags":["FHIR read-only subsets"],"summary":"Read one synthetic Organization","security":[{"TeamKey":[]},{"OperatorKey":[]},{"BrowserSession":[]}],"responses":{"200":{"description":"Synthetic FHIR-shaped result","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/FhirOrganization"}}}},"400":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"401":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"403":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"404":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}},"405":{"description":"FHIR-shaped error response","content":{"application/fhir+json":{"schema":{"$ref":"#/components/schemas/OperationOutcome"}}}}},"description":"Read-only FHIR R4-shaped subset; requires referrals scope. Uses local SIM identifiers, not NHS numbers/ODS codes. No NHS profile validation, fuzzy tracing, record updates or real network access. Unsupported, repeated or empty query parameters return 400.","parameters":[{"name":"id","in":"path","required":true,"description":"Local identifier. Read accepts no query parameters.","schema":{"type":"string","pattern":"^SIM-[A-Z]+$","example":"SIM-RIVERSIDE"}}]}},"/api/control/worlds":{"get":{"operationId":"worlds","tags":["Operator"],"summary":"List simulation world IDs","security":[{"OperatorKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/control/teams":{"get":{"operationId":"operatorTeams","tags":["Operator"],"summary":"List teams and activity summaries","security":[{"OperatorKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"teams":{"type":"array","items":{"$ref":"#/components/schemas/OperatorTeam"}},"logging":{"$ref":"#/components/schemas/OperatorLogging"}},"required":["teams","logging"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Lists registered team worlds by name, without API keys. The default seed world is not a team. Request counts refer to retained authenticated team calls; affected patients are derived from team-attributed record changes."}},"/api/control/teams/{world}":{"delete":{"operationId":"operatorDeleteTeam","tags":["Operator"],"summary":"Permanently delete a team and revoke all its keys","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmTeamName":{"type":"string"}},"required":["confirmTeamName"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"const":true},"world":{"type":"string"},"teamName":{"type":"string"}},"required":["deleted","world","teamName"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"path","required":true,"description":"Exact world value returned by GET /api/control/teams.","schema":{"type":"string"}}],"description":"Requires the exact canonical teamName shown in the team directory. Removes the selected team's world, records, events, receipts and request history, and revokes every key for that world. Shared population baselines and other teams are preserved. Confirmation mismatch returns 409; default and unknown worlds return 404. Reusing the name after deletion creates a fresh world."}},"/api/control/teams/delete":{"post":{"operationId":"operatorBulkDeleteTeams","tags":["Operator"],"summary":"Permanently delete selected teams in one transaction","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"teams":{"type":"array","minItems":1,"maxItems":5000,"items":{"type":"object","properties":{"world":{"type":"string"},"confirmTeamName":{"type":"string"}},"required":["world","confirmTeamName"]}}},"required":["teams"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"const":true},"teams":{"type":"array","items":{"type":"object","properties":{"world":{"type":"string"},"teamName":{"type":"string"}},"required":["world","teamName"]}}},"required":["deleted","teams"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Submit the world IDs and canonical names reviewed in the confirmation. The UI supplies names automatically; no manual typing is required. Validates every team before deleting any. Missing, renamed or duplicate targets reject the entire request. Revokes all selected team keys and removes their worlds and request history. Shared baselines and unselected teams remain intact."}},"/api/control/incidents/all":{"post":{"operationId":"operatorAllTeamIncident","tags":["Operator"],"summary":"Introduce or restore an incident across all current teams","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","enum":["pathology-outage","staff-shortage","robot-failure","demand-surge","wearable-disconnect","winter-pressure","pharmacy-shortage","cyber-readonly"]},"enabled":{"type":"boolean"},"expectedWorlds":{"type":"array","items":{"type":"string"}}},"required":["id","enabled","expectedWorlds"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"affectedTeams":{"type":"integer"},"worlds":{"type":"array","items":{"type":"string"}}},"required":["id","enabled","affectedTeams","worlds"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"expectedWorlds must match the current registered team worlds returned by GET /api/control/teams; otherwise 409 with no changes. Applies atomically to all reviewed teams. Excludes the default seed world and future teams. Restoring a service clears the incident but does not undo generated work such as demand-surge requests."}},"/api/control/teams/{world}/activity":{"get":{"operationId":"operatorTeamActivity","tags":["Operator"],"summary":"Inspect a team's requests, affected patients and record changes","security":[{"OperatorKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorActivity"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"path","required":true,"description":"Exact world value returned by GET /api/control/teams.","schema":{"type":"string"}}],"description":"Includes successful and failed authenticated team requests. Request timestamps use wall time; record changes and events use simulation time. Retains up to 2,000 requests per world for seven days. Credentials, query strings and request bodies are omitted. Logging starts at deployment; historical requests cannot be reconstructed. Existing team-attributed record changes remain inspectable."}},"/api/control/teams/{world}/session":{"post":{"operationId":"operatorExploreTeam","tags":["Operator"],"summary":"Connect as an existing team to explore its world","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Key"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"path","required":true,"description":"Exact world value returned by GET /api/control/teams.","schema":{"type":"string"}}],"description":"Returns an existing or newly recoverable team key without resetting the world. Preserves the team's participant scopes. Further calls with this key act as the team and record its attribution. Treat apiKey as a credential; do not place it in URLs or logs."}},"/api/control/snapshot":{"get":{"operationId":"snapshot","tags":["Operator"],"summary":"Read the full world and event history","security":[{"OperatorKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"world":{"type":"object","additionalProperties":true},"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}},"required":["world","events"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}],"description":"May be large for a published population. Prefer paged site views for participant applications."}},"/api/control/incidents":{"post":{"operationId":"setIncident","tags":["Operator"],"summary":"Enable or disable a simulation incident","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","enum":["pathology-outage","staff-shortage","robot-failure","demand-surge","wearable-disconnect","winter-pressure","pharmacy-shortage","cyber-readonly"]},"enabled":{"type":"boolean"}},"required":["id","enabled"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/control/agents":{"post":{"operationId":"setAgent","tags":["Operator"],"summary":"Enable or disable a simulation agent","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","enabled"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","enabled"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/control/model-propose":{"post":{"operationId":"proposeModelActions","tags":["Operator"],"summary":"Request model action proposals without executing them","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"proposals":{"type":"array","items":{"type":"object","additionalProperties":true}},"note":{"type":"string"}},"required":["proposals","note"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/control/population":{"post":{"operationId":"generatePopulation","tags":["Operator"],"summary":"Add one deterministic population batch","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"integer","minimum":8,"maximum":50000},"batchSize":{"type":"integer","minimum":1,"maximum":1000,"default":500}},"required":["target"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"world":{"type":"string"},"population":{"type":"integer"},"resources":{"type":"integer"},"target":{"type":"integer"},"complete":{"type":"boolean"},"generator":{"type":"string"}},"required":["world","population","resources","target","complete","generator"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/control/population/publish":{"post":{"operationId":"publishPopulation","tags":["Operator"],"summary":"Publish this world's population as a baseline","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"world":{"type":"string"},"published":{"type":"boolean"}},"required":["world","published"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/control/population/attach":{"post":{"operationId":"attachPopulation","tags":["Operator"],"summary":"Attach a published source population to this world","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","default":"default"}},"required":[]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"world":{"type":"string"},"population":{"type":"integer"}},"required":["world","population"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"world","in":"query","required":false,"description":"Operator only: world to inspect or mutate. Team keys always use their own world.","schema":{"type":"string","default":"default"}}]}},"/api/operator/cis2":{"get":{"operationId":"cis2Configuration","tags":["Staff Identity"],"summary":"Read identity simulator settings and active counts","security":[{"OperatorKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Cis2Configuration"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"operationId":"configureCis2","tags":["Staff Identity"],"summary":"Replace identity settings and revoke existing sessions","security":[{"OperatorKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Cis2Settings"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Cis2Configuration"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Requires the operator bearer header, not a browser session. Settings are process-local; restart restores defaults. Client IDs and redirect URIs must be unique. Redirects must use HTTPS or localhost HTTP, with no credentials or fragment."},"delete":{"operationId":"revokeCis2","tags":["Staff Identity"],"summary":"Revoke all codes, interactions and identity tokens","security":[{"OperatorKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Cis2Configuration"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/cis2/.well-known/openid-configuration":{"get":{"operationId":"oidcDiscovery","tags":["Staff Identity"],"summary":"Read OpenID Connect discovery metadata","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/cis2/jwks":{"get":{"operationId":"oidcJwks","tags":["Staff Identity"],"summary":"Read the current RS256 public signing key","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["keys"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/cis2/session":{"get":{"operationId":"staffSession","tags":["Staff Identity"],"summary":"Read the browser's simulated staff identity","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"anyOf":[{"$ref":"#/components/schemas/StaffIdentity"},{"type":"null"}]}},"required":["identity"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Reads HttpOnly cis2_staff cookie scoped to /cis2/. Returns identity:null when absent or expired; team API keys are unrelated."}},"/cis2/userinfo":{"get":{"operationId":"oidcUserinfo","tags":["Staff Identity"],"summary":"Read claims for a simulated identity access token","security":[{"CIS2AccessToken":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffIdentity"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/cis2/authorize":{"get":{"operationId":"oidcAuthorize","tags":["Staff Identity"],"summary":"Begin browser authorization and choose fictional staff/role","security":[],"responses":{"200":{"description":"HTML consent form; open in a browser to continue","content":{"text/html":{"schema":{"type":"string"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"client_id","in":"query","required":true,"description":"Registered client ID.","schema":{"type":"string","example":"nhs-sim-client"}},{"name":"redirect_uri","in":"query","required":true,"description":"Exact registered callback URL.","schema":{"type":"string","format":"uri"}},{"name":"response_type","in":"query","required":true,"description":"Authorization code only.","schema":{"const":"code"}},{"name":"scope","in":"query","required":false,"description":"openid required; only openid/profile supported.","schema":{"type":"string","default":"openid profile"}},{"name":"code_challenge","in":"query","required":true,"description":"Base64url SHA256 hash of your verifier.","schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},{"name":"code_challenge_method","in":"query","required":true,"description":"S256 only.","schema":{"const":"S256"}},{"name":"state","in":"query","required":true,"description":"Client state; check at callback.","schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"nonce","in":"query","required":true,"description":"Nonce included in ID token.","schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"signin_method","in":"query","required":false,"description":"Presentation only; no physical credential is accessed.","schema":{"enum":["smartcard","security-key"]}}],"description":"Use a browser for consent, not a background HTTP client. Sets cis2_interaction cookie and displays CSRF-protected staff selection. /cis2/ provides a working demonstration; /cis2/callback completes it."},"post":{"operationId":"oidcConsent","tags":["Staff Identity"],"summary":"Complete the browser consent interaction","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"interaction":{"type":"string"},"csrf":{"type":"string"},"identity":{"type":"string"},"assignment":{"type":"string"},"action":{"enum":["continue","cancel"]}},"required":["interaction","csrf","identity","assignment","action"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"redirect":{"type":"string"}},"required":["redirect"]}}}},"303":{"description":"Redirect to registered callback with code/state or an error","headers":{"Location":{"schema":{"type":"string"}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"Accept","in":"header","required":false,"description":"Use application/json to receive redirect JSON; otherwise returns HTTP 303.","schema":{"type":"string","default":"application/json"}}],"description":"Requires the matching cis2_interaction browser cookie and hidden fields from the HTML authorization form. Do not fabricate these values. One-use authorization codes expire after two minutes."}},"/cis2/token":{"post":{"operationId":"oidcToken","tags":["Staff Identity"],"summary":"Exchange a one-use authorization code with PKCE","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"grant_type":{"const":"authorization_code"},"client_id":{"type":"string"},"redirect_uri":{"type":"string","format":"uri"},"code":{"type":"string"},"code_verifier":{"type":"string","pattern":"^[A-Za-z0-9._~-]{43,128}$"}},"required":["grant_type","client_id","redirect_uri","code","code_verifier"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"id_token":{"type":"string"},"token_type":{"const":"Bearer"},"expires_in":{"type":"integer"},"scope":{"type":"string"}},"required":["access_token","id_token","token_type","expires_in","scope"]}}}},"400":{"description":"Invalid input or unsupported workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Scope, origin or operator restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Stale version, invalid transition or unavailable capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request exceeds this operation's body-size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Deployment has reached its 5,000-team capacity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal simulation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Public client; no client secret or refresh token. Wrong verifier consumes the code. Returns opaque access token plus RS256 ID token and sets a staff-session cookie. Tokens cannot authenticate service APIs."}}},"components":{"securitySchemes":{"TeamKey":{"type":"http","scheme":"bearer","description":"apiKey returned by POST /api/keys; scoped to one team world."},"OperatorKey":{"type":"http","scheme":"bearer","description":"Deployment OPERATOR_TOKEN, for organisers only."},"BrowserSession":{"type":"apiKey","in":"cookie","name":"sim_session","description":"HttpOnly session established by POST /api/session; browsers manage it."},"CIS2AccessToken":{"type":"http","scheme":"bearer","description":"Opaque access_token from /cis2/token; identity userinfo only, not a team key."}},"schemas":{"PrimaryCarePrescriptionsPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Resource"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"}},"required":["items","total","offset","limit"]},"GenomeRecordData":{"type":"object","properties":{"synthetic":{"type":"boolean","const":true},"careSetting":{"type":"string","const":"secondary-care"},"gene":{"type":"string","const":"CYP2C19"},"medication":{"type":"string","const":"clopidogrel"},"assay":{"type":"string","const":"targeted-SNP-panel"},"profileVersion":{"type":"string","const":"synthetic-cyp2c19-v1"},"source":{"type":"string","const":"Authored synthetic SNP calls; not a clinical laboratory result"},"variantReference":{"type":"string","const":"https://www.pharmvar.org/gene/cyp2c19"},"phasing":{"type":"string","const":"unphased"},"variants":{"type":"array","prefixItems":[{"type":"object","properties":{"rsid":{"type":"string","const":"rs4244285"},"reference":{"type":"string","const":"G"},"alternate":{"type":"string","const":"A"},"genotype":{"type":"string","enum":["G/G","G/A","A/A"]}},"required":["rsid","reference","alternate","genotype"]},{"type":"object","properties":{"rsid":{"type":"string","const":"rs4986893"},"reference":{"type":"string","const":"G"},"alternate":{"type":"string","const":"A"},"genotype":{"type":"string","enum":["G/G","G/A","A/A"]}},"required":["rsid","reference","alternate","genotype"]},{"type":"object","properties":{"rsid":{"type":"string","const":"rs12248560"},"reference":{"type":"string","const":"C"},"alternate":{"type":"string","const":"T"},"genotype":{"type":"string","enum":["C/C","C/T","T/T"]}},"required":["rsid","reference","alternate","genotype"]}],"items":false,"minItems":3,"maxItems":3}},"required":["synthetic","careSetting","gene","medication","assay","profileVersion","source","variantReference","phasing","variants"]},"SecondaryCareConsultation":{"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","properties":{"kind":{"enum":["hospital-note","clinical-note","consultation","encounter"]},"owner":{"const":"hospital"}},"required":["kind","owner"]}]},"SecondaryCareGenome":{"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","properties":{"kind":{"const":"genome-record"},"owner":{"const":"hospital"},"data":{"$ref":"#/components/schemas/GenomeRecordData"}},"required":["kind","owner","data"]}]},"SecondaryCareConsultationsPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/SecondaryCareConsultation"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["items","total","offset","limit","now"]},"SecondaryCareGenomesPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/SecondaryCareGenome"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["items","total","offset","limit","now"]},"PracticeMessageRequest":{"type":"object","properties":{"resourceId":{"type":"string","minLength":1},"expectedVersion":{"type":"integer","minimum":1,"maximum":9007199254740991},"patientId":{"type":"string","minLength":1},"command":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"create"},"subject":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]},"allowReply":{"type":"boolean"}},"required":["kind","subject","body","channel","allowReply"]},{"type":"object","properties":{"kind":{"type":"string","const":"send"},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]}},"required":["kind","body","channel"]},{"type":"object","properties":{"kind":{"type":"string","const":"configure_auto_reply"},"steps":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000},"delayMinutes":{"type":"number","minimum":0,"maximum":10080}},"required":["body","delayMinutes"]}}},"required":["kind","steps"]},{"type":"object","properties":{"kind":{"type":"string","const":"note"},"body":{"type":"string","minLength":1,"maxLength":5000}},"required":["kind","body"]},{"type":"object","properties":{"kind":{"type":"string","const":"assign"},"assignee":{"type":"string","maxLength":120}},"required":["kind","assignee"]},{"type":"object","properties":{"kind":{"type":"string","const":"complete"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"reopen"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"delivery"},"entryId":{"type":"string"},"status":{"type":"string","enum":["delivered","failed"]}},"required":["kind","entryId","status"]},{"type":"object","properties":{"kind":{"type":"string","const":"retry"},"entryId":{"type":"string"}},"required":["kind","entryId"]},{"type":"object","properties":{"kind":{"type":"string","const":"save_template"},"title":{"type":"string","minLength":1,"maxLength":120},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]}},"required":["kind","title","body","channel"]},{"type":"object","properties":{"kind":{"type":"string","const":"archive_template"}},"required":["kind"]}]}},"required":["command"],"additionalProperties":false},"PatientMessageRequest":{"type":"object","properties":{"resourceId":{"type":"string","minLength":1},"expectedVersion":{"type":"integer","minimum":1,"maximum":9007199254740991},"patientId":{"type":"string","minLength":1},"command":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"patient_create"},"subject":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]}},"required":["kind","subject","body","channel"]},{"type":"object","properties":{"kind":{"type":"string","const":"reply"},"body":{"type":"string","minLength":1,"maxLength":5000}},"required":["kind","body"]}]}},"required":["patientId","command"],"additionalProperties":false},"ConversationData":{"type":"object","properties":{"assignee":{"type":"string"},"allowReply":{"type":"boolean"},"entries":{"minItems":1,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string","minLength":1,"maxLength":5000},"at":{"type":"number"},"actor":{"type":"object","properties":{"kind":{"type":"string","enum":["team","operator","simulation"]},"name":{"type":"string"}},"required":["kind","name"]},"direction":{"type":"string","const":"outgoing"},"channel":{"type":"string","enum":["sms","email"]},"delivery":{"minItems":1,"type":"array","items":{"type":"object","properties":{"status":{"type":"string","enum":["queued","delivered","failed"]},"at":{"type":"number"},"actor":{"type":"object","properties":{"kind":{"type":"string","enum":["team","operator","simulation"]},"name":{"type":"string"}},"required":["kind","name"]}},"required":["status","at","actor"]}}},"required":["id","body","at","actor","direction","channel","delivery"]},{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string","minLength":1,"maxLength":5000},"at":{"type":"number"},"actor":{"type":"object","properties":{"kind":{"type":"string","enum":["team","operator","simulation"]},"name":{"type":"string"}},"required":["kind","name"]},"direction":{"type":"string","const":"incoming"},"channel":{"type":"string","enum":["sms","email"]}},"required":["id","body","at","actor","direction","channel"]},{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string","minLength":1,"maxLength":5000},"at":{"type":"number"},"actor":{"type":"object","properties":{"kind":{"type":"string","enum":["team","operator","simulation"]},"name":{"type":"string"}},"required":["kind","name"]},"direction":{"type":"string","const":"internal"}},"required":["id","body","at","actor","direction"]}]}},"autoReply":{"type":"object","properties":{"steps":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000},"delayMinutes":{"type":"number","minimum":0,"maximum":10080}},"required":["body","delayMinutes"]}},"nextStep":{"type":"integer","minimum":0,"maximum":9007199254740991},"pending":{"type":"array","items":{"type":"object","properties":{"entryId":{"type":"string"},"stepIndex":{"type":"integer","minimum":0,"maximum":9007199254740991},"at":{"type":"number"}},"required":["entryId","stepIndex","at"]}}},"required":["steps","nextStep","pending"]}},"required":["assignee","allowReply","entries"]},"Conversation":{"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","properties":{"kind":{"const":"conversation"},"owner":{"const":"gp"},"data":{"$ref":"#/components/schemas/ConversationData"}},"required":["kind","owner","data"]}]},"ConversationsPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["items","total","offset","limit","now"]},"WearableDeviceData":{"type":"object","properties":{"battery":{"type":"number"},"quality":{"type":"string"},"metric":{"type":"string"},"lastSyncedAt":{"type":"number"}},"additionalProperties":{}},"WearableReadingData":{"type":"object","properties":{"metric":{"type":"string"},"value":{"type":["number","null"]},"unit":{"type":"string"},"quality":{"type":"string"},"observedAt":{"type":"number"},"baseline":{"type":"number"}},"required":["metric","value","unit","quality","observedAt"],"additionalProperties":{}},"WearableDevice":{"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","properties":{"kind":{"const":"device"},"owner":{"const":"wearables"},"data":{"$ref":"#/components/schemas/WearableDeviceData"}},"required":["kind","owner","data"]}]},"WearableReading":{"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","properties":{"kind":{"const":"observation"},"owner":{"const":"wearables"},"data":{"$ref":"#/components/schemas/WearableReadingData"}},"required":["kind","owner","data"]}]},"WearableDevicesPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WearableDevice"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["items","total","offset","limit","now"]},"WearableReadingsPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WearableReading"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["items","total","offset","limit","now"]},"TelephonyClientMessage":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"authenticate"},"apiKey":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":60}},"required":["kind","apiKey","name"]},{"type":"object","properties":{"kind":{"type":"string","const":"command"},"requestId":{"type":"string","minLength":1,"maxLength":100},"command":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"answer"},"callId":{"type":"string"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","callId","version"]},{"type":"object","properties":{"kind":{"type":"string","const":"next"},"callId":{"type":["string","null"]},"version":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"note":{"default":"","type":"string","maxLength":2000}},"required":["kind","callId","version"]},{"type":"object","properties":{"kind":{"type":"string","const":"end"},"callId":{"type":"string"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"note":{"default":"","type":"string","maxLength":2000}},"required":["kind","callId","version"]},{"type":"object","properties":{"kind":{"type":"string","const":"callback"},"callId":{"type":"string"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"note":{"default":"","type":"string","maxLength":2000}},"required":["kind","callId","version"]},{"type":"object","properties":{"kind":{"type":"string","const":"hold"},"callId":{"type":"string"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"held":{"type":"boolean"}},"required":["kind","callId","version","held"]},{"type":"object","properties":{"kind":{"type":"string","const":"transfer"},"callId":{"type":"string"},"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"targetMemberId":{"type":"string"}},"required":["kind","callId","version","targetMemberId"]},{"type":"object","properties":{"kind":{"type":"string","const":"availability"},"available":{"type":"boolean"}},"required":["kind","available"]},{"type":"object","properties":{"kind":{"type":"string","const":"rename"},"name":{"type":"string","minLength":1,"maxLength":60}},"required":["kind","name"]}]}},"required":["kind","requestId","command"]}]},"TelephonyServerMessage":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"snapshot"},"memberId":{"type":"string"},"revision":{"type":"number"},"calls":{"type":"array","items":{"type":"object","properties":{"patientName":{"type":"string"},"phone":{"type":"string"},"reason":{"type":"string"},"script":{"type":"string"},"voiceSeed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"waiting"},"queuedAt":{"type":"number"}},"required":["kind","queuedAt"]},{"type":"object","properties":{"kind":{"type":"string","const":"active"},"memberId":{"type":"string"},"answeredBy":{"type":"string","minLength":1,"maxLength":60},"answeredAt":{"type":"number"},"held":{"type":"boolean"}},"required":["kind","memberId","answeredBy","answeredAt","held"]},{"type":"object","properties":{"kind":{"type":"string","const":"completed"},"answeredBy":{"type":"string","minLength":1,"maxLength":60},"answeredAt":{"type":"number"},"endedAt":{"type":"number"},"note":{"type":"string"},"outcome":{"type":"string","enum":["completed","callback"]}},"required":["kind","answeredBy","answeredAt","endedAt","note","outcome"]}]},"id":{"type":"string"},"patientId":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["patientName","phone","reason","script","voiceSeed","state","id","patientId","version"]}},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":60},"status":{"type":"string","enum":["available","away","on-call"]},"callId":{"type":["string","null"]}},"required":["id","name","status","callId"]}},"requestId":{"type":"string"}},"required":["kind","memberId","revision","calls","members"]},{"type":"object","properties":{"kind":{"type":"string","const":"error"},"requestId":{"type":"string"},"message":{"type":"string"}},"required":["kind","message"]}]},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]},"Action":{"type":"object","properties":{"type":{"type":"string","enum":["hospital_note","save_discharge_summary","process_document","messaging_action","place_pharmacy_order","update_pharmacy_basket","remove_pharmacy_basket_line","checkout_pharmacy_basket","cancel_pharmacy_order","receive_pharmacy_order","receive_pharmacy_referral","update_pharmacy_referral","receive_stock","update_stock_price","link_prescription_stock","register_attendance","update_attendance","connect_device","create_task","create_referral","order_test","draft_prescription","book_appointment","create_appointment_session","set_appointment_slot","arrive_appointment","cancel_appointment","save_consultation","save_problem","save_allergy","send_message","schedule_visit","dispatch_robot","review","accept","complete","reject","dispense","collect","share_record","report_absence","restore_staff","allocate_shift"]},"clientRequestId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"hospitalNoteCommand":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"save"},"template":{"type":"string","enum":["free-text","history-physical","progress"]},"sections":{"minItems":1,"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"heading":{"type":"string","minLength":1,"maxLength":120},"text":{"type":"string","maxLength":20000}},"required":["id","heading","text"]}}},"required":["kind","template","sections"]},{"type":"object","properties":{"kind":{"type":"string","const":"sign"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"addendum"},"text":{"type":"string","minLength":1,"maxLength":20000}},"required":["kind","text"]}]},"medicationOrder":{"type":"object","properties":{"drug":{"type":"string","minLength":1,"maxLength":500},"dose":{"type":"string","minLength":1,"maxLength":500},"unit":{"type":"string","minLength":1,"maxLength":500},"route":{"type":"string","minLength":1,"maxLength":500},"frequency":{"type":"string","minLength":1,"maxLength":500},"duration":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"integer","minimum":1,"maximum":100000},"indication":{"type":"string","minLength":1,"maxLength":2000}},"required":["drug","dose","unit","route","frequency","duration","quantity","indication"]},"bloodTestOrder":{"type":"object","properties":{"panel":{"type":"string","minLength":1,"maxLength":500},"panelId":{"type":"string","enum":["fbc","ue","hba1c","lft","crp","lipids"]},"specimen":{"type":"string","minLength":1,"maxLength":500},"priority":{"type":"string","enum":["routine","urgent"]},"collection":{"type":"string","enum":["now","next-round"]},"clinicalDetails":{"type":"string","minLength":1,"maxLength":2000}},"required":["panel","specimen","priority","collection","clinicalDetails"]},"dischargeSections":{"type":"object","properties":{"reason":{"type":"string","maxLength":10000},"course":{"type":"string","maxLength":10000},"diagnoses":{"type":"string","maxLength":10000},"medicationChanges":{"type":"string","maxLength":10000},"results":{"type":"string","maxLength":10000},"followUp":{"type":"string","maxLength":10000},"gpActions":{"type":"string","maxLength":10000}},"required":["reason","course","diagnoses","medicationChanges","results","followUp","gpActions"]},"messagingCommand":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"patient_create"},"subject":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]}},"required":["kind","subject","body","channel"]},{"type":"object","properties":{"kind":{"type":"string","const":"reply"},"body":{"type":"string","minLength":1,"maxLength":5000}},"required":["kind","body"]},{"type":"object","properties":{"kind":{"type":"string","const":"create"},"subject":{"type":"string","minLength":1,"maxLength":160},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]},"allowReply":{"type":"boolean"}},"required":["kind","subject","body","channel","allowReply"]},{"type":"object","properties":{"kind":{"type":"string","const":"send"},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]}},"required":["kind","body","channel"]},{"type":"object","properties":{"kind":{"type":"string","const":"configure_auto_reply"},"steps":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000},"delayMinutes":{"type":"number","minimum":0,"maximum":10080}},"required":["body","delayMinutes"]}}},"required":["kind","steps"]},{"type":"object","properties":{"kind":{"type":"string","const":"note"},"body":{"type":"string","minLength":1,"maxLength":5000}},"required":["kind","body"]},{"type":"object","properties":{"kind":{"type":"string","const":"assign"},"assignee":{"type":"string","maxLength":120}},"required":["kind","assignee"]},{"type":"object","properties":{"kind":{"type":"string","const":"complete"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"reopen"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"delivery"},"entryId":{"type":"string"},"status":{"type":"string","enum":["delivered","failed"]}},"required":["kind","entryId","status"]},{"type":"object","properties":{"kind":{"type":"string","const":"retry"},"entryId":{"type":"string"}},"required":["kind","entryId"]},{"type":"object","properties":{"kind":{"type":"string","const":"save_template"},"title":{"type":"string","minLength":1,"maxLength":120},"body":{"type":"string","minLength":1,"maxLength":5000},"channel":{"type":"string","enum":["sms","email"]}},"required":["kind","title","body","channel"]},{"type":"object","properties":{"kind":{"type":"string","const":"archive_template"}},"required":["kind"]}]},"documentTags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}},"documentSnomedCodes":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^[0-9]{6,18}$"},"display":{"type":"string","minLength":1,"maxLength":200}},"required":["code","display"]}},"documentCommand":{"type":"string","enum":["send","assign","review","file","annotate"]},"patientId":{"type":"string"},"resourceId":{"type":"string"},"title":{"type":"string","minLength":1,"maxLength":500},"target":{"type":"string","enum":["control","gp","hospital","community","pharmacy","diagnostics","referrals","wearables","legacy"]},"expectedVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"text":{"type":"string","minLength":1,"maxLength":20000},"consultationStatus":{"type":"string","enum":["draft","saved"]},"allergyStatus":{"type":"string","enum":["active","inactive"]},"reaction":{"type":"string","maxLength":2000},"sourceAllergyKey":{"type":"string","minLength":1,"maxLength":600},"problemStatus":{"type":"string","enum":["active","resolved"]},"problemCode":{"type":"string","maxLength":100},"onsetDate":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"sourceProblemKey":{"type":"string","minLength":1,"maxLength":600},"startsAt":{"type":"integer","minimum":0,"maximum":8640000000000000},"endsAt":{"type":"integer","minimum":0,"maximum":8640000000000000},"slotMinutes":{"type":"integer","minimum":5,"maximum":120},"sessionId":{"type":"string","minLength":1},"sessionVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"slotCommand":{"type":"string","enum":["block","unblock"]},"durationMinutes":{"type":"integer","minimum":5,"maximum":120},"productId":{"type":"string","minLength":1},"quoteId":{"type":"string","minLength":1},"quoteVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"requiredUnits":{"type":"integer","minimum":1,"maximum":100000},"quantity":{"type":"integer","minimum":1,"maximum":100000},"costPence":{"type":"integer","minimum":0,"maximum":10000000},"pricePence":{"type":"integer","minimum":0,"maximum":10000000},"reorderLevel":{"type":"integer","minimum":0,"maximum":100000},"pharmacyPathway":{"type":"string","enum":["Sinusitis","Sore throat","Acute otitis media","Infected insect bites","Impetigo","Shingles","Uncomplicated UTI","Minor illness","Urgent medicine supply"]},"referralSource":{"type":"string","enum":["gp","hospital","patient","referrals"]},"pharmacyCommand":{"type":"string","enum":["accept","consult","complete"]},"hospitalCommand":{"type":"string","enum":["assign","assess","refer","admit","discharge"]},"acuity":{"type":"string","enum":["1","2","3","4","5"]},"location":{"type":"string","minLength":1,"maxLength":100},"disposition":{"type":"string","minLength":1,"maxLength":500},"clinician":{"type":"string","minLength":1,"maxLength":100},"mode":{"type":"string","enum":["in-person","telephone","video","online"]}},"required":["type"],"description":"Executable request fields from the runtime Zod contract. Conditional requirements and clinical workflow transitions are also checked by the engine. Use the named examples as a starting point, choose a permitted site, and copy current resource IDs/versions from a workspace response. All drug prices are integer pence. No clinical advice is provided."},"HospitalNote":{"oneOf":[{"type":"object","properties":{"template":{"type":"string","enum":["free-text","history-physical","progress"]},"sections":{"minItems":1,"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"heading":{"type":"string","minLength":1,"maxLength":120},"text":{"type":"string","maxLength":20000}},"required":["id","heading","text"]}},"text":{"type":"string"},"stage":{"type":"string","const":"draft"}},"required":["template","sections","text","stage"]},{"type":"object","properties":{"template":{"type":"string","enum":["free-text","history-physical","progress"]},"sections":{"minItems":1,"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":80},"heading":{"type":"string","minLength":1,"maxLength":120},"text":{"type":"string","maxLength":20000}},"required":["id","heading","text"]}},"text":{"type":"string"},"stage":{"type":"string","const":"signed"},"signedAt":{"type":"number"},"signedBy":{"type":"string"},"addenda":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"time":{"type":"number"},"author":{"type":"string"}},"required":["text","time","author"]}}},"required":["template","sections","text","stage","signedAt","signedBy","addenda"]}]},"MedicationOrder":{"type":"object","properties":{"drug":{"type":"string","minLength":1,"maxLength":500},"dose":{"type":"string","minLength":1,"maxLength":500},"unit":{"type":"string","minLength":1,"maxLength":500},"route":{"type":"string","minLength":1,"maxLength":500},"frequency":{"type":"string","minLength":1,"maxLength":500},"duration":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"integer","minimum":1,"maximum":100000},"indication":{"type":"string","minLength":1,"maxLength":2000}},"required":["drug","dose","unit","route","frequency","duration","quantity","indication"]},"BloodTestOrder":{"type":"object","properties":{"panel":{"type":"string","minLength":1,"maxLength":500},"panelId":{"type":"string","enum":["fbc","ue","hba1c","lft","crp","lipids"]},"specimen":{"type":"string","minLength":1,"maxLength":500},"priority":{"type":"string","enum":["routine","urgent"]},"collection":{"type":"string","enum":["now","next-round"]},"clinicalDetails":{"type":"string","minLength":1,"maxLength":2000}},"required":["panel","specimen","priority","collection","clinicalDetails"]},"PatientDeath":{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"cause":{"type":"string","minLength":1},"synthetic":{"type":"boolean","const":true},"source":{"type":"string","const":"authored-synthetic-mortality-v1"}},"required":["date","cause","synthetic","source"]},"Patient":{"type":"object","properties":{"death":{"$ref":"#/components/schemas/PatientDeath"},"id":{"type":"string"},"name":{"type":"string"},"birthDate":{"type":"string","format":"date"},"localIds":{"type":"object","additionalProperties":{"type":"string"}},"conditions":{"type":"array","items":{"type":"string"}},"needs":{"type":"array","items":{"type":"string"}},"goals":{"type":"array","items":{"type":"string"}},"synthetic":{"const":true}},"required":["id","name","birthDate","localIds","conditions","needs","goals","synthetic"]},"RecordChange":{"type":"object","properties":{"actor":{"type":"object","properties":{"kind":{"enum":["team","operator","simulation"]},"name":{"type":"string"}},"required":["kind","name"]},"source":{"type":"string"},"action":{"type":"string"},"time":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"version":{"type":"integer"}},"required":["actor","source","action","time","version"]},"Resource":{"type":"object","properties":{"id":{"type":"string"},"patientId":{"type":"string"},"kind":{"type":"string"},"title":{"type":"string"},"status":{"type":"string"},"owner":{"type":"string"},"visibleTo":{"type":"array","items":{"type":"string"}},"priority":{"enum":["routine","urgent"]},"createdAt":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"dueAt":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"data":{"type":"object","additionalProperties":true,"description":"Kind-specific payload. Hospital notes, medication orders and blood-test orders use the named schemas; the full workspace payload is returned without projection."},"version":{"type":"integer","minimum":1},"provenance":{"type":"object","properties":{"created":{"anyOf":[{"$ref":"#/components/schemas/RecordChange"},{"type":"null"}]},"changes":{"type":"array","items":{"$ref":"#/components/schemas/RecordChange"}},"recovery":{"type":"object","additionalProperties":true}},"required":["created","changes"]}},"required":["id","kind","title","status","owner","visibleTo","priority","createdAt","data","version"]},"Event":{"type":"object","properties":{"id":{"type":"string"},"time":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"type":{"type":"string"},"actor":{"type":"string"},"resourceId":{"type":"string"},"patientId":{"type":"string"},"detail":{"type":"string"},"visibleTo":{"type":"array","items":{"type":"string"}}},"required":["id","time","type","actor","detail","visibleTo"]},"Clock":{"type":"object","properties":{"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"paused":{"type":"boolean"},"speed":{"type":"number"},"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}},"required":["now","paused","speed","events"]},"Workspace":{"type":"object","properties":{"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resource"}},"patients":{"type":"array","items":{"$ref":"#/components/schemas/Patient"}},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["resources","patients"]},"View":{"type":"object","properties":{"id":{"type":"string"},"now":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"speed":{"type":"number"},"paused":{"type":"boolean"},"population":{"type":"integer"},"counters":{"type":"object","additionalProperties":{"type":"number"}},"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resource"}},"resourceTotal":{"type":"integer"},"resourceOffset":{"type":"integer"},"resourceLimit":{"type":"integer"},"staffing":{"type":"object","properties":{"doctors":{"type":"integer"},"nurses":{"type":"integer"},"staffedSpaces":{"type":"integer"},"waiting":{"type":"integer"}},"required":["doctors","nurses","staffedSpaces","waiting"]},"faults":{"type":"object","additionalProperties":{"type":"boolean"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"agents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","enabled"]}}},"required":["id","now","speed","paused","population","resources","resourceTotal","resourceOffset","resourceLimit","events"]},"Team":{"type":"object","properties":{"team":{"type":"string"},"world":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["team","world","scopes"]},"OperatorTeam":{"type":"object","properties":{"team":{"type":"string"},"teamName":{"type":"string"},"world":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"patientCount":{"type":"integer"},"resourceCount":{"type":"integer"},"affectedPatientCount":{"type":"integer"},"requestCount":{"type":"integer"},"lastRequestAt":{"type":["string","null"],"format":"date-time"}},"required":["team","teamName","world","scopes","patientCount","resourceCount","affectedPatientCount","requestCount","lastRequestAt"]},"OperatorLogging":{"type":"object","properties":{"since":{"type":"string","format":"date-time"},"retentionDays":{"type":"integer"},"maxRequestsPerWorld":{"type":"integer"}},"required":["since","retentionDays","maxRequestsPerWorld"]},"OperatorRequest":{"type":"object","properties":{"id":{"type":"string"},"time":{"type":"string","format":"date-time"},"method":{"type":"string"},"path":{"type":"string"},"status":{"type":"integer"},"durationMs":{"type":"number"},"team":{"type":"string"},"world":{"type":"string"},"patientIds":{"type":"array","items":{"type":"string"}}},"required":["id","time","method","path","status","durationMs","team","world","patientIds"]},"OperatorChange":{"type":"object","properties":{"resourceId":{"type":"string"},"patientId":{"type":"string"},"title":{"type":"string"},"kind":{"type":"string"},"actor":{"type":"object","properties":{"kind":{"enum":["team","operator","simulation"]},"name":{"type":"string"}},"required":["kind","name"]},"source":{"type":"string"},"action":{"type":"string"},"time":{"type":"number","description":"Simulation Unix timestamp in milliseconds."},"version":{"type":"integer"}},"required":["resourceId","title","kind","actor","source","action","time","version"]},"OperatorActivity":{"type":"object","properties":{"team":{"$ref":"#/components/schemas/OperatorTeam"},"requests":{"type":"array","items":{"$ref":"#/components/schemas/OperatorRequest"}},"patients":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"changeCount":{"type":"integer"},"lastChangedAt":{"type":"number","description":"Simulation Unix timestamp in milliseconds."}},"required":["id","name","changeCount","lastChangedAt"]}},"changes":{"type":"array","items":{"$ref":"#/components/schemas/OperatorChange"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"logging":{"$ref":"#/components/schemas/OperatorLogging"}},"required":["team","requests","patients","changes","events","logging"]},"Key":{"type":"object","properties":{"apiKey":{"type":"string","description":"Reusable team key. Joining with the same normalised name returns this key again."},"team":{"type":"string","description":"Team attribution label; older teams retain their original label."},"teamName":{"type":"string","description":"Canonical join name: lowercase with all whitespace removed."},"world":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"created":{"type":"boolean","description":"True only when this request created a new world."}},"required":["apiKey","team","teamName","world","scopes","created"]},"Bundle":{"type":"object","properties":{"resourceType":{"const":"Bundle"},"type":{"const":"searchset"},"total":{"type":"integer"},"link":{"type":"array","items":{"type":"object","properties":{"relation":{"type":"string"},"url":{"type":"string"}},"required":["relation","url"]}},"entry":{"type":"array","items":{"type":"object","properties":{"fullUrl":{"type":"string"},"resource":{"type":"object","additionalProperties":true},"search":{"type":"object","properties":{"mode":{"const":"match"}},"required":["mode"]}},"required":["resource"]}}},"required":["resourceType","type","entry"]},"FhirPatient":{"type":"object","properties":{"deceasedDateTime":{"type":"string","description":"Date of death for a deceased synthetic patient; absent for a living patient."},"resourceType":{"const":"Patient"},"id":{"type":"string"},"active":{"type":"boolean"},"identifier":{"type":"array","items":{"type":"object","properties":{"use":{"type":"string"},"system":{"type":"string"},"value":{"type":"string"}},"required":["use","system","value"]}},"name":{"type":"array","items":{"type":"object","additionalProperties":true}},"birthDate":{"type":"string","format":"date"},"address":{"type":"array","items":{"type":"object","additionalProperties":true}},"telecom":{"type":"array","items":{"type":"object","additionalProperties":true}},"generalPractitioner":{"type":"array","items":{"type":"object","additionalProperties":true}},"meta":{"type":"object","additionalProperties":true}},"required":["resourceType","id","active","identifier","name","birthDate","address","telecom","generalPractitioner","meta"]},"FhirOrganization":{"type":"object","properties":{"resourceType":{"const":"Organization"},"id":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"identifier":{"type":"array","items":{"type":"object","additionalProperties":true}},"type":{"type":"array","items":{"type":"object","additionalProperties":true}},"address":{"type":"array","items":{"type":"object","additionalProperties":true}},"telecom":{"type":"array","items":{"type":"object","additionalProperties":true}},"meta":{"type":"object","additionalProperties":true}},"required":["resourceType","id","name","active","identifier","type","address","telecom","meta"]},"OperationOutcome":{"type":"object","properties":{"resourceType":{"const":"OperationOutcome"},"issue":{"type":"array","items":{"type":"object","properties":{"severity":{"type":"string"},"code":{"type":"string"},"diagnostics":{"type":"string"}},"required":["severity","code","diagnostics"]}}},"required":["resourceType","issue"]},"Cis2Settings":{"type":"object","properties":{"scenario":{"type":"string","enum":["normal","deny","unavailable","expired-session"]},"tokenLifetimeSeconds":{"type":"integer","minimum":30,"maximum":3600},"clients":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-zA-Z0-9_-]{3,80}$"},"name":{"type":"string","minLength":1,"maxLength":100},"redirectUris":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","format":"uri"}}},"required":["id","name","redirectUris"],"additionalProperties":false}}},"required":["scenario","tokenLifetimeSeconds","clients"],"additionalProperties":false},"StaffIdentity":{"type":"object","properties":{"sub":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"org":{"type":"string"},"organisation":{"type":"string"},"nhs_sim":{"const":true}},"required":["sub","name","role","org","organisation","nhs_sim"]},"Cis2Configuration":{"type":"object","properties":{"scenario":{"enum":["normal","deny","unavailable","expired-session"]},"tokenLifetimeSeconds":{"type":"integer"},"clients":{"type":"array","items":{"type":"object","additionalProperties":true}},"identities":{"type":"array","items":{"type":"object","additionalProperties":true}},"storage":{"type":"string"},"active":{"type":"object","properties":{"interactions":{"type":"integer"},"codes":{"type":"integer"},"tokens":{"type":"integer"}},"required":["interactions","codes","tokens"]}},"required":["scenario","tokenLifetimeSeconds","clients","identities","storage","active"]}}},"x-site-registry":[{"id":"control","name":"The neighbourhood"},{"id":"gp","name":"GP Records"},{"id":"hospital","name":"Hospital EPR"},{"id":"pharmacy","name":"Pharmacy"},{"id":"community","name":"Community Care"},{"id":"wearables","name":"Home Health"}]}