CareRx API reference
Version 1 of the CareRx API is a JSON REST API. Apps connect to a practice with OAuth 2.0 (authorization code, optional PKCE), call /api/v1 with a bearer token, see only what the practice owner approved and receive signed webhooks when appointments, prescriptions, bills and lab orders change.
Getting started
- Sign up as a developer. Caresoft approves the sign-up and sends you a login.
- In the developer portal, register an app: you get a client id and a client secret. Add your redirect addresses and choose the permissions (scopes) you need.
- Create your sandbox practice (demo patients and appointments, no messages sent) and connect your app to it.
- Send the app for review. Once Caresoft makes it live, any practice owner can connect it from Settings → Apps.
Connecting to a practice (OAuth 2.0)
Send the practice owner to https://carerx.caresoft.co.in/oauth/authorize?response_type=code&client_id=…&redirect_uri=…&scope=…&state=… (PKCE with code_challenge and code_challenge_method=S256 is supported). The owner signs in, sees what your app asks for and allows it. CareRx sends them back to your redirect address with code and your state.
Exchange the code within 10 minutes: POST https://carerx.caresoft.co.in/oauth/token with grant_type=authorization_code, code, redirect_uri (and code_verifier), authenticating with HTTP Basic (client id and secret). The reply has access_token (valid 60 minutes), refresh_token, install_id and practice. A code works once.
Refresh with grant_type=refresh_token: each refresh token works once and you get a new pair. Revoke a token at POST https://carerx.caresoft.co.in/oauth/revoke. When the practice removes your app, its tokens stop at once and you receive app.removed.
Calls
Base address https://carerx.caresoft.co.in/api/v1. Send Authorization: Bearer <access token>. JSON in and out; dates are YYYY-MM-DD, times are the practice's local time, timestamps ISO 8601. Lists page by id: pass after = the next_after of the previous page until it is null.
Errors: {"error": {"code": "…", "message": "…"}} — 401 token missing or expired, 403 permission not given or app not live, 404 not found, 409 duplicate, 422 the request did not pass a check (the message says why), 429 too many calls (default 120 a minute for each practice; see Retry-After). For POST, send an Idempotency-Key header to make retries safe: the same key within 24 hours returns the first reply.
Permissions
| Scope | What it gives |
|---|---|
practice.read | Your practice: name, locations, doctors and their specialties |
patients.read | Patients: name, gender, age or date of birth, mobile, email, city and record number |
patients.write | Register new patients |
appointments.read | Appointments and doctors' free slots |
appointments.write | Book and cancel appointments |
prescriptions.read | Finalised prescriptions: diagnosis, medicines, advice and follow-up date |
bills.read | Bills: items, amounts and payments |
lab_orders.read | Lab tests ordered for patients |
Endpoints
GET /api/v1/me
Who you are connected as: app, practice, install id and the permissions the practice gave.
GET /api/v1/practice
The practice: name, country, currency, time zone, locations and doctors (with the locations they sit at). Needs practice.read.
GET /api/v1/doctors/{id}/slots
Free appointment times for a doctor on a date. Needs appointments.read.
| Parameter | Type | Meaning |
|---|---|---|
location_id | integer | Location (default: the doctor's first). |
date | date | YYYY-MM-DD (default today). |
GET /api/v1/patients
Patients, oldest first. Needs patients.read.
| Parameter | Type | Meaning |
|---|---|---|
mobile | string | Find by mobile number. |
record_no | string | Find by the practice's record number. |
created_since | date | Registered on or after this date. |
after | integer | Return records with id greater than this (use next_after from the previous page). |
limit | integer | 1 to 100, default 50. |
GET /api/v1/patients/{id}
One patient. Needs patients.read.
POST /api/v1/patients
Register a patient. Send "consent": true only once the patient has agreed to be registered with the practice. 409 if a patient with the same mobile and a similar name is already registered (the reply gives that patient's id). Needs patients.write.
| JSON field | Value |
|---|---|
name | string, required |
gender | male | female | other, required |
mobile | string |
email | string |
city | string |
date_of_birth | YYYY-MM-DD |
age_years | integer (if no date of birth) |
consent | true, required |
GET /api/v1/appointments
Appointments. Needs appointments.read.
| Parameter | Type | Meaning |
|---|---|---|
date | date | One day. |
from | date | From date. |
to | date | To date. |
doctor_id | integer | |
patient_id | integer | |
location_id | integer | |
status | string | booked | checked_in | in_consult | done | cancelled | no_show |
after | integer | Return records with id greater than this (use next_after from the previous page). |
limit | integer | 1 to 100, default 50. |
GET /api/v1/appointments/{id}
One appointment. Needs appointments.read.
POST /api/v1/appointments
Book an appointment. The time must be one of the doctor's free slots; without a time the patient joins the day's queue. Patients get the practice's usual confirmation message. Needs appointments.write.
| JSON field | Value |
|---|---|
patient_id | integer, required |
doctor_id | integer, required |
location_id | integer, required |
date | YYYY-MM-DD, required |
time | HH:MM |
type | new | followup | procedure | tele (default: worked out) |
notes | string |
POST /api/v1/appointments/{id}/cancel
Cancel an appointment. Needs appointments.write.
| JSON field | Value |
|---|---|
reason | string, required |
GET /api/v1/prescriptions
Finalised prescriptions. Needs prescriptions.read.
| Parameter | Type | Meaning |
|---|---|---|
from | date | |
to | date | |
patient_id | integer | |
doctor_id | integer | |
after | integer | Return records with id greater than this (use next_after from the previous page). |
limit | integer | 1 to 100, default 50. |
GET /api/v1/prescriptions/{id}
One finalised prescription: diagnosis, medicines, advice, follow-up date and the verify link. Add ?format=fhir for an ABDM (NRCES) FHIR R4 PrescriptionRecord bundle. Needs prescriptions.read.
| Parameter | Type | Meaning |
|---|---|---|
format | string | fhir for a FHIR bundle. |
GET /api/v1/bills
Bills with items and payments. Needs bills.read.
| Parameter | Type | Meaning |
|---|---|---|
from | date | |
to | date | |
patient_id | integer | |
after | integer | Return records with id greater than this (use next_after from the previous page). |
limit | integer | 1 to 100, default 50. |
GET /api/v1/bills/{id}
One bill. Needs bills.read.
GET /api/v1/lab-orders
Lab tests ordered. Needs lab_orders.read.
| Parameter | Type | Meaning |
|---|---|---|
patient_id | integer | |
after | integer | Return records with id greater than this (use next_after from the previous page). |
limit | integer | 1 to 100, default 50. |
GET /api/v1/lab-orders/{id}
One lab order. Needs lab_orders.read.
Webhooks
Give a webhook address (https) and choose events. CareRx POSTs {"id", "type", "created", "install_id", "practice_id", "data"}, where data is the same object the API returns. Headers: X-CareRx-Event, X-CareRx-Delivery (the event id — use it to ignore repeats) and X-CareRx-Signature: t=<unix time>,v1=<hex>, the HMAC-SHA256 of t + "." + body with your signing secret. Check the signature and reject times more than 5 minutes old. Reply 2xx within 10 seconds; failed deliveries are retried for about a day and can be retried from the portal.
| Event | Needs |
|---|---|
appointment.created | appointments.read |
appointment.updated | appointments.read |
appointment.cancelled | appointments.read |
prescription.finalised | prescriptions.read |
bill.created | bills.read |
bill.cancelled | bills.read |
lab_order.created | lab_orders.read |
lab_order.cancelled | lab_orders.read |
app.removed | always sent |
The full description is also available as OpenAPI 3.