Prescription Marketplace
Function-calling namespace: prescriptionMarketplace
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
acceptQuote
Source: backend/endpoints/prescription-marketplace/accept-quote
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
quoteId | string | Yes | - |
patientId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "acceptQuote",
"data": {
"quoteId": "quote_123"
}
}'Example Response
{
"status": "ok",
"data": {
"success": true,
"item": {
"id": "rx_req_123",
"patientId": "patient_123",
"organizationId": "org_123",
"organizationBranchId": "branch_123",
"uploadedFileUrl": "https://cdn.example.com/prescriptions/rx.pdf",
"status": "BROADCASTED",
"items": [
{
"id": "rx_item_123",
"prescriptionRequestId": "rx_req_123",
"medicineName": "Amoxicillin 500mg",
"medicineType": "Tablet",
"quantity": 15,
"productIds": ["product_123", "product_456"],
"products": [
{
"id": "product_123",
"name": "Amoxicillin 500mg",
"code": "AMX500",
"brandName": "Aivida Pharma",
"medicineType": "Tablet",
"strength": "500",
"strengthUnit": "mg",
"mrp": 50,
"sellingPrice": 45,
"currency": "INR",
"availableStock": 120
}
]
}
],
"broadcasts": [
{
"id": "broadcast_123",
"prescriptionRequestId": "rx_req_123",
"organizationId": "org_123",
"organizationBranchId": "branch_123",
"status": "VIEWED",
"createdAt": 1717075200000
}
],
"createdAt": 1717075200000,
"updatedAt": 1717075200000
}
}
}Detail Response Notes
items[].productIdscontains the mapped product IDs for the requested medicine.items[].productscontains the matching product options from the pharmacy catalog for quote creation.- Send either
broadcastIdorprescriptionRequestId;organizationIdis required.
cancelPrescription
Source: backend/endpoints/prescription-marketplace/cancel-prescription
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
prescriptionRequestId | string | Yes | - |
patientId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "cancelPrescription",
"data": {
"prescriptionRequestId": "prescriptionrequest_123"
}
}'Example Response
{
"status": "ok",
"data": {
"items": [
{
"prescriptionId": "rx_req_123",
"name": "Aisha Khan",
"available": 2,
"amount": 135,
"receivedDate": 1717075200000,
"status": "QUOTED"
}
],
"total": 1,
"page": 1,
"pageSize": 20,
"totalPages": 1
}
}Response Fields
| Field | Type | Description |
|---|---|---|
items[].prescriptionId | string | Uploaded prescription request ID used to open the detail screen |
items[].name | string | Patient full name |
items[].available | integer | Number of submitted quotes available for this prescription |
items[].amount | number | Lowest submitted quote grand_total; 0 when no quote exists |
items[].receivedDate | integer | Prescription request created timestamp in unix milliseconds |
items[].status | string | Prescription request status |
getMyPrescriptions
Source: backend/endpoints/prescription-marketplace/get-my-prescriptions
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
patientId | string | No | - |
status | string | No | - |
page | integer | No | - |
pageSize | integer | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "getMyPrescriptions",
"data": {
"patientId": "patient_123",
"status": "scheduled"
}
}'Example Response
{
"status": "ok",
"data": {
"success": true,
"item": {
"id": "rx_req_123",
"patientId": "patient_123",
"organizationId": "org_123",
"organizationBranchId": "branch_123",
"uploadedFileUrl": "https://cdn.example.com/prescriptions/rx.pdf",
"status": "BROADCASTED",
"createdAt": 1717075200000,
"updatedAt": 1717075200000
}
}
}getPharmacyPrescriptionDetails
Source: backend/endpoints/prescription-marketplace/get-pharmacy-prescription-details
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
broadcastId | string | No | - |
prescriptionRequestId | string | No | - |
organizationId | string | Yes | - |
organizationBranchId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "getPharmacyPrescriptionDetails",
"data": {
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }getPrescriptionDetails
Source: backend/endpoints/prescription-marketplace/get-prescription-details
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
prescriptionRequestId | string | Yes | - |
patientId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "getPrescriptionDetails",
"data": {
"prescriptionRequestId": "prescriptionrequest_123"
}
}'Example Response
{ "status": "ok", "data": {} }getQuotations
Source: backend/endpoints/prescription-marketplace/get-quotations
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
prescriptionRequestId | string | Yes | - |
patientId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "getQuotations",
"data": {
"prescriptionRequestId": "prescriptionrequest_123"
}
}'Example Response
{ "status": "ok", "data": {} }pendingList
Source: backend/endpoints/prescription-marketplace/pending-list
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
organizationBranchId | string | No | - |
status | string | No | - |
page | integer | No | - |
pageSize | integer | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "pendingList",
"data": {
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }rejectPrescription
Source: backend/endpoints/prescription-marketplace/reject-prescription
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
broadcastId | string | Yes | - |
organizationId | string | Yes | - |
reason | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "rejectPrescription",
"data": {
"broadcastId": "broadcast_123",
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }rejectQuote
Source: backend/endpoints/prescription-marketplace/reject-quote
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
quoteId | string | Yes | - |
patientId | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "rejectQuote",
"data": {
"quoteId": "quote_123"
}
}'Example Response
{ "status": "ok", "data": {} }saveDraftQuote
Source: backend/endpoints/prescription-marketplace/save-draft-quote
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
broadcastId | string | Yes | - |
organizationId | string | Yes | - |
discount | number | No | - |
deliveryCharge | number | No | - |
tax | number | No | - |
remarks | string | No | - |
items | array<object> | No | - |
Nested Field Structures
items item
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | No | - |
quoteId | string | No | - |
productId | string | No | - |
requestedMedicineName | string | No | - |
quantity | integer | No | - |
mrp | number | No | - |
sellingPrice | number | No | - |
finalPrice | number | No | - |
available | boolean | No | - |
substituteProductId | string | No | - |
remarks | string | No | - |
productName | string | No | - |
substituteProductName | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "saveDraftQuote",
"data": {
"broadcastId": "broadcast_123",
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }searchProducts
Source: backend/endpoints/prescription-marketplace/search-products
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
keyword | string | No | - |
genericName | string | No | - |
medicineType | string | No | - |
strength | string | No | - |
page | integer | No | - |
pageSize | integer | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "searchProducts",
"data": {
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }submitQuote
Source: backend/endpoints/prescription-marketplace/submit-quote
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
quoteId | string | Yes | - |
organizationId | string | Yes | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "submitQuote",
"data": {
"quoteId": "quote_123",
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }updateQuote
Source: backend/endpoints/prescription-marketplace/update-quote
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
quoteId | string | Yes | - |
organizationId | string | Yes | - |
discount | number | No | - |
deliveryCharge | number | No | - |
tax | number | No | - |
remarks | string | No | - |
items | array<object> | No | - |
Nested Field Structures
items item
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | No | - |
quoteId | string | No | - |
productId | string | No | - |
requestedMedicineName | string | No | - |
quantity | integer | No | - |
mrp | number | No | - |
sellingPrice | number | No | - |
finalPrice | number | No | - |
available | boolean | No | - |
substituteProductId | string | No | - |
remarks | string | No | - |
productName | string | No | - |
substituteProductName | string | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "updateQuote",
"data": {
"quoteId": "quote_123",
"organizationId": "org_123"
}
}'Example Response
{ "status": "ok", "data": {} }uploadPrescription
Source: backend/endpoints/prescription-marketplace/upload-prescription
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
patientId | string | Yes | - |
organizationId | string | No | - |
organizationBranchId | string | No | - |
uploadedFileUrl | string | Yes | - |
addressId | string | No | - |
latitude | number | No | nullable |
longitude | number | No | nullable |
radiusKm | number | No | nullable |
items | array<object> | No | - |
Nested Field Structures
items item
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | No | - |
prescriptionRequestId | string | No | - |
medicineName | string | No | - |
strength | string | No | - |
strengthUnit | string | No | - |
medicineType | string | No | - |
quantity | integer | No | - |
notes | string | No | - |
productIds | array<string> | No | - |
products | array<object> | No | - |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "prescriptionMarketplace",
"apiName": "uploadPrescription",
"data": {
"patientId": "patient_123",
"uploadedFileUrl": "value"
}
}'Example Response
{ "status": "ok", "data": {} }