🛒

orders

Customer order placed in an e-commerce system. Contains order details, customer information, item counts, pricing breakdown (subtotal, tax, shipping), payment method, delivery address, and order status.

🎯 Request Builder

https://api.mockly.codes/orders?page=1&limit=10&count=10
📡

Configure your request and click Send Request to see the response here.

Endpoints

GET/orders

Get a collection of orders

Alternative: /commerce/orders
GET/orders/:id

Get a single order by ID

Alternative: /commerce/orders/:id
GET/orders/meta

Get resource metadata and schema

Alternative: /commerce/orders/meta
🔍

How to Use Search

The search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.

1. Basic Search

Search across all text fields:

Basic Search
GET https://api.mockly.codes/orders?q=laptop

2. Search Specific Fields

Field-Specific Search
GET https://api.mockly.codes/orders?q=laptop&search_fields=name,description

💡 Pro Tips

  • Search is case-insensitive and performs partial matching
  • Without search_fields, all text fields are searched
  • Combine with pagination to handle large result sets efficiently

Code Examples

JavaScript

Fetch Collection
// Get 10 orders
fetch('https://api.mockly.codes/orders?count=10')
  .then(res => res.json())
  .then(data => console.log(data));

Python

Fetch with Requests
import requests

response = requests.get(
    'https://api.mockly.codes/orders?count=10'
)
data = response.json()

cURL

Command Line
curl "https://api.mockly.codes/orders?count=10"

Bypass Cache

Get Fresh Data
fetch('https://api.mockly.codes/orders?nocache=true')

Schema Properties

idinteger

Unique identifier for the order

Gen:random_int
order_numberstring

Human-readable order number or reference code for customer tracking

Gen:order_number
customer_idinteger

Foreign key reference to the customer who placed this order

Gen:random_int
customer_namestring

Full name of the customer who placed the order

Gen:name
customer_emailstring

Email address of the customer for order confirmations and updates

Gen:emailemail
items_countinteger

Total number of distinct items/products in the order

Gen:random_int
subtotalnumber

Sum of all item prices before taxes and shipping

Gen:price
taxnumber

Total tax amount calculated based on applicable tax rates

Gen:tax
shippingnumber

Shipping and handling cost for the order

Gen:shipping_cost
totalnumber

Final total amount including subtotal, tax, and shipping

Gen:price
currencystring

ISO currency code for all monetary values (e.g., USD, EUR, GBP)

Gen:currency
statusstring

Current order status (e.g., pending, processing, shipped, delivered, cancelled, refunded)

Gen:order_status
payment_methodstring

Payment method used (e.g., credit_card, paypal, bank_transfer, cash_on_delivery)

Gen:payment_method
shipping_addressstring

Complete delivery address where the order should be shipped

Gen:address
created_atstring

Timestamp when the order was placed

Gen:past_datedate-time
updated_atstring

Timestamp when the order was last modified

Gen:past_datedate-time

Query Parameters

countinteger

Number of items to return (default: 10, max: 100)

seedinteger

Seed for reproducible data generation

nocacheboolean

Bypass cache and generate fresh data on every request