EndpointsPrescription Marketplace

Prescription Marketplace

Function-calling namespace: prescriptionMarketplace

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

acceptQuote

Source: backend/endpoints/prescription-marketplace/accept-quote

Input Fields

FieldTypeRequiredConstraints
quoteIdstringYes-
patientIdstringNo-

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[].productIds contains the mapped product IDs for the requested medicine.
  • items[].products contains the matching product options from the pharmacy catalog for quote creation.
  • Send either broadcastId or prescriptionRequestId; organizationId is required.

cancelPrescription

Source: backend/endpoints/prescription-marketplace/cancel-prescription

Input Fields

FieldTypeRequiredConstraints
prescriptionRequestIdstringYes-
patientIdstringNo-

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

FieldTypeDescription
items[].prescriptionIdstringUploaded prescription request ID used to open the detail screen
items[].namestringPatient full name
items[].availableintegerNumber of submitted quotes available for this prescription
items[].amountnumberLowest submitted quote grand_total; 0 when no quote exists
items[].receivedDateintegerPrescription request created timestamp in unix milliseconds
items[].statusstringPrescription request status

getMyPrescriptions

Source: backend/endpoints/prescription-marketplace/get-my-prescriptions

Input Fields

FieldTypeRequiredConstraints
patientIdstringNo-
statusstringNo-
pageintegerNo-
pageSizeintegerNo-

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

FieldTypeRequiredConstraints
broadcastIdstringNo-
prescriptionRequestIdstringNo-
organizationIdstringYes-
organizationBranchIdstringNo-

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

FieldTypeRequiredConstraints
prescriptionRequestIdstringYes-
patientIdstringNo-

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

FieldTypeRequiredConstraints
prescriptionRequestIdstringYes-
patientIdstringNo-

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

FieldTypeRequiredConstraints
organizationIdstringYes-
organizationBranchIdstringNo-
statusstringNo-
pageintegerNo-
pageSizeintegerNo-

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

FieldTypeRequiredConstraints
broadcastIdstringYes-
organizationIdstringYes-
reasonstringNo-

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

FieldTypeRequiredConstraints
quoteIdstringYes-
patientIdstringNo-

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

FieldTypeRequiredConstraints
broadcastIdstringYes-
organizationIdstringYes-
discountnumberNo-
deliveryChargenumberNo-
taxnumberNo-
remarksstringNo-
itemsarray<object>No-

Nested Field Structures

items item

FieldTypeRequiredConstraints
idstringNo-
quoteIdstringNo-
productIdstringNo-
requestedMedicineNamestringNo-
quantityintegerNo-
mrpnumberNo-
sellingPricenumberNo-
finalPricenumberNo-
availablebooleanNo-
substituteProductIdstringNo-
remarksstringNo-
productNamestringNo-
substituteProductNamestringNo-

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

FieldTypeRequiredConstraints
organizationIdstringYes-
keywordstringNo-
genericNamestringNo-
medicineTypestringNo-
strengthstringNo-
pageintegerNo-
pageSizeintegerNo-

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

FieldTypeRequiredConstraints
quoteIdstringYes-
organizationIdstringYes-

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

FieldTypeRequiredConstraints
quoteIdstringYes-
organizationIdstringYes-
discountnumberNo-
deliveryChargenumberNo-
taxnumberNo-
remarksstringNo-
itemsarray<object>No-

Nested Field Structures

items item

FieldTypeRequiredConstraints
idstringNo-
quoteIdstringNo-
productIdstringNo-
requestedMedicineNamestringNo-
quantityintegerNo-
mrpnumberNo-
sellingPricenumberNo-
finalPricenumberNo-
availablebooleanNo-
substituteProductIdstringNo-
remarksstringNo-
productNamestringNo-
substituteProductNamestringNo-

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

FieldTypeRequiredConstraints
patientIdstringYes-
organizationIdstringNo-
organizationBranchIdstringNo-
uploadedFileUrlstringYes-
addressIdstringNo-
latitudenumberNonullable
longitudenumberNonullable
radiusKmnumberNonullable
itemsarray<object>No-

Nested Field Structures

items item

FieldTypeRequiredConstraints
idstringNo-
prescriptionRequestIdstringNo-
medicineNamestringNo-
strengthstringNo-
strengthUnitstringNo-
medicineTypestringNo-
quantityintegerNo-
notesstringNo-
productIdsarray<string>No-
productsarray<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": {} }