{
  "openapi": "3.1.0",
  "info": {
    "title": "NHS Formulary consumer API",
    "version": "1",
    "description": "The read-only interface to a formulary's published content, for clinical systems and the tooling around them. Each committee's published formulary is served as one JSON payload per published version; the directory names the committees and the ODS codes of the organisations they serve.\n\nEvery path below is relative to the API's own hostname, the one this document was downloaded from. This document as a file: [/openapi.json](/openapi.json).\n\n# Authentication\n\nEvery `/v1` request carries the shared origin key in the `X-Origin-Key` header, HEAD requests included. A missing or wrong key is answered 401 (`invalid_origin_key`); an API with no key configured answers 503 (`origin_key_unconfigured`) to everything. For GET and HEAD the key is checked before the path, so an unknown path without the key is 401, not 404. Other methods never reach the key: the web application answers them itself, before the key is read (see Errors).\n\nThe key is rotated without downtime: the API accepts up to two values at once, so you are told the new key and switch at your own pace, after which the old one is withdrawn. The three documentation paths (this page, `/openapi.json` and `/robots.txt`) need no key.\n\n# Conditional requests\n\nThe directory, the two payload operations and the document operation carry a strong `ETag`: the quoted SHA-256 of the exact bytes served. Send it back as `If-None-Match` and an unchanged resource is answered 304 with no body and the same `ETag`. `*`, a comma-separated list of tags and weak tags (`W/\"…\"`) all match as RFC 9110 says. A published payload's bytes change only when an operator rebuilds that version to the current payload shape, and its tag changes with them, so revalidate with `If-None-Match` rather than caching for ever; the directory's tag changes when the directory does.\n\nEvery operation answers HEAD with the status and headers of the GET and no body. The one exception is the document operation, whose HEAD is answered from the document's record without reading the stored bytes and therefore carries no `Content-Disposition` and no `Content-Length`.\n\n# Version history\n\nVersion numbers are of the form `1.2.3` and come from one counter shared by every committee, so one committee's versions have gaps. The history lists a committee's versions newest first. `payloadAvailable` is false for versions published before payloads existed; `latest` is the newest version that HAS a payload, which is not always the newest version. `whatChanged` is the committee's release notes, for display only.\n\n# The payload\n\nEvery section is always present, even when empty, so no existence check is needed. Items within a section are in a fixed order that carries no meaning; where a display order exists it is the `position` field. Identifiers are external codes wherever one exists: dm+d ids and SNOMED CT concept ids are strings, because they are larger than some languages can hold exactly as a number. A dimension whose definitions are a section of the same payload (shared care classification, age band, licence status) is referred to by its identifier only; a dimension without a section (indication, brand) carries its external code inline.\n\nA classification is stated at the level it was authored: one on a drug applies to each of the drug's products unless the product carries its own classification for the same age band, licence status, indication and brand. A do-not-prescribe statement on a drug stands for each of its products and is never overridden by one; a product's own statement only adds to it. The payload does not resolve either rule; a consumer applies them.\n\n`committee.odsCodes` is pinned at the publish: the organisations the committee served at the time. The directory is the live authority for resolving a code to a committee.\n\n# Shared care agreement documents\n\nA drug in the payload may carry `sharedCareAgreement`, a reference to the agreement document current at the publish: its `documentId`, the SHA-256 of its bytes, its media type and its size. The bytes come from `GET /v1/documents/shared-care-agreements/{documentId}`: a PDF or a Word document of at most one mebibyte, as a download. Only a committee's current agreement is served; once that committee replaces or withdraws it, the reference in an older payload answers 404 (`document_not_found`), the same as an id that never existed. That is deliberate: a superseded agreement has been corrected and a withdrawn one retracted, so read `latest` for a reference that resolves.\n\n# Errors\n\nEvery error is `{ \"error\": { \"code\", \"message\" } }` as JSON (`application/json`, no charset parameter). The codes and their statuses: `invalid_origin_key` 401; `origin_key_unconfigured` 503; `committee_not_found`, `version_not_found`, `no_artifact_available`, `document_not_found` and `not_found` (an unknown path) 404; `method_not_allowed` 405; `internal_error` 500. A path segment that is not of the expected form (a committee id or document id that is not up to twelve digits, a version that is not three numbers) is a 404 with the operation's first code, never a 400.\n\nThrough the web application that serves the API, OPTIONS is answered 204 with an `Allow` header and POST, PUT, PATCH and DELETE are answered 405 with no body and no `Allow` header, before the key or the path is read. The API application served on its own answers those methods with the JSON envelope, `method_not_allowed`, and `Allow: GET, HEAD`.\n\n# Artifact history\n\nPayloads minted on the development environment before 2026-09-01, while the API was being built, carry earlier shapes under `schemaVersion: 1`: an early one holds only shared care classifications, a later one has no `committee.odsCodes`, and none has `sharedCareAgreement`. A committee's next publish, or an operator rebuild, mints the current shape, which is the one described here.\n\n# No cross-origin access\n\nCross-Origin Resource Sharing, the browser rule about which websites may read a response, is not enabled on `/v1`: the API is for systems, not browser pages. The specification file alone (`/openapi.json`) may be fetched from any website, so a browser-based tool can load it by address.\n\n# Changelog\n\nEntries are keyed to the payload's `schemaVersion` and dated. Every artifact\nrecords the `schemaVersion` it was built with; the shape a given artifact\ncarries is the shape current on the date it was minted.\n\n## schemaVersion 1\n\n### 2026-10-29 — BNF pathways at every BNF level\n\n- A BNF pathway's `identifier` is now a BNF class code at any level: a\n  chapter, section, paragraph, sub-paragraph or chemical substance code\n  (before, a sub-paragraph code only). No change to the payload's shape.\n\n### 2026-10-13 — one shared care agreement per committee\n\n- One shared care agreement per committee. A drug's `sharedCareAgreement`\n  is the committee's own document, never another committee's; the documents\n  endpoint serves a document while it is its committee's current agreement.\n  No change to the payload's shape.\n\n### 2026-09-24 — the specification and the reference page (#195)\n\n- The OpenAPI 3.1 specification (`/openapi.json`) and this reference page\n  are published at the API hostname's root, which answered the API's\n  not-found before. No change to any `/v1` response.\n\n### 2026-09-01 — shared care agreement documents (#103)\n\n- A VTM item carries `sharedCareAgreement`: a reference (`documentId`,\n  `contentHash`, `contentType`, `byteSize`) or `null`.\n- New endpoint: `GET /v1/documents/shared-care-agreements/{documentId}`\n  serves the document's bytes. Only a VTM's current, non-withdrawn agreement\n  is served; a reference held in an older artifact stops resolving once the\n  agreement is replaced or withdrawn.\n\n### 2026-08-31 — committee ODS codes (#102)\n\n- `committee.odsCodes` is added to the envelope: the committee's ODS codes\n  as at the publish. The live directory's `odsCodes` is the authority for\n  resolving a code to a committee; the envelope's copy is history.\n- The directory's committees carry `odsCodes`, and the directory answers\n  with an `ETag` over its body and 304 to a matching `If-None-Match`.\n\n### 2026-08-31 — medicines-and-devices pathways (#101)\n\n- The `medicinesAndDevicesPathways` section is added, with `pathways` as its\n  list.\n\n### 2026-08-31 — medicines-and-devices classifications, scope and do-not-prescribe (#100)\n\n- The `medicinesAndDevicesClassifications` section is added: VTM items with\n  their products, free-standing VMPs, classifications at the authored level,\n  and do-not-prescribe statements.\n\n### 2026-08-31 — licence statuses (#99), age bands (#98), shared care classifications (#97)\n\n- The `licenses`, `ages` and `sharedCareClassifications` sections are added,\n  each as `{ items: [...] }`. The flat `entries` list of the foundation\n  envelope is removed in favour of named sections.\n\n### 2026-08-31 — foundation (#96)\n\n- The envelope: `artifact: \"native\"`, `schemaVersion: 1`, `committee.id`,\n  `version.semver`, `version.publishedAt`, and an `entries` list that was\n  always empty.\n\n**Artifacts minted before the shared care agreement phase was deployed on\n2026-09-01.** Artifacts minted on the development environment while the\nphases above were being deployed carry the shape current when they were\nminted, and every one of them claims `schemaVersion: 1`. An early one holds\nonly `sharedCareClassifications`; a later one runs through pathways but has\nno `committee.odsCodes`; none minted before 2026-09-01 has\n`sharedCareAgreement`. A committee's next publish, or a rebuild by the\nformulary's operators, mints the current shape. Read this page's schema as\nthe shape of artifacts minted from 2026-09-01.\n"
  },
  "servers": [
    {
      "url": "/",
      "description": "The API hostname this document was downloaded from."
    }
  ],
  "security": [
    {
      "originKey": []
    }
  ],
  "tags": [
    {
      "name": "Committees",
      "description": "Who publishes."
    },
    {
      "name": "Versions and payloads",
      "description": "What was published, and when."
    },
    {
      "name": "Documents",
      "description": "The shared care agreement documents payloads refer to."
    },
    {
      "name": "Documentation",
      "description": "This page, the specification file and the crawler file. No key needed."
    }
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "Documentation"
        ],
        "operationId": "getReferencePage",
        "summary": "The reference page",
        "description": "This page: the specification rendered for people, self-contained. Marked `noindex, nofollow` and crawlable. Answers `If-None-Match` with 304.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "The page.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Robots-Tag": {
                "$ref": "#/components/headers/XRobotsTag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoCache"
              }
            },
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "Documentation"
        ],
        "operationId": "getSpecification",
        "summary": "The specification file",
        "description": "This document as OpenAPI 3.1 JSON, for import into your own tools. Any website may fetch it from a browser page (`Access-Control-Allow-Origin: *`). Answers `If-None-Match` with 304.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "The specification.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Robots-Tag": {
                "$ref": "#/components/headers/XRobotsTag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoCache"
              },
              "Access-Control-Allow-Origin": {
                "description": "Always `*`: any website may fetch the file.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "This document."
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "tags": [
          "Documentation"
        ],
        "operationId": "getRobots",
        "summary": "The crawler file",
        "description": "Two lines: `User-agent: *` and `Disallow: /v1`. The page and the file are left crawlable so that their `noindex` is honoured.",
        "security": [],
        "responses": {
          "200": {
            "description": "The two lines.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/committees": {
      "get": {
        "tags": [
          "Committees"
        ],
        "operationId": "listCommittees",
        "summary": "The committee directory",
        "description": "Every committee, with its name and the ODS codes of the organisations it currently serves. Poll this to resolve an ODS code to a committee; it carries an `ETag` over its body, so an unchanged directory costs a 304.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "The directory.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitteeDirectory"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/committees/{id}/versions": {
      "get": {
        "tags": [
          "Versions and payloads"
        ],
        "operationId": "listCommitteeVersions",
        "summary": "A committee's version history",
        "description": "The committee's published versions, newest first, with whether each has a payload. No `ETag`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CommitteeId"
          }
        ],
        "responses": {
          "200": {
            "description": "The history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VersionHistory"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "No such committee. The code is `committee_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "committee_not_found"
            ]
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/committees/{id}/latest": {
      "get": {
        "tags": [
          "Versions and payloads"
        ],
        "operationId": "getLatestPayload",
        "summary": "The newest payload",
        "description": "The payload of the committee's newest published version that has one. The `ETag` is the payload's SHA-256; the bytes change only when an operator rebuilds the version to the current payload shape, so revalidate with `If-None-Match`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CommitteeId"
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "The payload.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayloadEnvelope"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "No such committee, or the committee has no version with a payload. The code is `committee_not_found` or `no_artifact_available`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "committee_not_found",
              "no_artifact_available"
            ]
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/committees/{id}/versions/{semver}": {
      "get": {
        "tags": [
          "Versions and payloads"
        ],
        "operationId": "getPayloadByVersion",
        "summary": "One version's payload",
        "description": "The payload of one published version. The `ETag` is the payload's SHA-256; the bytes change only when an operator rebuilds the version to the current payload shape, so revalidate with `If-None-Match`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CommitteeId"
          },
          {
            "$ref": "#/components/parameters/Semver"
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "The payload.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayloadEnvelope"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "No such committee, no such published version, or a version with no payload. The code is `committee_not_found` or `version_not_found` or `no_artifact_available`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "committee_not_found",
              "version_not_found",
              "no_artifact_available"
            ]
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/documents/shared-care-agreements/{documentId}": {
      "get": {
        "tags": [
          "Documents"
        ],
        "operationId": "getSharedCareAgreementDocument",
        "summary": "A shared care agreement document",
        "description": "The bytes of the agreement a payload refers to by `documentId`, as a download (PDF or Word, at most one mebibyte). Only a committee's current agreement is served: a superseded or withdrawn one answers 404 like an id that never existed. HEAD is answered from the document's record without reading the bytes, so it carries no `Content-Disposition` and no `Content-Length`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/DocumentId"
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "x-head-omits": [
          "Content-Disposition",
          "Content-Length"
        ],
        "responses": {
          "200": {
            "description": "The document.",
            "headers": {
              "Content-Disposition": {
                "description": "An attachment, with a filename made safe for the file system (ASCII in `filename`, the full name percent-encoded in `filename*`).",
                "schema": {
                  "type": "string"
                }
              },
              "X-Content-Type-Options": {
                "description": "Always `nosniff`.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "description": "Always `private, no-cache`: revalidate every time, because an agreement can be withdrawn at any moment.",
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "description": "The document's size in bytes.",
                "schema": {
                  "type": "integer"
                }
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/pdf": {
                "schema": {}
              },
              "application/msword": {
                "schema": {}
              },
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
                "schema": {}
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "No such document, or the document is no longer its committee's current agreement. The code is `document_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "document_not_found"
            ]
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "originKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Origin-Key",
        "description": "The shared origin key, on every /v1 request."
      }
    },
    "parameters": {
      "CommitteeId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The committee's identifier, from the directory: up to twelve digits.",
        "schema": {
          "type": "string",
          "pattern": "^\\d{1,12}$"
        }
      },
      "Semver": {
        "name": "semver",
        "in": "path",
        "required": true,
        "description": "A version number of the form 1.2.3, from the version history.",
        "schema": {
          "type": "string",
          "pattern": "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}$"
        }
      },
      "DocumentId": {
        "name": "documentId",
        "in": "path",
        "required": true,
        "description": "The document's identifier, from a payload's `sharedCareAgreement.documentId`: up to twelve digits.",
        "schema": {
          "type": "string",
          "pattern": "^\\d{1,12}$"
        }
      },
      "IfNoneMatch": {
        "name": "If-None-Match",
        "in": "header",
        "required": false,
        "description": "The `ETag` of the copy you hold. A match is answered 304 with no body.",
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "ETag": {
        "description": "A strong entity tag: the quoted SHA-256, in hex, of the exact bytes served. Send it back as `If-None-Match` to be answered 304 when nothing has changed.",
        "schema": {
          "type": "string"
        }
      },
      "Allow": {
        "description": "The methods the resource supports: `GET, HEAD`.",
        "schema": {
          "type": "string"
        }
      },
      "XRobotsTag": {
        "description": "Always `noindex, nofollow`: the page and the file are public but kept out of search results.",
        "schema": {
          "type": "string"
        }
      },
      "CacheControlNoCache": {
        "description": "Always `no-cache`: revalidate with `If-None-Match`.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "NotModified": {
        "description": "Your copy is current. No body.",
        "headers": {
          "ETag": {
            "$ref": "#/components/headers/ETag"
          }
        }
      },
      "Unauthorized": {
        "description": "The `X-Origin-Key` header is missing or wrong. The code is `invalid_origin_key`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "invalid_origin_key"
        ]
      },
      "MethodNotAllowed": {
        "description": "Only GET and HEAD are supported. Through the web application that serves the API this answer has no body and no `Allow` header, and is sent before the key or the path is read. The API application served on its own answers the JSON envelope with the code `method_not_allowed` and `Allow: GET, HEAD`.",
        "x-error-codes": [
          "method_not_allowed"
        ]
      },
      "InternalError": {
        "description": "Something failed on the server. The code is `internal_error`; the message never carries internal detail.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "internal_error"
        ]
      },
      "ServiceUnavailable": {
        "description": "The API has no origin key configured and accepts nothing. The code is `origin_key_unconfigured`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "origin_key_unconfigured"
        ]
      },
      "UnknownPath": {
        "description": "A path that is none of the operations, on the API hostname: 404 with the code `not_found`. Under `/v1` the key is checked first, so without it the answer is 401.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "not_found"
        ]
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "The one envelope every error carries.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "The machine-readable code to switch on.",
                "enum": [
                  "invalid_origin_key",
                  "origin_key_unconfigured",
                  "method_not_allowed",
                  "committee_not_found",
                  "version_not_found",
                  "no_artifact_available",
                  "document_not_found",
                  "not_found",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string",
                "description": "A short sentence for a person. Never internal detail."
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "CommitteeDirectory": {
        "type": "object",
        "description": "The live committee directory: the authoritative source for a committee's name and for resolving an ODS code to a committee.",
        "properties": {
          "committees": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "The committee's identifier: the `{id}` in the operation paths."
                },
                "name": {
                  "type": "string",
                  "description": "The committee's name. It appears nowhere else in the API."
                },
                "odsCodes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The ODS codes of the organisations the committee currently serves, sorted; empty when it has none. A code belongs to one committee at a time, so this list is the source of truth for resolving a code."
                }
              },
              "required": [
                "id",
                "name",
                "odsCodes"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "committees"
        ],
        "additionalProperties": false
      },
      "VersionHistory": {
        "type": "object",
        "description": "A committee's published version history, newest first.",
        "properties": {
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "semver": {
                  "type": "string",
                  "description": "The version number, of the form 1.2.3."
                },
                "publishedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the version was published, as a UTC date and time in ISO 8601 form, for example 2026-08-27T10:31:00.000Z."
                },
                "whatChanged": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The committee's release notes, for display only; null when none were written."
                },
                "payloadAvailable": {
                  "type": "boolean",
                  "description": "True when the version has a payload that `versions/{semver}` will serve. False for versions published before payloads existed."
                }
              },
              "required": [
                "semver",
                "publishedAt",
                "whatChanged",
                "payloadAvailable"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "versions"
        ],
        "additionalProperties": false
      },
      "PayloadEnvelope": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "string",
            "const": "native",
            "description": "The artifact's name. Always \"native\"."
          },
          "schemaVersion": {
            "type": "integer",
            "const": 1,
            "description": "The version of this envelope's shape. Raised only when the shape changes in a way that breaks consumers."
          },
          "committee": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "description": "The committee's identifier: the `{id}` in the operation paths, and the `id` in the committee directory."
              },
              "odsCodes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The ODS codes of the organisations the committee served at the time of this publish, sorted, possibly empty. Use it to answer \"which organisations did this published decision apply to at the time?\". Do not use it to resolve a code to a committee: the committee directory (`GET /v1/committees`) is the live, authoritative source for that, and a code that has moved between committees appears in both committees' earlier artifacts."
              }
            },
            "required": [
              "id",
              "odsCodes"
            ],
            "additionalProperties": false,
            "description": "The committee that published this version."
          },
          "version": {
            "type": "object",
            "properties": {
              "semver": {
                "type": "string",
                "description": "The version number, of the form 1.2.3. Numbers come from one counter shared by every committee, so one committee's versions have gaps."
              },
              "publishedAt": {
                "type": "string",
                "description": "When the version was published, as a UTC date and time in ISO 8601 form."
              }
            },
            "required": [
              "semver",
              "publishedAt"
            ],
            "additionalProperties": false,
            "description": "The published version this payload belongs to."
          },
          "sharedCareClassifications": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SharedCareClassificationItem"
                }
              }
            },
            "required": [
              "items"
            ],
            "additionalProperties": false,
            "description": "The shared care classifications vocabulary in force at this version."
          },
          "ages": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AgeItem"
                }
              }
            },
            "required": [
              "items"
            ],
            "additionalProperties": false,
            "description": "The age bands vocabulary in force at this version."
          },
          "licenses": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LicenseItem"
                }
              }
            },
            "required": [
              "items"
            ],
            "additionalProperties": false,
            "description": "The licence statuses vocabulary in force at this version."
          },
          "medicinesAndDevicesClassifications": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MdClassificationsItem"
                }
              }
            },
            "required": [
              "items"
            ],
            "additionalProperties": false,
            "description": "The committee's drugs and products, with their classifications and do-not-prescribe statements."
          },
          "medicinesAndDevicesPathways": {
            "type": "object",
            "properties": {
              "pathways": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MdPathwayItem"
                }
              }
            },
            "required": [
              "pathways"
            ],
            "additionalProperties": false,
            "description": "The committee's prescribing pathways."
          }
        },
        "required": [
          "artifact",
          "schemaVersion",
          "committee",
          "version",
          "sharedCareClassifications",
          "ages",
          "licenses",
          "medicinesAndDevicesClassifications",
          "medicinesAndDevicesPathways"
        ],
        "additionalProperties": false,
        "description": "A committee's published formulary at one published version: the payload the `latest` and `versions/{semver}` operations return. Every section is always present, even when empty, so no existence check is needed. Items within a section are in a fixed order that carries no meaning; where a display order exists it is the `position` field. Identifiers are external codes wherever one exists; dm+d and SNOMED ids are strings. A version's bytes change only when an operator rebuilds it to the current payload shape, and its ETag with them: revalidate with `If-None-Match` rather than caching for ever.",
        "title": "Payload"
      },
      "SharedCareClassificationItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The classification's identifier, stable for the life of the formulary."
          },
          "name": {
            "type": "string",
            "description": "The name shown to prescribers, for example \"Amber\"."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the classification means for prescribers, or null when none was written."
          },
          "colour": {
            "type": [
              "string",
              "null"
            ],
            "description": "The colour it is shown in, as #RRGGBB, or null for a classification with no colour."
          },
          "position": {
            "type": "integer",
            "description": "Where the classification sits in the scheme's display order, counting from 0. Order by this, not by the position of items in the payload."
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "colour",
          "position"
        ],
        "additionalProperties": false,
        "description": "One shared care classification: the formulary's own vocabulary for how prescribing is shared between specialist and general practice (for example Green, Amber, Red). No national code system exists for these, so the definition travels with its `id`; a classification on a product refers to it by that id. Ids are never reused or renumbered.",
        "title": "Shared care classification"
      },
      "AgeItem": {
        "type": "object",
        "properties": {
          "snomedId": {
            "type": "string",
            "description": "The SNOMED CT concept id, as a string: SNOMED ids can exceed the largest whole number some languages hold exactly."
          },
          "name": {
            "type": "string",
            "description": "The SNOMED preferred term, for example \"Adult\"."
          },
          "position": {
            "type": "integer",
            "description": "Where the age band sits in the vocabulary's display order, counting from 0. Order by this; the payload lists items by `snomedId`."
          }
        },
        "required": [
          "snomedId",
          "name",
          "position"
        ],
        "additionalProperties": false,
        "description": "One age band, identified by its SNOMED CT concept, for example Adult or Child. A classification on a product refers to an age band by `snomedId`.",
        "title": "Age band"
      },
      "LicenseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The licence status's identifier, stable for the life of the formulary."
          },
          "name": {
            "type": "string",
            "description": "The name shown to prescribers, for example \"Off-Label\"."
          },
          "snomedId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The SNOMED CT concept id as a string, or null while no code has been assigned."
          },
          "position": {
            "type": "integer",
            "description": "Where the status sits in the vocabulary's display order, counting from 0."
          }
        },
        "required": [
          "id",
          "name",
          "snomedId",
          "position"
        ],
        "additionalProperties": false,
        "description": "One licence status, for example On-Label, Off-Label or Unlicensed. A classification on a product refers to a licence status by `id`; the SNOMED CT concept id, when one has been assigned, is carried beside it. Ids are never reused.",
        "title": "Licence status"
      },
      "MdClassificationsItem": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/MdVtmItem"
          },
          {
            "$ref": "#/components/schemas/MdProductItem"
          }
        ],
        "description": "A top-level item of the classifications section: a drug with its products, or a product with no parent drug in dm+d, standing alone with the product shape. Tell them apart by `kind`."
      },
      "MdVtmItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "vtm",
            "description": "The kind of item: a dm+d virtual therapeutic moiety."
          },
          "dmdId": {
            "type": "string",
            "description": "The drug's dm+d id, as a string."
          },
          "classifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdClassificationEntry"
            },
            "description": "The classifications authored on the drug itself, which its products inherit; empty when no product is included."
          },
          "dnp": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MdDnp"
              },
              {
                "type": "null"
              }
            ],
            "description": "The drug's own do-not-prescribe statement, or null."
          },
          "sharedCareAgreement": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MdScaReference"
              },
              {
                "type": "null"
              }
            ],
            "description": "The committee's own shared care agreement document current for the drug at the time of the publish, or null. Each committee holds its own agreement for a drug; another committee's is never carried here."
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdProductItem"
            },
            "description": "The drug's products that appear (included, or prohibited)."
          }
        },
        "required": [
          "kind",
          "dmdId",
          "classifications",
          "dnp",
          "sharedCareAgreement",
          "products"
        ],
        "additionalProperties": false,
        "description": "One drug, a dm+d virtual therapeutic moiety (VTM), with its products. A drug appears when at least one of its products appears, or when the drug itself carries a do-not-prescribe statement. Its classifications appear only when at least one product is included.",
        "title": "Drug"
      },
      "MdClassificationEntry": {
        "type": "object",
        "properties": {
          "sharedCareClassification": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false,
            "description": "The shared care classification, by the `id` of an item in this document's `sharedCareClassifications` section."
          },
          "age": {
            "type": "object",
            "properties": {
              "snomedId": {
                "type": "string"
              }
            },
            "required": [
              "snomedId"
            ],
            "additionalProperties": false,
            "description": "The age band, by the `snomedId` of an item in this document's `ages` section."
          },
          "license": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false,
            "description": "The licence status, by the `id` of an item in this document's `licenses` section."
          },
          "indication": {
            "type": "object",
            "properties": {
              "snomedId": {
                "type": "string"
              }
            },
            "required": [
              "snomedId"
            ],
            "additionalProperties": false,
            "description": "The indication, as a SNOMED CT concept id."
          },
          "brand": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "tfid": {
                    "type": "string"
                  }
                },
                "required": [
                  "tfid"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The brand the position is limited to, as a dm+d trade family id (`tfid`), or null for the committee's general position covering every brand."
          }
        },
        "required": [
          "sharedCareClassification",
          "age",
          "license",
          "indication",
          "brand"
        ],
        "additionalProperties": false,
        "description": "One classification: the committee's position for one combination of shared care classification, age band, licence status, indication and brand. It is stated at the level it was authored: a classification on a VTM (the drug) applies to each of the VTM's products unless the product carries its own classification for the same age, licence, indication and brand. The payload does not resolve that inheritance; a consumer applies the rule.\n\nA dimension whose definitions are a section of this same document is referred to by its identifier only (`sharedCareClassification` by id, `age` by SNOMED code, `license` by id); a dimension without a section carries its external code inline (`indication` by SNOMED code, `brand` by dm+d trade family id). No display names are carried: consumers hold dm+d and SNOMED.",
        "title": "Classification"
      },
      "MdDnp": {
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdDnpGroup"
            },
            "description": "The brand groups of the statement; at least one."
          }
        },
        "required": [
          "groups"
        ],
        "additionalProperties": false,
        "description": "A do-not-prescribe statement, stated at the level it was authored. A statement on a VTM (the drug) stands for each of its products and is never overridden by a product; a product's own statement only adds to it. The payload does not resolve that; a consumer applies the rule.",
        "title": "Do-not-prescribe statement"
      },
      "MdDnpGroup": {
        "type": "object",
        "properties": {
          "brand": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "tfid": {
                    "type": "string"
                  }
                },
                "required": [
                  "tfid"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The brand the group is limited to, as a dm+d trade family id, or null for every brand."
          },
          "appliesToAllIndications": {
            "type": "boolean",
            "description": "True when the prohibition covers every indication. Stated explicitly: never infer it from an empty `indications` list."
          },
          "indications": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "snomedId": {
                  "type": "string"
                }
              },
              "required": [
                "snomedId"
              ],
              "additionalProperties": false
            },
            "description": "The indications the prohibition covers, as SNOMED CT concept ids. Empty exactly when `appliesToAllIndications` is true."
          }
        },
        "required": [
          "brand",
          "appliesToAllIndications",
          "indications"
        ],
        "additionalProperties": false,
        "description": "One group of a do-not-prescribe statement: the indications the prohibition covers, for one brand or for every brand.",
        "title": "Do-not-prescribe group"
      },
      "MdScaReference": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "integer",
            "description": "The document's identifier: the address of the bytes on the documents endpoint."
          },
          "contentHash": {
            "type": "string",
            "description": "The SHA-256 of the document's bytes, in hex: the integrity check, and the endpoint's ETag."
          },
          "contentType": {
            "type": "string",
            "description": "The document's media type: application/pdf, application/msword or application/vnd.openxmlformats-officedocument.wordprocessingml.document."
          },
          "byteSize": {
            "type": "integer",
            "description": "The document's size in bytes."
          }
        },
        "required": [
          "documentId",
          "contentHash",
          "contentType",
          "byteSize"
        ],
        "additionalProperties": false,
        "description": "A reference to the shared care agreement document current for this drug at the time of the publish: the uploaded governance document, which is a different thing from a shared care classification. The bytes are not in the payload: fetch them from `GET /v1/documents/shared-care-agreements/{documentId}`, which serves only a committee's current agreement. Once that committee replaces or withdraws it, this reference stops resolving (404); read `latest` for a resolvable reference.\n\nNo filename, uploader or uploading committee is carried; the download supplies a safe filename.",
        "title": "Shared care agreement reference"
      },
      "MdProductItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "vmp",
            "description": "The kind of product: a dm+d virtual medicinal product."
          },
          "dmdId": {
            "type": "string",
            "description": "The product's dm+d id, as a string."
          },
          "included": {
            "type": "boolean",
            "description": "True when the committee includes the product in the formulary; false when it appears only because of a do-not-prescribe statement."
          },
          "classifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdClassificationEntry"
            },
            "description": "The classifications authored on the product itself; empty when it is not included."
          },
          "dnp": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MdDnp"
              },
              {
                "type": "null"
              }
            ],
            "description": "The product's own do-not-prescribe statement, or null."
          }
        },
        "required": [
          "kind",
          "dmdId",
          "included",
          "classifications",
          "dnp"
        ],
        "additionalProperties": false,
        "description": "One product, a dm+d virtual medicinal product (VMP). A product appears only when the committee has included it in the formulary or has stated a do-not-prescribe for it; a product that is excluded, or has not been reviewed, and carries no prohibition is absent. Classifications appear only on included products.",
        "title": "Product"
      },
      "MdPathwayItem": {
        "type": "object",
        "properties": {
          "details": {
            "$ref": "#/components/schemas/MdPathwayDetails",
            "description": "What the pathway is for."
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdPathwayComponent"
            },
            "description": "Every component the committee has not retired, in the structure's order; a component's `lines` may be empty."
          }
        },
        "required": [
          "details",
          "components"
        ],
        "additionalProperties": false,
        "description": "One pathway the committee has published content for: at least one line under a component that is not retired.",
        "title": "Pathway"
      },
      "MdPathwayDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "bnf",
              "niceCondition"
            ],
            "description": "What anchors the pathway: a BNF class or a NICE condition."
          },
          "identifier": {
            "type": "string",
            "description": "The BNF class code: a chapter, section, paragraph, sub-paragraph or chemical substance code; or the condition's slug."
          },
          "name": {
            "type": "string",
            "description": "The pathway's display name."
          },
          "snomedId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The SNOMED CT concept id of a NICE condition, as a string; null for a BNF pathway, or until a code is assigned."
          }
        },
        "required": [
          "type",
          "identifier",
          "name",
          "snomedId"
        ],
        "additionalProperties": false,
        "description": "What a pathway is for: a BNF class, or a NICE condition. One shape serves both. For a BNF pathway `identifier` is the BNF class code (a chapter, section, paragraph, sub-paragraph or chemical substance code) and `snomedId` is null (BNF classes are not SNOMED-coded). For a NICE condition pathway `identifier` is the formulary's stable slug for the condition and `snomedId` is its SNOMED CT concept id, or null until one is assigned.",
        "title": "Pathway details"
      },
      "MdPathwayComponent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The component's identifier, stable across versions."
          },
          "label": {
            "type": "string",
            "description": "The component's heading, for example \"First-line treatment\"."
          },
          "position": {
            "type": "integer",
            "description": "The component's place in the pathway's order, counting from 0."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "retiring"
            ],
            "description": "Whether the component is in use or being retired."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdPathwayLine"
            },
            "description": "The committee's lines under the component."
          }
        },
        "required": [
          "id",
          "label",
          "position",
          "status",
          "lines"
        ],
        "additionalProperties": false,
        "description": "One component of a pathway: a heading of the pathway's shared structure. Every component the committee has not retired appears, in the structure's order, and its `lines` may be empty where nothing has been written under it; a retiring component carries that status.",
        "title": "Pathway component"
      },
      "MdPathwayLine": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "The committee's label for the line; may be empty."
          },
          "position": {
            "type": "integer",
            "description": "The line's place in the clinical sequence within its component, counting from 0."
          },
          "treatments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdPathwayTreatment"
            },
            "description": "The treatment options on the line."
          }
        },
        "required": [
          "label",
          "position",
          "treatments"
        ],
        "additionalProperties": false,
        "description": "One line of prescribing within a component: first line, second line and so on."
      },
      "MdPathwayTreatment": {
        "type": "object",
        "properties": {
          "drugs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdPathwayDrug"
            },
            "description": "The drugs or products that make up the treatment."
          }
        },
        "required": [
          "drugs"
        ],
        "additionalProperties": false,
        "description": "One treatment option on a line: one or more drugs or products given together. Treatments within a line carry no order.",
        "title": "Pathway treatment"
      },
      "MdPathwayDrug": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "vtm",
              "vmp"
            ],
            "description": "Whether the dm+d id names a drug (a VTM) or a product (a VMP)."
          },
          "dmdId": {
            "type": "string",
            "description": "The dm+d id, as a string."
          }
        },
        "required": [
          "kind",
          "dmdId"
        ],
        "additionalProperties": false,
        "description": "One drug or product named as a treatment on a pathway, by its dm+d id."
      }
    }
  }
}
