/pharmacy/:pharmacyId/rx
Creates a new prescription for a patient in the specified pharmacy system. This endpoint accepts prescription details including drugs, dosages, and prescriber information.
idstring (optional) - Custom prescription identifier for queue messagingcustomerIdstring (required) - Customer IDcreatedBystring (optional) - Prescriber informationauthorizedBystring (optional) - Authorizing providercreatedAtstring (optional) - ISO date formatdrugsRxDrug[] (optional) - Array of prescription drugsnotesstring (optional) - Prescription notesfulfillmentsFulfillment[] (optional) - Fulfillment historyisVerbalboolean (optional) - Whether prescription is verbalmetaany (optional) - Additional metadataextrasany (optional) - Additional dataconst response = await fetch('/api/pharmacy/123/rx', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
},
body: JSON.stringify({
id: 'custom-prescription-456', // Optional: will use generated ID if not provided
customerId: 'customer_id_here',
createdBy: 'Dr. Smith [MD#12345]',
drugs: [
{
din: '12345678',
drugName: 'Acetaminophen',
strength: '500mg',
mitte: 30,
refills: 2,
notes: 'Take 1-2 tablets every 4-6 hours as needed for pain',
mitteType: 'pills',
daysSupply: 15
},
{
din: '87654321',
drugName: 'Ibuprofen',
strength: '400mg',
mitte: 20,
refills: 1,
notes: 'Take 1 tablet every 6-8 hours as needed',
mitteType: 'pills',
daysSupply: 10
}
],
notes: 'Patient has no known allergies. Monitor for side effects.',
isVerbal: false,
meta: {
visitType: 'follow-up',
diagnosis: 'Chronic pain management'
}
})
});
const result = await response.json();
console.log('Prescription creation result:', result);
// Example response:
// {
// "success": true,
// "message": "Prescription creation request queued successfully",
// "data": {
// "id": "rx-1703123456789",
// "pharmacyId": "123",
// "queueMessageId": "msg-def456",
// "status": "queued",
// "createdAt": "2023-12-21T10:30:56.789Z"
// }
// }