Skip to main content

Get All Orders

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

HTTP Request

GET/api/orders

Authorization

Authorization

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

Query Parameters

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page
offsetintegerNumber of results to skip before returning results
searchstringSearch term to filter 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`
orderingstringField to order 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)
customerintegerFilter by specific customer ID
customer_instringFilter by multiple customer IDs (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)
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
has_notesbooleanFilter orders with/without notes
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())

Status Codes

CodeDescription
200Orders retrieved successfully
400Bad request — invalid parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the order
keyStringUnique key of the order (read-only)
statusStringCurrent status of the order
customer_dataObjectCustomer information (read-only)
payment_method_dataObjectPayment method information (read-only)
shipping_method_dataObjectShipping method information (read-only)
shipping_costNumberCost of shipping
notesStringOrder notes
extraObjectAdditional 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 (read-only)
billing_state_dataObjectBilling state information (read-only)
billing_city_dataObjectBilling city information (read-only)
billing_addressStringBilling address
billing_postal_codeStringBilling postal code
billing_national_codeStringBilling national code
billing_mobile_numberStringBilling mobile number
billing_first_nameStringBilling first name
billing_last_nameStringBilling last name
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)

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_dataObjectSnapshot 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

Payment Method Structure

The payment_method object contains:

FieldTypeDescription
idIntegerPayment method ID
nameStringPayment method name
imageObjectPayment method image data

Customer Structure

The customer object contains:

FieldTypeDescription
idIntegerCustomer ID
usernameStringCustomer username
full_nameStringCustomer full name (computed)

Geographic Data Structures

Country, state, and city objects contain:

Country/State:

FieldTypeDescription
idIntegerLocation ID
activeBooleanWhether location is active
nameStringLocation name
codeStringLocation code

City:

FieldTypeDescription
idIntegerCity ID
activeBooleanWhether city is active
nameStringCity name