ABDM API — Documents

Beta

Last updated: 4 October 2026

Browse Documentation▼

Document endpoints are POST and authenticated (Authorization: Bearer <idToken>). Each creates a FHIR Composition and pushes it to ABDM. Each returns a CompositionRes object (a composition FHIR resource). All use "patientNeeds" — at least one of abhaAddress (string) or patientId (number); omitting both yields 400 VALIDATION_ERROR.

The five document endpoints share these error codes (plus each endpoint's own extras):

INVALID_DOCTOR_GCP_FHIR_ID (400) · PATIENT_NOT_FOUND (404) · ENCOUNTER_NOT_FOUND (404) · NO_ACTIVE_ENCOUNTER (409) · ABDM_GATEWAY_ERROR (502) · LINK_TOKEN_MISSING (502) · LINK_TOKEN_RATE_LIMITED (429)

Encounter resolution

Every document is filed against an encounter (the ABDM care-context reference). Each of the five endpoints accepts an optional encounterId; resolution works the same way for all of them:

  1. encounterId supplied — that encounter is used. It must belong to the patient and to your organization, otherwise 404 ENCOUNTER_NOT_FOUND.
  2. encounterId omitted — the patient's open encounter is used (status in-progress, arrived, planned, triaged).
  3. No open encounter — the patient's most recent encounter is used, whatever its status (including finished) — so a discharged patient's documents still upload.
  4. No encounter at all — 409 NO_ACTIVE_ENCOUNTER. Create a visit with /opd_patient or /admit_patient before pushing a document.

File uploads

The four JSON document endpoints — /discharge_summary, /diagnostic_report, /op_consultation, /procedure_ot_notes — accept text/HTML only via their text / content fields. They cannot accept file attachments (no multipart upload).

Only /health_document accepts file uploads. It accepts PDF, JPEG or PNG files up to 5 MB each, across page1–page4, with a PDF uploaded on its own — a PDF cannot be combined with images. A file's type is determined from the file's own bytes, not from the Content-Type you send for that part, so a renamed or mislabelled file is rejected rather than silently stored as something else. Scanned PDFs can be sent directly — converting to images is no longer required.


/discharge_summary — POST (auth)

Creates a DischargeSummary composition and pushes it to ABDM.

Request fields

NameTypeRequiredDescription
doctorDetailsarrayYesArray of { doctorName, doctorGcpId }, min 1.
textstringYesSummary content (HTML allowed).
statusstringYesUse "final" — only final is pushed to ABDM.
datestringYesISO date.
compositionIdstringNoOptional composition id.
encounterIdstringNoAttach to a specific encounter (must belong to the patient and your org). When omitted, see Encounter resolution.
abhaAddressstring—*Patient's ABHA address.
patientIdnumber—*Nice HMS patient id.

* At least one of abhaAddress / patientId is required.

Example request

{
  "abhaAddress": "savitribilagi@sbx",
  "text": "<div>Cough with APD</div><div>cough</div><div>BP 140/80 PR 87/min RR 20/min</div>",
  "doctorDetails": [
    { "doctorName": "Dr Umesh Bilagi", "doctorGcpId": "cf4a6ab1-3f32-4b92-adc5-89489da6ca14" }
  ],
  "status": "final",
  "date": "2023-05-08T19:21:23.918Z"
}

Example response

{
  "composition": {
    "id": "e721069a-cc8c-4e5e-a437-b4cfcaee11a4",
    "resourceType": "Composition",
    "status": "final",
    "title": "DischargeSummary",
    "date": "2023-05-08T19:21:23.918Z",
    "subject": { "reference": "Patient/9b4ec056-991d-4237-b1fd-a65770349610" }
  }
}

Error codes

  • Shared document codes + shared auth codes.
  • ENCOUNTER_NOT_FOUND (404) — a supplied encounterId does not belong to this patient and org.
  • NO_ACTIVE_ENCOUNTER (409) — the patient has no encounter at all; create a visit first.

/diagnostic_report — POST (auth)

Creates a DiagnosticReport composition and pushes it to ABDM.

Request fields

NameTypeRequiredDescription
performerarrayYesArray of { doctorName, doctorGcpId }, min 1. The performer is who signs the report.
testNamestringYesNon-empty, e.g. "CT Abdomen".
categorystringYes"Hematology" | "Biochemistry" | "Microbiology" | "Radiology" | "Others".
textstringYesNon-empty report content (HTML allowed).
statusstringYesUse "final" — only final is pushed to ABDM.
requesterobjectNo{ doctorName, doctorGcpId }. If omitted, the requester is assumed to be the patient.
conclusionstringNoe.g. "Normal Study".
compositionIdstringNoOptional.
encounterIdstringNoAttach to a specific encounter (must belong to the patient and your org). When omitted, see Encounter resolution.
datestringNoISO date; defaults to the request timestamp when omitted.
abhaAddressstring—*Patient's ABHA address.
patientIdnumber—*Nice HMS patient id.

* At least one of abhaAddress / patientId is required.

Example request

{
  "abhaAddress": "savitribilagi@sbx",
  "performer": [
    { "doctorName": "Dr Umesh Bilagi", "doctorGcpId": "cf4a6ab1-3f32-4b92-adc5-89489da6ca14" }
  ],
  "testName": "CT Abdomen",
  "category": "Radiology",
  "text": "<div>Ultrasound Report ...</div>",
  "status": "final",
  "conclusion": "Normal Study"
}

Example response

Returns a CompositionRes object.

Error codes

  • INVALID_DOCTOR_GCP_FHIR_ID (400) — validates performer and requester.
  • PATIENT_NOT_FOUND (404) · ENCOUNTER_NOT_FOUND (404) · NO_ACTIVE_ENCOUNTER (409)
  • ABDM_GATEWAY_ERROR (502) · LINK_TOKEN_MISSING (502) · LINK_TOKEN_RATE_LIMITED (429)
  • shared codes

/op_consultation — POST (auth)

Creates an OP Consultation composition and pushes it to ABDM.

Request fields

NameTypeRequiredDescription
doctorDetailsarrayYesArray of { doctorName, doctorGcpId }, min 1.
datestringYesISO date of the consultation.
statusstringYesCurrent status of the consultation.
chiefComplaintsstringNoPrimary complaints reported by the patient.
medicalHistorystringNoPatient's past medical history.
physicalExaminationstringNoFindings from the physical examination.
medicinesarrayNoArray of { drug, frequency, instruction, duration, route }.
opdProcedureobjectNo{ procedureName, procedureDescription, date? }.
followUpobjectNo{ startDate, endDate?, comment }.
compositionIdstringNoOptional.
encounterIdstringNoAttach to a specific encounter (must belong to the patient and your org). When omitted, see Encounter resolution.
abhaAddressstring—*Patient's ABHA address.
patientIdnumber—*Nice HMS patient id.

* At least one of abhaAddress / patientId is required.

Example request

{
  "abhaAddress": "savitribilagi@sbx",
  "doctorDetails": [
    { "doctorName": "Dr Umesh Bilagi", "doctorGcpId": "cf4a6ab1-3f32-4b92-adc5-89489da6ca14" }
  ],
  "date": "2023-05-08T19:21:23.918Z",
  "status": "final",
  "chiefComplaints": "Cough and fever",
  "medicines": [
    { "drug": "Paracetamol", "frequency": "BD", "instruction": "After food", "duration": "5 days", "route": "Oral" }
  ]
}

Example response

Returns a CompositionRes object.

Error codes

  • INVALID_DOCTOR_GCP_FHIR_ID (400)
  • PATIENT_NOT_FOUND (404) · ENCOUNTER_NOT_FOUND (404) · NO_ACTIVE_ENCOUNTER (409)
  • ABDM_GATEWAY_ERROR (502) · LINK_TOKEN_MISSING (502) · LINK_TOKEN_RATE_LIMITED (429)
  • shared codes

/procedure_ot_notes — POST (auth)

Creates a procedure / OT-notes composition and pushes it to ABDM.

Request fields

NameTypeRequiredDescription
doctorDetailsarrayYesArray of { doctorName, doctorGcpId }, min 1.
datestringYesISO date of the procedure.
statusstringYesCurrent status of the procedure.
opdProcedureobjectNo{ procedureName, procedureDescription, date? }.
followUpobjectNo{ startDate, endDate?, comment }.
compositionIdstringNoOptional.
encounterIdstringNoAttach to a specific encounter (must belong to the patient and your org). When omitted, see Encounter resolution.
abhaAddressstring—*Patient's ABHA address.
patientIdnumber—*Nice HMS patient id.

* At least one of abhaAddress / patientId is required.

Example request

{
  "abhaAddress": "savitribilagi@sbx",
  "doctorDetails": [
    { "doctorName": "Dr Umesh Bilagi", "doctorGcpId": "cf4a6ab1-3f32-4b92-adc5-89489da6ca14" }
  ],
  "date": "2023-05-08T19:21:23.918Z",
  "status": "final",
  "opdProcedure": {
    "procedureName": "Appendectomy",
    "procedureDescription": "Laparoscopic appendectomy"
  }
}

Example response

Returns a CompositionRes object.

Error codes

  • INVALID_DOCTOR_GCP_FHIR_ID (400)
  • PATIENT_NOT_FOUND (404) · ENCOUNTER_NOT_FOUND (404) · NO_ACTIVE_ENCOUNTER (409)
  • ABDM_GATEWAY_ERROR (502) · LINK_TOKEN_MISSING (502) · LINK_TOKEN_RATE_LIMITED (429)
  • shared codes

/health_document — POST (multipart/form-data, auth)

Uploads a scanned health document (PDF, JPEG or PNG) and creates a HealthDocumentRecord composition. Each file must be under 5 MB.

Request fields (form fields)

NameTypeRequiredDescription
doctorDetailsstringYesJSON string, e.g. "[{\"doctorName\":\"Dr Umesh\",\"doctorGcpId\":\"...\"}]".
textstringYesTitle, e.g. "Prescription" or "Lab report".
statusstringYesOne of preliminary, final, amended, entered-in-error. Only final is pushed to ABDM.
datestringNoISO date.
compositionIdstringNoOptional.
encounterIdstringNoAttach to a specific encounter (must belong to the patient and your org). When omitted, see Encounter resolution.
abhaAddressstring—*Patient's ABHA address.
patientIdnumber—*Nice HMS patient id.

* At least one of abhaAddress / patientId is required.

Files

NameRequiredDescription
page1YesPDF, JPEG or PNG, ≤ 5 MB.
page2NoPDF, JPEG or PNG, ≤ 5 MB.
page3NoPDF, JPEG or PNG, ≤ 5 MB.
page4NoPDF, JPEG or PNG, ≤ 5 MB.

If one of page1–page4 is a PDF, it must be the only file in the request. Send the request as multipart/form-data using your client's multipart mode — do not set a Content-Type header by hand, or the multipart boundary is lost and the request is rejected.

Example response

Returns a CompositionRes object, plus:

NameDescription
abdmNotifiedtrue if the document was pushed to ABDM. false when status is not final.
abdmNotifiedReasonPresent only when abdmNotified is false — why it was not pushed.

Error codes

  • INVALID_REQUEST_METHOD (400) — non-POST method.
  • DOCTOR_DETAILS_REQUIRED (400) — doctorDetails form field missing.
  • VALIDATION_ERROR (400) — invalid form fields; unsupported file type; no file sent; a PDF combined with images.
  • VALIDATION_ERROR (413) — a file exceeds the 5 MB limit.
  • INVALID_DOCTOR_GCP_FHIR_ID (400)
  • PATIENT_NOT_FOUND (404) · ENCOUNTER_NOT_FOUND (404) · NO_ACTIVE_ENCOUNTER (409)
  • ABDM_GATEWAY_ERROR (502) · LINK_TOKEN_MISSING (502) · LINK_TOKEN_RATE_LIMITED (429)
  • shared codes
Was this page helpful?
Index
NICE HMS. 1st Gate Nehru Stadium, City Hubballi, District Dhrawad, State Karnataka, 580020
INDIA, Phone : +919611560555 email admin@nicehms.com, GST 29AEYPB4702Q1ZS
facebook
twitter
linkedin
youtube
RSS