Dashboard

OPCS-4 API

Look up OPCS-4 (Office of Population Censuses and Surveys Classification of Interventions and Procedures) codes used by NHS England.

Overview

OPCS-4 is the standard procedure classification used by NHS England for hospital episode statistics, clinical coding, and reimbursement. FHIRfly provides access to OPCS-4.11, published under the Open Government Licence v3.0 (Crown copyright).

Endpoints

MethodPathDescription
GET/v1/opcs4/:codeSingle OPCS-4 code lookup
POST/v1/opcs4/_batchBatch lookup (up to 100)
GET/v1/opcs4/shapesList available response shapes

Single Lookup

Look up primary hip replacement

Request
Node.js
const response = await fetch(
  "https://api.fhirfly.io/v1/opcs4/W37.1",
  {
    method: "GET",
    headers: {
    "x-api-key": "YOUR_API_KEY",
  }
  }
);

const data = await response.json();
console.log(data);
Response
JSON
{
  "data": {
    "code": "W37.1",
    "display": "Primary total prosthetic replacement of hip joint using cement",
    "chapter": "W",
    "chapter_title": "Other bones and joints of skeleton",
    "category": "W37",
    "category_title": "Total prosthetic replacement of hip joint using cement",
    "version": "4.11",
    "fhir_coding": {
      "code": "W37.1",
      "display": "Primary total prosthetic replacement of hip joint using cement",
      "system": "https://fhir.nhs.uk/Id/opcs-4"
    }
  },
  "meta": {
    "legal": {
      "attribution_required": true,
      "citation": "The OPCS Classification of Interventions and Procedures, Crown copyright. Open Government Licence v3.0.",
      "license": "OGL-UK-3.0",
      "source_name": "NHS England OPCS-4"
    }
  }
}

Common OPCS-4 Codes

CodeDescription
W37.1Primary total hip replacement using cement
W40.1Primary total knee replacement using cement
G45.1Fibreoptic endoscopic examination of upper GI tract
K63.1Percutaneous transluminal coronary angioplasty
Y53.1Approach to organ under ultrasonic guidance

Batch Lookup

Look up multiple OPCS-4 codes in a single request (up to 100):

Look up multiple procedure codes

Request
Node.js
const response = await fetch(
  "https://api.fhirfly.io/v1/opcs4/_batch",
  {
    method: "POST",
    headers: {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
    body: JSON.stringify({
    "codes": [
      "W37.1",
      "W40.1",
      "G45.1"
    ]
  })
  }
);

const data = await response.json();
console.log(data);
Response
JSON
{
  "count": 3,
  "results": [
    {
      "input": "W37.1",
      "code": "W37.1",
      "status": "ok",
      "data": {
        "display": "Primary total prosthetic replacement of hip joint using cement",
        "chapter": "W"
      }
    },
    {
      "input": "W40.1",
      "code": "W40.1",
      "status": "ok",
      "data": {
        "display": "Primary total prosthetic replacement of knee joint using cement",
        "chapter": "W"
      }
    },
    {
      "input": "G45.1",
      "code": "G45.1",
      "status": "ok",
      "data": {
        "display": "Fibreoptic endoscopic examination of upper gastrointestinal tract",
        "chapter": "G"
      }
    }
  ],
  "meta": {
    "legal": {
      "license": "OGL-UK-3.0",
      "attribution_required": true,
      "source_name": "NHS England OPCS-4"
    }
  }
}

Batch with shape=full

When using shape=full on batch requests, the response includes meta.source with provenance information:

POST /v1/opcs4/_batch?shape=full
{
  "count": 3,
  "results": [
    {
      "input": "W37.1",
      "code": "W37.1",
      "status": "ok",
      "data": {
        "display": "Primary total prosthetic replacement of hip joint using cement",
        "chapter": "W"
      }
    }
  ],
  "meta": {
    "source": {
      "name": "NHS England OPCS-4",
      "url": "https://isd.digital.nhs.uk/trud/",
      "version": "4.11",
      "fhirfly_updated_at": "2026-03-01T03:00:00Z"
    },
    "legal": {
      "license": "OGL-UK-3.0",
      "attribution_required": true
    }
  }
}

Code Format

OPCS-4 codes follow the pattern: a letter followed by digits and a decimal point.

InputValidDescription
W37.1YesHip replacement
G45.1YesUpper GI endoscopy
K63.1YesCoronary angioplasty
12345NoNumeric-only format

Response Shapes

Control the level of detail in responses with the shape query parameter:

ShapeDescription
compactCode, display, chapter
standard+ category, version, fhir_coding
full+ ingest metadata, provenance
# Minimal data
GET /v1/opcs4/W37.1?shape=compact

# Standard data (default)
GET /v1/opcs4/W37.1?shape=standard

# Full data with provenance
GET /v1/opcs4/W37.1?shape=full

See Response Shapes for field details.

License Notice

OPCS-4 data is Crown copyright and provided under the Open Government Licence v3.0. The meta.legal field in every response provides the required attribution text.

Required Scopes

  • opcs4.read - Single and batch lookups

See Also