Skip to main content
GET
/
orders
/
:id
Get Order
curl --request GET \
  --url https://api.example.com/orders/:id
{
  "id": 42,
  "userId": 5,
  "total": "149.97",
  "status": "shipped",
  "createdAt": "2026-03-01T10:30:00.000Z",
  "updatedAt": "2026-03-03T09:15:00.000Z",
  "items": [
    {
      "id": 101,
      "orderId": 42,
      "productId": 15,
      "quantity": 2,
      "priceAtPurchase": "49.99",
      "product": {
        "id": 15,
        "name": "Wireless Headphones",
        "description": "High-quality Bluetooth headphones with noise cancellation",
        "price": "54.99",
        "imageUrl": "https://example.com/images/headphones.jpg",
        "stock": 25,
        "categoryId": 3
      }
    },
    {
      "id": 102,
      "orderId": 42,
      "productId": 23,
      "quantity": 1,
      "priceAtPurchase": "49.99",
      "product": {
        "id": 23,
        "name": "USB-C Cable",
        "description": "Fast charging USB-C cable, 6ft length",
        "price": "49.99",
        "imageUrl": "https://example.com/images/cable.jpg",
        "stock": 100,
        "categoryId": 3
      }
    }
  ]
}
Retrieves detailed information about a specific order. Users can only access their own orders.

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.
Authorization: Bearer <your-token>

Path Parameters

id
number
required
The unique identifier of the order to retrieve

Response

id
number
required
Unique identifier for the order
userId
number
required
ID of the user who placed the order
total
string
required
Total amount for the order (decimal as string)
status
string
required
Current status of the orderPossible values:
  • pending - Order has been created but not yet processed
  • shipped - Order has been shipped
  • delivered - Order has been delivered
  • cancelled - Order has been cancelled
createdAt
string
required
ISO 8601 timestamp when the order was created
updatedAt
string
required
ISO 8601 timestamp when the order was last updated
items
array
required
Array of order items
id
number
required
Unique identifier for the order item
orderId
number
required
ID of the parent order
productId
number
required
ID of the product
quantity
number
required
Quantity of the product ordered
priceAtPurchase
string
required
Price of the product at the time of purchase (decimal as string)
product
object
required
Product details
id
number
required
Product ID
name
string
required
Product name
description
string
Product description
price
string
required
Current price of the product (decimal as string)
imageUrl
string
required
URL to the product image
stock
number
required
Current stock level
categoryId
number
ID of the product’s category
{
  "id": 42,
  "userId": 5,
  "total": "149.97",
  "status": "shipped",
  "createdAt": "2026-03-01T10:30:00.000Z",
  "updatedAt": "2026-03-03T09:15:00.000Z",
  "items": [
    {
      "id": 101,
      "orderId": 42,
      "productId": 15,
      "quantity": 2,
      "priceAtPurchase": "49.99",
      "product": {
        "id": 15,
        "name": "Wireless Headphones",
        "description": "High-quality Bluetooth headphones with noise cancellation",
        "price": "54.99",
        "imageUrl": "https://example.com/images/headphones.jpg",
        "stock": 25,
        "categoryId": 3
      }
    },
    {
      "id": 102,
      "orderId": 42,
      "productId": 23,
      "quantity": 1,
      "priceAtPurchase": "49.99",
      "product": {
        "id": 23,
        "name": "USB-C Cable",
        "description": "Fast charging USB-C cable, 6ft length",
        "price": "49.99",
        "imageUrl": "https://example.com/images/cable.jpg",
        "stock": 100,
        "categoryId": 3
      }
    }
  ]
}

Error Responses

401 Unauthorized

Returned when the authentication token is missing or invalid.
{
  "error": "Usuario no autenticado"
}

404 Not Found

Returned when:
  • The order does not exist
  • The order belongs to a different user
{
  "error": "Orden no encontrada"
}

Build docs developers (and LLMs) love