Invoices

Invoices may link to patients, corporate accounts, and queue visits.

The invoices model

Properties

  • Name
    id
    Type
    string
    Description

    Invoice UUID.

  • Name
    invoiceNumber
    Type
    string
    Description

    Display invoice number.

  • Name
    status
    Type
    string
    Description

    DRAFT, PENDING, PAID, VOID, etc.

  • Name
    totalAmount
    Type
    number
    Description

    Invoice total.

  • Name
    outstandingAmount
    Type
    number
    Description

    Amount still due.


GET/api/invoices

List invoices

Search, status, date, and branch filters.

Query parameters

Query parameters: page, pageSize, search, status.

Request

GET
/api/invoices
curl -X GET http://localhost:3000/api/invoices \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "data": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "invoiceNumber": "INV-0042",
      "status": "PENDING",
      "totalAmount": 150,
      "outstandingAmount": 150,
      "patient": {
        "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "patientName": "Ahmad bin Ali",
        "patientNumber": "P-00042"
      },
      "issueDate": "2026-10-05T06:30:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 20,
    "total": 1,
    "totalPages": 1
  }
}

POST/api/invoices

Create invoice

Create with line items; may deduct stock.

Request

POST
/api/invoices
curl -X POST http://localhost:3000/api/invoices \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d "{\"patientId\":\"PATIENT_UUID\",\"items\":[]}"

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "invoiceNumber": "INV-0043",
  "status": "DRAFT",
  "totalAmount": 80,
  "outstandingAmount": 80,
  "patientId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}

GET/api/invoices/:id

Retrieve invoice

Invoice with line items and payments.

Request

GET
/api/invoices/:id
curl -X GET http://localhost:3000/api/invoices/:id \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "invoiceNumber": "INV-0042",
  "status": "PENDING",
  "subtotal": 150,
  "totalAmount": 150,
  "outstandingAmount": 150,
  "items": [
    {
      "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "name": "Consultation",
      "quantity": 1,
      "unitPrice": 150,
      "total": 150
    }
  ],
  "payments": []
}

PATCH/api/invoices/:id

Update invoice

Update header or status where allowed.

Request

PATCH
/api/invoices/:id
curl -X PATCH http://localhost:3000/api/invoices/:id \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "PENDING"
}

POST/api/invoices/:id/payments

Record payment

Apply a payment to the invoice.

Request

POST
/api/invoices/:id/payments
curl -X POST http://localhost:3000/api/invoices/:id/payments \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "invoiceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "amount": 150,
  "status": "COMPLETED",
  "paymentDate": "2026-10-05T06:30:00.000Z"
}

Was this page helpful?