Skip to main content

List All Orders

Retrieves a list of all orders with optional filtering, sorting, and pagination.

HTTP Request

GET/api/orders
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO AN EXTRA REDIRECT WITH 301 STATUS

Authorization

Authorization

  • Required: Yes
  • Permission: Staff with OrderPermission or Admin
  • Permission Code: 2202
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Query Parameters

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip before returning results
searchstringSearch term to lookup results by`id`, `key`, `customer__id`, `customer__first_name`, `customer__last_name`, `customer__email`, `customer__username`, `customer__mobile_number`, `notes`, `billing_country__name`, `billing_state__name`, `billing_city__name`, `billing_first_name`, `billing_last_name`, `billing_mobile_number`
orderingstring-created_atOrder results by (`id`, `status`, `customer__id`, `customer__username`, `customer__first_name`, `customer__last_name`, `shipping_cost`, `created_at`, `updated_at`)
statusstringFilter by specific order status (`new`, `hold`, `failed`, `cancelled`, `processing`, `shipped`, `completed`, `refunded`, `deleted`)
status_instringFilter by multiple order statuses (comma-separated)
payment_methodintegerFilter by specific payment method ID
payment_method_instringFilter by multiple payment method IDs (comma-separated)
shipping_methodintegerFilter by specific shipping method ID
shipping_method_instringFilter by multiple shipping method IDs (comma-separated)
billing_countryintegerFilter by billing country ID
billing_stateintegerFilter by billing state ID
billing_cityintegerFilter by billing city ID
billing_country_instringFilter by multiple billing country IDs (comma-separated)
billing_state_instringFilter by multiple billing state IDs (comma-separated)
billing_city_instringFilter by multiple billing city IDs (comma-separated)
has_notesbooleanFilter orders with/without notes
customerintegerFilter by specific customer ID
customer_instringFilter by multiple customer IDs (comma-separated)
shipping_cost_minnumberMinimum shipping cost filter
shipping_cost_maxnumberMaximum shipping cost filter
has_customerbooleanFilter orders with/without customer
has_payment_methodbooleanFilter orders with/without payment method
has_shipping_methodbooleanFilter orders with/without shipping method
has_billing_countrybooleanFilter orders with/without billing country
has_billing_statebooleanFilter orders with/without billing state
has_billing_citybooleanFilter orders with/without billing city
has_billing_addressbooleanFilter orders with/without billing address
has_billing_postal_codebooleanFilter orders with/without billing postal code
has_billing_national_codebooleanFilter orders with/without billing national code
has_billing_mobile_numberbooleanFilter orders with/without billing mobile number
has_billing_first_namebooleanFilter orders with/without billing first name
has_billing_last_namebooleanFilter orders with/without billing last name
id_minintegerMinimum ID filter
id_maxintegerMaximum ID filter
created_datestringFilter by creation date (e.g., 2023-01-01)
updated_datestringFilter by last updated date (e.g., 2023-01-01)
created_fromstringFilter by creation date range start
created_tostringFilter by creation date range end
updated_fromstringFilter by last updated date range start
updated_tostringFilter by last updated date range end

Example Requests

1import requests
2
3# List all orders
4response = requests.get('http://www.example.com/api/orders', 
5  headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# Search for orders with filters
10response = requests.get('http://www.example.com/api/orders', params={
11  'search': 'john',
12  'status': 'pending',
13  'has_customer': True,
14  'ordering': '-created_at',
15  'limit': 20
16}, headers={'Authorization': 'Token <your_api_key>'})
17print(response.json())
18
19# Filter by customer and payment method
20response = requests.get('http://www.example.com/api/orders', params={
21  'customer': 123,
22  'payment_method': 1,
23  'shipping_cost_min': 10.00
24}, headers={'Authorization': 'Token <your_api_key>'})
25print(response.json())

Response Fields

FieldTypeDescription
countIntegerTotal number of categories
nextStringURL for the next page of results
previousStringURL for the previous page of results
resultsArray[Object]Array of Order objects

Order Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the order
keyStringUnique key of the order (unique)
statusStringCurrent status of the order(choices)
customer_dataObjectCustomer information (nullable)
payment_method_dataObjectPayment method information (nullable)
shipping_method_dataObjectShipping method information (nullable)
shipping_costNumberCost of shipping (default=0)
notesStringOrder notes (nullable)
extraJsonFieldAdditional order data
created_atString (ISO 8601)Timestamp when order was created
updated_atString (ISO 8601)Timestamp when order was last updated
billing_country_dataObjectBilling country information (nullable)
billing_state_dataObjectBilling state information (nullable)
billing_city_dataObjectBilling city information (nullable)
billing_addressStringBilling address (nullable)
billing_postal_codeStringBilling postal code (nullable)
billing_national_codeStringBilling national code (nullable)
billing_mobile_numberStringBilling mobile number (nullable, valid iranian mobile number)
billing_first_nameStringBilling first name (nullable)
billing_last_nameStringBilling last name (nullable)
countIntegerNumber of items in order (computed field)
quantityIntegerTotal quantity of items (computed field)
items_subtotalNumberSubtotal of all items (computed field)
items_discountNumberTotal discount on items (computed field)
subtotalNumberOrder subtotal (computed field)
total_discountNumberTotal discount amount (computed field)
totalNumberOrder total amount (computed field)
amount_paidNumberAmount already paid (computed field)
amount_outstandingNumberOutstanding amount (computed field)
is_paidBooleanWhether order is fully paid (computed field)
itemsArrayList of order items (read-only)
paymentsArrayList of order payments (read-only)

Customer Structure

The customer object contains:

FieldTypeDescription
idIntegerCustomer ID
usernameStringCustomer username
mobile_numberStringCustomer mobile number
first_nameStringCustomer first name
last_nameStringCustomer last name
full_nameStringCustomer full name (computed)

Payment Method Structure

The payment_method object contains:

FieldTypeDescription
idIntegerPayment method ID
nameStringPayment method name
imageObjectPayment method image data

Shipping Method Structure

The shipping_method object contains:

FieldTypeDescription
idIntegerShipping method ID
nameStringShipping method name
imageObjectShipping method image data

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image/jpeg)
nameStringOriginal file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB)
fStringURL to access the image file
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringColor mode (e.g., RGB, CMYK)
thumbnailsList of thumbnail objectsImgae thumbnails

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile size in bytes (nullable)

Geographic Data Structures

Country, state, and city objects contain:

Country/State:

FieldTypeDescription
idIntegerLocation ID
nameStringLocation name
codeStringLocation code

City:

FieldTypeDescription
idIntegerCity ID
nameStringCity name

Order Items Structure

Each item in the items array contains:

FieldTypeDescription
idIntegerUnique ID of the order item
productIntegerUnique ID of the product
product_nameStringCurrent Product Name
product_dataJsonFieldSnapshot of product data at time of order
unit_priceIntegerPrice per unit (in smallest currency unit)
unit_discountIntegerDiscount per unit (in smallest currency unit)
quantityIntegerQuantity ordered
notesStringItem-specific notes
subtotalIntegerCalculated subtotal (computed field)
discountIntegerTotal discount for this item (computed field)
totalIntegerFinal total for this item (computed field)
created_atString (ISO 8601)Item creation timestamp
updated_atString (ISO 8601)Item last update timestamp

Order Payment Structure

Each item in the payments array contains:

  • The shipping method structure here is the same as the above-mentioned ShippingMethod Structure.
FieldTypeDescription
idIntegerId of the order payment
payment_method_dataObjectPayment method data of the order payment
approvedBooleanWhether the order payment is approved
amountIntegerThe order payment amount
transaction_idStringThe transaction id of the order payment
notesStringThe extra notes about the order payment
created_atString (ISO 8601)The creation datetime of the order payment
updated_atString (ISO 8601)The last updated datetime of the order payment

Example Response

{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"key": "0c86ab758d3e236cb5a4",
"status": "processing",
"customer_data": {
"id": 1,
"username": "BehroozGhorbani",
"mobile_number": "09308744204",
"first_name": "بهروز",
"last_name": "قربانی",
"full_name": "بهروز قربانی"
},
"payment_method_data": {
"id": 1,
"name": "پرداخت در مخل",
"image": null
},
"shipping_method_data": {
"id": 1,
"name": "پیک موتور",
"image": {
"id": 8,
"type": "image",
"name": "پیک موتوری",
"size": 808754,
"human_readable_size": "789.80 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/12/20/Fantasticheskie_kartinki_dlja_monitora_68_63.jpg",
"width": 1920,
"height": 1080,
"mode": "RGB",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
}
},
"shipping_cost": 75000,
"notes": "Facilis sequi alias optio. Alias ipsam deserunt. At veniam nam et. Et aut id id aut quae non animi. Sed tempora aut ut ipsa dicta vel eveniet et aspernatur.",
"extra": {
"some": "data"
},
"created_at": "2025-12-27T18:17:09.771123Z",
"updated_at": "2025-12-28T10:43:38.505960Z",
"billing_country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"billing_state_data": {
"id": 1,
"name": "آذربایجان شرقی",
"code": "EA"
},
"billing_city_data": {
"id": 1,
"name": "اسکو"
},
"billing_address": "5411 Stokes Grove",
"billing_postal_code": "1234567890",
"billing_national_code": null,
"billing_mobile_number": "09523296536",
"billing_first_name": "پدرام",
"billing_last_name": "زمانی",
"count": 2,
"quantity": 15,
"items_subtotal": 52300000,
"items_discount": 3300000,
"subtotal": 52300000,
"total_discount": 3300000,
"total": 49075000,
"amount_paid": 500000,
"amount_outstanding": 48575000,
"is_paid": false,
"is_payable": true,
"items": [
{
"id": 1,
"product": 36,
"product_title": "ماوس لاجیتک MX Vertical",
"product_data": {},
"unit_price": 8500000,
"unit_discount": 500000,
"quantity": 5,
"notes": "handle with care",
"subtotal": 42500000,
"discount": 2500000,
"total": 40000000,
"created_at": "2025-12-28T10:43:38.506842Z",
"updated_at": "2025-12-28T10:43:38.506846Z"
},
{
"id": 2,
"product": 53,
"product_title": "آلاینده هوا پرایدی",
"product_data": {
"key": "value"
},
"unit_price": 980000,
"unit_discount": 80000,
"quantity": 10,
"notes": "",
"subtotal": 9800000,
"discount": 800000,
"total": 9000000,
"created_at": "2025-12-28T10:43:38.508594Z",
"updated_at": "2025-12-28T10:43:38.508598Z"
}
],
"payments": [
{
"id": 1,
"payment_method_data": {
"id": 1,
"name": "پرداخت در مخل",
"image": null
},
"approved": true,
"amount": 500000,
"transaction_id": "1589800",
"notes": "",
"created_at": "2025-12-28T10:43:38.509103Z",
"updated_at": "2025-12-28T10:43:38.509107Z"
}
]
},
{
"id": 1,
"key": "3ecb7a870edb5da998f6",
"status": "new",
"customer_data": null,
"payment_method_data": null,
"shipping_method_data": null,
"shipping_cost": 0,
"notes": null,
"extra": {},
"created_at": "2025-12-27T18:12:18.461023Z",
"updated_at": "2025-12-27T18:12:18.461032Z",
"billing_country_data": null,
"billing_state_data": null,
"billing_city_data": null,
"billing_address": null,
"billing_postal_code": null,
"billing_national_code": null,
"billing_mobile_number": null,
"billing_first_name": null,
"billing_last_name": null,
"count": 0,
"quantity": 0,
"items_subtotal": 0,
"items_discount": 0,
"subtotal": 0,
"total_discount": 0,
"total": 0,
"amount_paid": 0,
"amount_outstanding": 0,
"is_paid": false,
"is_payable": false,
"items": [],
"payments": []
}
]
}

Notes

  • Valid status choices are: new, hold, failed, cancelled, processing, shipped, completed, refunded