iClinic Developers

Therapy plans

The iClinic Integration API returns the therapy plans of a clinic's patients: how many sessions are done out of the total, and how much money has been collected.

DescriptionHTTP request
List therapy plansGET /therapy-plans
Get a therapy planGET /therapy-plans/{id}
  • The status is derived the same way as on the clinic's own screen: COMPLETED when all sessions are done, IN_PROGRESS when at least one session is done, CANCELLED when the plan is cancelled.

List therapy plans

GET/api/integration/v1/therapy-plans

Returns therapy plans ordered by last update, oldest first. completedSessions and paidAmount change when a session is recorded or a payment is collected, and updatedAt changes too. Requires the therapy:read scope.

Query parameters

ParameterDescription
updatedSincestring · date-timeoptional Returns only records whose updatedAt is at or after this time. Use an ISO 8601 date-time with a time zone, for example 2026-10-01T00:00:00.000Z. For how to use it, see Incremental sync.
cursorstringoptional The nextCursor value from the previous page, exactly as returned. Omit it on the first page. See Pagination.
limitintegeroptional From 1 to 500. Default 200.

Response 200

A page of therapy plans: { requestId, therapyPlans, nextCursor }. Each element of therapyPlans has the fields of a therapy plan, or is a deleted record (tombstone). If nextCursor is not null, there is a next page.

Errors

Error codeWhen
INVALID_UPDATED_SINCE400updatedSince is not an ISO 8601 date-time with a time zone, or appears more than once.
INVALID_CURSOR400cursor is not valid, or was issued by a different endpoint.
INVALID_LIMIT400limit is not an integer from 1 to 500.
UNKNOWN_PARAMETER400A parameter that is not listed under “Query parameters”, including one with a misspelled name.
INSUFFICIENT_SCOPE403The API key does not have the therapy:read scope.

Every endpoint can also return 401, 429 and 5xx. See Error codes.

curl
curl -sS "https://iclinic.phongkhamhieploi.vn/api/integration/v1/therapy-plans?limit=200" \
  -H "Authorization: Bearer $ICLINIC_API_KEY"
200 GET /therapy-plans?limit=2
{
  "requestId": "req_7c1f3a",
  "therapyPlans": [
    {
      "id": "7b2e4d90-1a63-4c85-b7f0-3d9a6c1e8b52",
      "code": "LT-20261001-001",
      "patientId": "5b0d6a38-3f5a-4a52-8f7c-1d2e9c4b7a10",
      "name": "Liệu trình châm cứu 10 buổi",
      "sessionCount": 10,
      "completedSessions": 4,
      "status": "IN_PROGRESS",
      "totalPrice": 3500000,
      "paidAmount": 3500000,
      "createdAt": "2026-10-01T02:00:00.000Z",
      "updatedAt": "2026-10-12T07:30:00.000Z",
      "deletedAt": null
    }
  ],
  "nextCursor": null
}

Get a therapy plan

GET/api/integration/v1/therapy-plans/{id}

Returns one therapy plan by id, or a tombstone if the therapy plan was deleted. Requires the therapy:read scope.

Path parameters

ParameterDescription
idstringrequired The id of the therapy plan: the id field of an element returned by List therapy plans.

Response 200

{ requestId, therapyPlan }. therapyPlan is either a therapy plan, with the fields listed under “A therapy plan”, or a tombstone.

A therapy plan

FieldMeaning
idstringStable ID of the therapy plan. It never changes. Use it as the deduplication key.
codestringThe therapy plan code shown to users. For reference only.
patientIdstring | nullThe id of the patient in /patients; null if the therapy plan is not linked to a patient record.
namestringName of the therapy plan.
sessionCountintegerTotal number of sessions in the therapy plan.
completedSessionsintegerNumber of sessions already done.
statusenum
  • NEW no session done yet
  • IN_PROGRESS in progress
  • COMPLETED all sessions done
  • CANCELLED cancelled
totalPriceintegerTotal price of the therapy plan, in Vietnamese dong (VND).
paidAmountintegerAmount collected for the therapy plan, in VND. It decreases when a payment receipt is refunded.
createdAtdate-timeWhen the record was created, in Coordinated Universal Time (UTC).
updatedAtdate-timeWhen the record last changed (UTC). Together with id, it is the sort key for sync.
deletedAtnullAlways null for a record that still exists.

Deleted record (tombstone)

FieldMeaning
idstringThe id of the deleted therapy plan.
deletedAtdate-timeWhen the record was deleted or merged (UTC). If this field has a value, the record is a tombstone: delete this record on your side.
updatedAtdate-timeWhen the record last changed (UTC). Together with id, it is the sort key for sync.

Errors

Error codeWhen
UNKNOWN_PARAMETER400The request has a query parameter. This endpoint accepts only id in the path.
INSUFFICIENT_SCOPE403The API key does not have the therapy:read scope.
NOT_FOUND404No record has this id, or the record belongs to another clinic. Both cases return an identical response.

Every endpoint can also return 401, 429 and 5xx. See Error codes.

curl
curl -sS "https://iclinic.phongkhamhieploi.vn/api/integration/v1/therapy-plans/$THERAPY_PLAN_ID" \
  -H "Authorization: Bearer $ICLINIC_API_KEY"
200 GET /therapy-plans/{id}
{
  "requestId": "req_7c1f3a",
  "therapyPlan": {
    "id": "7b2e4d90-1a63-4c85-b7f0-3d9a6c1e8b52",
    "code": "LT-20261001-001",
    "patientId": "5b0d6a38-3f5a-4a52-8f7c-1d2e9c4b7a10",
    "name": "Liệu trình châm cứu 10 buổi",
    "sessionCount": 10,
    "completedSessions": 4,
    "status": "IN_PROGRESS",
    "totalPrice": 3500000,
    "paidAmount": 3500000,
    "createdAt": "2026-10-01T02:00:00.000Z",
    "updatedAt": "2026-10-12T07:30:00.000Z",
    "deletedAt": null
  }
}
200 Deleted therapy plan
{
  "requestId": "req_7c1f3a",
  "therapyPlan": {
    "id": "9e3a5c17-2d48-4f60-a1b9-7c0d6e8f4b35",
    "deletedAt": "2026-10-05T03:00:00.000Z",
    "updatedAt": "2026-10-05T03:00:00.000Z"
  }
}