Aller au contenu

Orders

Ce contenu n’est pas encore disponible dans votre langue.

The Orders resource provides fake order data with status tracking, pricing breakdowns, coupon support, and order items containing product references and quantities.

MethodEndpointDescription
GET/v1/ordersList all orders
GET/v1/orders/:idGet a specific order
GET/v1/orders/:id/itemsGet order's items
{
"id": 1,
"userId": 1,
"status": "pending",
"subtotal": 599.98,
"discount": 50.0,
"shipping": 9.99,
"total": 559.97,
"currency": "USD",
"couponCode": "SAVE50",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
Field Type Description
id number Unique identifier
userId number ID of the order owner
status string Order status (pending, processing, shipped, delivered, cancelled)
subtotal number Sum of item prices before discounts
discount number Total discount applied
shipping number Shipping cost
total number Final order total
currency string Currency code (e.g. USD)
couponCode string Applied coupon code (if any)
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp
{
"id": 1,
"orderId": 1,
"productId": 1,
"quantity": 2,
"unitPrice": 299.99,
"total": 599.98,
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
Field Type Description
id number Unique identifier
orderId number ID of the parent order
productId number ID of the ordered product
quantity number Quantity ordered
unitPrice number Price per unit at order time
total number Line item total
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/orders
Parameter Type Default Description
page number 1 Page number
limit number 20 Items per page (max: 100)
sort string Sort field and direction
q string Search query
fields string Fields to return
userId number Filter by user ID
status string Filter by order status
{
"data": [
{
"id": 1,
"userId": 1,
"status": "pending",
"subtotal": 599.98,
"total": 559.97,
"currency": "USD"
}
],
"meta": {
"total": 300,
"page": 1,
"limit": 20,
"totalPages": 15
}
}
Terminal window
curl https://api.phantomjson.app/v1/orders/1
{
"data": {
"id": 1,
"userId": 1,
"status": "pending",
"subtotal": 599.98,
"discount": 50.0,
"shipping": 9.99,
"total": 559.97,
"currency": "USD",
"couponCode": "SAVE50",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
}
Terminal window
curl https://api.phantomjson.app/v1/orders/1/items
{
"data": [
{
"id": 1,
"orderId": 1,
"productId": 1,
"quantity": 2,
"unitPrice": 299.99,
"total": 599.98
}
],
"meta": {
"total": 2,
"page": 1,
"limit": 20,
"totalPages": 1
}
}
Terminal window
curl "https://api.phantomjson.app/v1/orders?userId=1"
Terminal window
curl "https://api.phantomjson.app/v1/orders?status=delivered"
Terminal window
curl "https://api.phantomjson.app/v1/orders?sort=createdAt:desc"
Terminal window
curl "https://api.phantomjson.app/v1/orders?fields=id,status,total,currency"
  • User — Each order belongs to a user (userId)
  • Items — Each order has many order items (access via /v1/orders/:id/items)
  • Coupon — Each order may reference a coupon (couponCode)