Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FlasheyEstudi/Oasis-Liquido/llms.txt

Use this file to discover all available pages before exploring further.

The Sales API handles the point-of-sale flow for pharmacy managers. A sale records the medicines dispensed, the amounts charged, and optionally links the transaction to a patient and a digital prescription. When is_delivery is set to true, the API automatically creates a DeliveryOrder and returns its ID and initial status alongside the sale confirmation.

POST /api/v1/sales

Create a new pharmacy sale. Requires the pharmacy_manager role. The pharmacy is inferred from the authenticated manager’s profile; no pharmacy_id field is needed in the request body.

Request body

items
object[]
required
One or more line items in the sale.
patient_id
string
UUID of the patient purchasing. Optional for anonymous counter sales.
prescription_id
string
UUID of a validated prescription to link to this sale. Include when dispensing prescription-only medicines.
is_delivery
boolean
required
Set to true to create a delivery order for this sale. When true, delivery_address, delivery_lat, and delivery_lng are required.
delivery_address
string
Full street address for delivery. Required when is_delivery is true.
delivery_lat
number
Delivery latitude coordinate. Required when is_delivery is true.
delivery_lng
number
Delivery longitude coordinate. Required when is_delivery is true.
notes
string
Optional notes for the sale or delivery.

curl example — counter sale

curl --request POST http://localhost:8000/api/v1/sales \
  --header "Authorization: Bearer <access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "items": [
      {
        "medicine_id": "med-uuid-001",
        "quantity": 2,
        "unit_price": 12.50
      }
    ],
    "patient_id": "patient-uuid-001",
    "prescription_id": "rx-uuid-001",
    "is_delivery": false
  }'

curl example — delivery sale

curl --request POST http://localhost:8000/api/v1/sales \
  --header "Authorization: Bearer <access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "items": [
      {
        "medicine_id": "med-uuid-001",
        "quantity": 1,
        "unit_price": 12.50
      }
    ],
    "patient_id": "patient-uuid-001",
    "is_delivery": true,
    "delivery_address": "Av. Reforma 100, CDMX",
    "delivery_lat": 19.4270,
    "delivery_lng": -99.1670
  }'

Response fields

sale_id
string
required
UUID of the newly created sale record.
delivery_order
object
Present only when is_delivery was true. Contains the created delivery order reference.
Setting is_delivery: true automatically creates a DeliveryOrder with status pending. The order can then be assigned to a driver via the Delivery Orders API.

Build docs developers (and LLMs) love