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

  1. Sign up as a developer. Caresoft approves the sign-up and sends you a login.
  2. 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.
  3. Create your sandbox practice (demo patients and appointments, no messages sent) and connect your app to it.
  4. 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

ScopeWhat it gives
practice.readYour practice: name, locations, doctors and their specialties
patients.readPatients: name, gender, age or date of birth, mobile, email, city and record number
patients.writeRegister new patients
appointments.readAppointments and doctors' free slots
appointments.writeBook and cancel appointments
prescriptions.readFinalised prescriptions: diagnosis, medicines, advice and follow-up date
bills.readBills: items, amounts and payments
lab_orders.readLab 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.

ParameterTypeMeaning
location_idintegerLocation (default: the doctor's first).
datedateYYYY-MM-DD (default today).

GET /api/v1/patients

Patients, oldest first. Needs patients.read.

ParameterTypeMeaning
mobilestringFind by mobile number.
record_nostringFind by the practice's record number.
created_sincedateRegistered on or after this date.
afterintegerReturn records with id greater than this (use next_after from the previous page).
limitinteger1 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 fieldValue
namestring, required
gendermale | female | other, required
mobilestring
emailstring
citystring
date_of_birthYYYY-MM-DD
age_yearsinteger (if no date of birth)
consenttrue, required

GET /api/v1/appointments

Appointments. Needs appointments.read.

ParameterTypeMeaning
datedateOne day.
fromdateFrom date.
todateTo date.
doctor_idinteger
patient_idinteger
location_idinteger
statusstringbooked | checked_in | in_consult | done | cancelled | no_show
afterintegerReturn records with id greater than this (use next_after from the previous page).
limitinteger1 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 fieldValue
patient_idinteger, required
doctor_idinteger, required
location_idinteger, required
dateYYYY-MM-DD, required
timeHH:MM
typenew | followup | procedure | tele (default: worked out)
notesstring

POST /api/v1/appointments/{id}/cancel

Cancel an appointment. Needs appointments.write.

JSON fieldValue
reasonstring, required

GET /api/v1/prescriptions

Finalised prescriptions. Needs prescriptions.read.

ParameterTypeMeaning
fromdate
todate
patient_idinteger
doctor_idinteger
afterintegerReturn records with id greater than this (use next_after from the previous page).
limitinteger1 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.

ParameterTypeMeaning
formatstringfhir for a FHIR bundle.

GET /api/v1/bills

Bills with items and payments. Needs bills.read.

ParameterTypeMeaning
fromdate
todate
patient_idinteger
afterintegerReturn records with id greater than this (use next_after from the previous page).
limitinteger1 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.

ParameterTypeMeaning
patient_idinteger
afterintegerReturn records with id greater than this (use next_after from the previous page).
limitinteger1 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.

EventNeeds
appointment.createdappointments.read
appointment.updatedappointments.read
appointment.cancelledappointments.read
prescription.finalisedprescriptions.read
bill.createdbills.read
bill.cancelledbills.read
lab_order.createdlab_orders.read
lab_order.cancelledlab_orders.read
app.removedalways sent

The full description is also available as OpenAPI 3.