Search Documentation

Search for a documentation page...

Orders API

REST API endpoints for browsing and managing orders.

List Orders

GET /api/v1/orders

Returns a paginated list of orders, sorted by creation date (newest first).

Query Parameters

ParameterTypeDefaultDescription
limitnumber10Orders per page (1-100)
offsetnumber0Orders to skip

Response

{
"data": [
{
"id": "0191abc0-1234-7def-8000-000000000001",
"orderNumber": 1042,
"status": "completed",
"totalAmount": "5000",
"currency": "usd",
"customer": {
"id": "0191abc0-0000-7000-8000-000000000010",
"email": "jane@example.com",
"name": "Jane Doe"
},
"createdAt": "2024-01-15T10:30:00.000Z"
}
],
"meta": {
"count": 42
}
}

Get Order

GET /api/v1/orders/:id

Returns the full order with line items, customer info, shipping address, and payment details.

Response

{
"id": "0191abc0-1234-7def-8000-000000000001",
"orderNumber": 1042,
"status": "completed",
"totalAmount": "5000",
"currency": "usd",
"lineItems": [
{
"id": "0191abc0-0000-7000-8000-000000000100",
"productVariantId": "0191abc0-0000-7000-8000-000000000200",
"quantity": 2,
"unitPrice": "2500",
"product": {
"name": "Classic Tee",
"slug": "classic-tee"
}
}
],
"customer": {
"id": "0191abc0-0000-7000-8000-000000000010",
"email": "jane@example.com",
"name": "Jane Doe"
},
"shippingAddress": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postalCode": "94102",
"country": "US"
},
"createdAt": "2024-01-15T10:30:00.000Z"
}

Update Order

PATCH /api/v1/orders/:id

Updates an order's fulfillment status and/or tracking information.

Request Body

FieldTypeDescription
statusstringprocessing, shipped, delivered, or canceled
trackingNumberstringShipping carrier tracking number
curl -X PATCH \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"status": "shipped",
"trackingNumber": "1Z999AA10123456784"
}' \
https://your-store.yns.store/api/v1/orders/0191abc0-1234-7def-8000-000000000001

Order Statuses

API StatusInternal StatusDescription
processingprocessingBeing prepared
shippedshippedIn transit
deliveredcompletedDelivered to customer
canceledcancelledCancelled

Customer Orders

GET /api/v1/customers/:id/orders

Returns orders for a specific customer, paginated.

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Orders per page (1-100)
offsetnumber0Orders to skip

Response

{
"items": [
{
"id": "0191abc0-1234-7def-8000-000000000001",
"orderNumber": "1042",
"status": "completed",
"totalCents": 5000,
"currency": "usd",
"createdAt": "2024-01-15T10:30:00.000Z"
}
],
"pagination": {
"total": 8,
"offset": 0,
"limit": 20,
"hasMore": false
}
}