Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/astrxnomo/shop-microservers/llms.txt

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

Returns the full order history for the authenticated user, most recent first. Each order includes a complete snapshot of its line items — the product name, unit price, and quantity as they were at the time of purchase. Orders are strictly scoped to the authenticated user; no other user’s orders are ever returned.

Endpoint

GET /api/orders/

Authentication

Every request must carry a valid JWT in the Authorization header. The user identity is derived from the token — there are no additional user-scoping query parameters.
Authorization: Bearer <token>

Parameters

This endpoint accepts no path parameters and no query parameters.

Example Request

curl http://localhost/api/orders/ \
  -H "Authorization: Bearer eyJhbGci..."

Response

200 — Success

Returns a data array of Order objects ordered by createdAt descending. If the authenticated user has placed no orders, data is an empty array.
{
  "success": true,
  "data": [
    {
      "id": "clxxxxxxxxxxxxx",
      "userId": "clyyyyyyyyyyyyyy",
      "total": 159.98,
      "status": "PENDING",
      "createdAt": "2024-01-15T12:00:00.000Z",
      "updatedAt": "2024-01-15T12:00:00.000Z",
      "items": [
        {
          "id": "clzzzzzzzzzzzzz",
          "orderId": "clxxxxxxxxxxxxx",
          "productId": "claaaaaaaaaaaa",
          "name": "Wireless Headphones",
          "price": 79.99,
          "quantity": 2
        }
      ]
    }
  ],
  "error": null
}
data
array
Array of Order objects belonging to the authenticated user, sorted by createdAt descending.
data[].id
string
CUID uniquely identifying this order.
data[].userId
string
CUID of the user who placed the order. Always matches the identity in the request JWT.
data[].total
number
Total monetary amount of the order, derived from the cart total at checkout time.
data[].status
string
Current fulfillment status of the order. One of PENDING, CONFIRMED, SHIPPED, DELIVERED, or CANCELLED. Newly created orders always start as PENDING.
data[].createdAt
string
ISO 8601 timestamp of when the order was created.
data[].updatedAt
string
ISO 8601 timestamp of the last update to the order record.
data[].items
array
Array of OrderItem objects representing the line items snapshotted at checkout. Future catalog changes do not affect these values.
data[].items[].id
string
CUID uniquely identifying this order line item.
data[].items[].orderId
string
CUID of the parent order. Matches data[].id.
data[].items[].productId
string
CUID of the product at the time of purchase.
data[].items[].name
string
Product name snapshotted at the time of purchase.
data[].items[].price
number
Unit price snapshotted at the time of purchase.
data[].items[].quantity
number
Quantity of this product that was purchased.

401 — Unauthorized

Returned when the Authorization header is missing or the JWT is invalid or expired. No order data is returned.
{
  "success": false,
  "data": null,
  "error": "Unauthorized"
}

Build docs developers (and LLMs) love