The Order Items API represents the individual line items that make up an order — each linking a specificDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OluwagbeminiyiA/agro_pulse-API/llms.txt
Use this file to discover all available pages before exploring further.
Produce listing to an Order at a recorded unit price and quantity. The subtotal for each item is computed automatically on save (quantity × unit_price) and is always read-only. Visibility is role-scoped in the same way as the Orders API: buyers see items from their own orders, farmers see items from orders placed against their produce, and staff have full access. All endpoints require a valid JWT Bearer token.
Base path
Authentication
All endpoints require a JWT Bearer token in theAuthorization header.
Endpoints
| Method | Path | Description | Auth required |
|---|---|---|---|
GET | /api/order-items/ | List order items (scoped to the authenticated user) | Yes |
POST | /api/order-items/ | Create a new order item | Yes |
GET | /api/order-items/{id}/ | Retrieve a single order item by UUID | Yes |
PUT | /api/order-items/{id}/ | Full update of an order item | Yes |
PATCH | /api/order-items/{id}/ | Partial update of an order item | Yes |
DELETE | /api/order-items/{id}/ | Delete an order item | Yes |
GET | /api/order-items/by_order/ | List all items belonging to a specific order | Yes |
Create an order item
POST /api/order-items/
Adds a line item to an existing order. The subtotal is calculated automatically as quantity × unit_price and must not be included in the request body. The id, subtotal, created_at, and updated_at fields are all read-only.
UUID of the
Order this item belongs to.UUID of the
Produce listing being ordered.Number of units of the produce item being ordered.
Price per unit at the time of ordering. Decimal, up to 2 decimal places (e.g.,
4.50). This is recorded independently of the produce listing’s current unit_price to preserve order history.Example request
Example response
subtotal is always computed server-side as quantity × unit_price. Any value you include in the request body for subtotal is ignored.Fetch items by order
GET /api/order-items/by_order/
Returns all line items belonging to a specific order. Requires the order_id query parameter.
UUID of the order whose items you want to retrieve.
Example request
Filter order items
GET /api/order-items/
Returns order items scoped to the authenticated user’s role. Use the query parameters below to narrow results.
Query parameters
Filter by order UUID. Returns only items belonging to the specified
Order.Filter by produce UUID. Returns only items that reference the specified
Produce listing.Sort results by a field name. Supported fields:
unit_price, quantity, created_at. Prefix with - for descending order (e.g., -created_at).Example request
OrderItem object
UUID primary key. Auto-generated on creation, never editable.
UUID of the parent
Order.UUID of the
Produce listing this item references.Name of the produce item. Read-only, derived from the linked
Produce record.Category of the produce item. Read-only, derived from the linked
Produce record. One of: VEGETABLES, FRUITS, GRAINS, DAIRY, MEAT, OTHER.Number of units ordered.
Price per unit at the time the item was created, as a decimal string (e.g.,
"4.50").Computed total for this line item (
quantity × unit_price), as a decimal string (e.g., "135.00"). Read-only.ISO 8601 timestamp of item creation. Read-only.
ISO 8601 timestamp of the last update. Read-only.