Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/floriansalvi/HEIG-VD_Ocha-api/llms.txt

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

The get orders endpoint returns a paginated collection of all orders associated with the authenticated user. Results are scoped exclusively to the requesting user — no cross-user data is exposed. Use the page and limit query parameters to control the size and offset of the result set. The response includes pagination metadata alongside the orders array.
This endpoint requires a valid JWT token. Include it as Authorization: Bearer <token> in the request headers. Requests without a valid token are rejected with 401 Unauthorized.
Method: GET   Path: /api/v1/users/orders

Query parameters

page
number
default:"1"
The page number to retrieve. Starts at 1. Defaults to 1 if omitted.
limit
number
default:"10"
The number of orders to return per page. Defaults to 10 if omitted.
status
string
Filter orders by status. Accepted values: "en préparation", "prête", "récupérée". Omit to return all statuses.
store_id
string
Filter orders by store. Pass a MongoDB ObjectId to return only orders placed at that store.

Response — 200 OK

page
number
The current page number returned in this response.
totalPages
number
The total number of pages available given the current limit.
totalOrders
number
The total number of orders belonging to the authenticated user across all pages.
orders
object[]
An array of order objects for the current page. The array is empty when no orders exist or the requested page exceeds the total.

Error codes

StatusMeaningCause
401 UnauthorizedMissing or invalid tokenNo Authorization header was sent, or the token is expired or malformed

Example

curl --request GET \
  --url 'https://api.example.com/api/v1/users/orders?page=1&limit=10' \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
{
  "message": "Your order history",
  "page": 1,
  "totalPages": 4,
  "totalOrders": 37,
  "orders": [
    {
      "_id": "6642f1a2c3d4e5f6a7b8c9d1",
      "store_id": {
        "_id": "64f1c2e9a1b2c3d4e5f12345",
        "name": "Ocha Lausanne"
      },
      "status": "récupérée",
      "pickup": "2026-01-10T12:30:00.000Z",
      "total_price_chf": 14.50,
      "createdAt": "2026-01-09T08:00:00.000Z"
    }
  ]
}

Build docs developers (and LLMs) love