Prescriptions

The Prescriptions API manages medication requests (e-prescriptions) and medication statements. Prescriptions are created by providers and can be fulfilled at any participating pharmacy in the MediLoop marketplace.

Endpoints

POST/api/v1/medication-requests/Create a prescription
GET/api/v1/medication-requests/List prescriptions
GET/api/v1/medication-requests/{id}/Get prescription details
PUT/api/v1/medication-requests/{id}/Update prescription
POST/api/v1/medication-statements/Record medication statement
GET/api/v1/medication-statements/List medication statements

The MedicationRequest Object

Attributes

iduuid

Unique identifier.

prescription_numberstring

Human-readable prescription number.

patient_uhidstring

Patient UHID.

encounter_iduuidnullable

Associated encounter.

statusstring

Status: active, completed, cancelled, stopped.

intentstring

Intent: order, plan, proposal.

medication_codestring

Medication code (RxNorm or local).

medication_namestring

Medication display name.

dosage_instructionstring

Dosage instructions.

dose_quantitynumbernullable

Dose amount.

dose_unitstringnullable

Dose unit (mg, ml, etc.).

frequencystring

Frequency (e.g., "3 times daily").

duration_valuenumbernullable

Duration value.

duration_unitstringnullable

Duration unit (days, weeks).

quantitynumber

Total quantity to dispense.

refills_allowednumber

Number of refills allowed.

prescriber_iduuid

Prescribing provider ID.

prescriber_namestring

Prescriber name.

authored_ondatetime

When prescription was written.

fhir_medication_request_idstring

FHIR resource ID.

RESPONSE200
{
  "id": "rx-123-456-789",
  "prescription_number": "RX-2024-001234",
  "patient_uhid": "UG123456789A",
  "encounter_id": "enc-abc-123",
  "status": "active",
  "intent": "order",
  "medication_code": "308182",
  "medication_name": "Amoxicillin 500mg Capsule",
  "dosage_instruction": "Take 1 capsule 3 times daily with food",
  "dose_quantity": 500,
  "dose_unit": "mg",
  "frequency": "3 times daily",
  "duration_value": 7,
  "duration_unit": "days",
  "quantity": 21,
  "refills_allowed": 0,
  "prescriber_id": "prov-xyz-789",
  "prescriber_name": "Dr. Sarah Nakamya",
  "authored_on": "2024-01-15T10:30:00Z",
  "fhir_medication_request_id": "MedicationRequest/fhir-rx-123"
}

Create a Prescription

Creates a new medication request (e-prescription) for a patient.

POST/api/v1/medication-requests/

Request Body

patient_uhidstringrequired

Patient UHID

medication_codestringrequired

Medication code

medication_namestringrequired

Medication name

dosage_instructionstringrequired

Dosage instructions

quantitynumberrequired

Quantity to dispense

encounter_iduuidoptional

Associated encounter

dose_quantitynumberoptional

Dose amount

dose_unitstringoptional

Dose unit

frequencystringoptional

Frequency

duration_valuenumberoptional

Duration value

duration_unitstringoptional

Duration unit

refills_allowednumberoptional

Refills allowed

Default: 0

notesstringoptional

Additional notes

Request
bash
curl -X POST https://api.mediloop.co/api/v1/medication-requests/ \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG123456789A",
    "medication_code": "308182",
    "medication_name": "Amoxicillin 500mg Capsule",
    "dosage_instruction": "Take 1 capsule 3 times daily with food",
    "dose_quantity": 500,
    "dose_unit": "mg",
    "frequency": "3 times daily",
    "duration_value": 7,
    "duration_unit": "days",
    "quantity": 21,
    "encounter_id": "enc-abc-123"
  }'
RESPONSE201
{
  "id": "rx-new-123",
  "prescription_number": "RX-2024-001234",
  "patient_uhid": "UG123456789A",
  "status": "active",
  "medication_name": "Amoxicillin 500mg Capsule",
  "quantity": 21,
  "authored_on": "2024-01-15T10:30:00Z"
}

List Prescriptions

Retrieve prescriptions with filtering options.

GET/api/v1/medication-requests/

Query Parameters

patient_uhidstringoptional

Filter by patient

statusstringoptional

Filter by status

prescriber_iduuidoptional

Filter by prescriber

date_fromdateoptional

Filter from date

date_todateoptional

Filter to date

Request
bash
curl "https://api.mediloop.co/api/v1/medication-requests/?patient_uhid=UG123456789A&status=active" \
  -H "Authorization: Bearer sk_test_..."
RESPONSE200
{
  "count": 2,
  "results": [
    {
      "id": "rx-123",
      "prescription_number": "RX-2024-001234",
      "medication_name": "Amoxicillin 500mg",
      "status": "active",
      "authored_on": "2024-01-15T10:30:00Z"
    },
    {
      "id": "rx-124",
      "prescription_number": "RX-2024-001235",
      "medication_name": "Paracetamol 500mg",
      "status": "active",
      "authored_on": "2024-01-15T10:30:00Z"
    }
  ]
}

Prescription Status

StatusDescription
activePrescription is active and can be dispensed
completedPrescription has been fully dispensed
cancelledPrescription was cancelled
stoppedPrescription was stopped by provider
on-holdPrescription is temporarily on hold

MediLoop Marketplace

MediLoop is a national healthcare marketplace. Prescriptions created through the API can be fulfilled at any participating pharmacy. Patients have the freedom to choose where to purchase their medications.