Create order
const url = 'https://api.dokanmazad.com/api/v1/orders';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"customerId":"cmoabcde000001ny11aabbcc0","carId":10482,"carDetails":{"makeEn":"BMW","modelEn":"3 Series","year":2023,"price":25000},"totalAmount":25000,"currency":"USD"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.dokanmazad.com/api/v1/orders \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "customerId": "cmoabcde000001ny11aabbcc0", "carId": 10482, "carDetails": { "makeEn": "BMW", "modelEn": "3 Series", "year": 2023, "price": 25000 }, "totalAmount": 25000, "currency": "USD" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Customer CUID
Source car integer ID. When provided, the car images are snapshotted to R2 under orders/{orderNumber}/ for archival.
Car details JSON snapshot (makeEn, modelEn, year, price, …). Also accepts the special key customerNotificationsEnabled documented as its own row below.
object
Embed inside carDetails (e.g. { makeEn: "BMW", customerNotificationsEnabled: false }). When false, all WhatsApp notifications to the customer for THIS order are suppressed (staff notifications still fire). Default true.
Marketer CUID. Auto-set if the authenticated user is a marketer.
Tenant CUID. Auto-set from the authenticated user context.
Total order amount (minimum 0)
ISO 4217 currency — USD | KRW | AED (default: USD)
Internal notes visible to staff
Payment receipt amount from customer (minimum 0)
Currency of the receipt
Description or reference for the payment receipt (e.g. bank transfer ref)
URL of uploaded receipt file (image or PDF)
When true, the order is paid entirely from the customer wallet balance and skips deposit/payment workflow steps — status starts at InspectionScheduled. PREREQUISITE: call GET /v1/wallets/:customerId first and confirm balance >= totalAmount. If balance is insufficient, the order creation will fail with code WALLET_INSUFFICIENT_BALANCE. Default: false.
Inspection date — required when useWalletBalance=true (order bypasses deposit steps)
Examples
{ "customerId": "cmoabcde000001ny11aabbcc0", "carId": 10482, "carDetails": { "makeEn": "BMW", "modelEn": "3 Series", "year": 2023, "price": 25000 }, "totalAmount": 25000, "currency": "USD"}Responses
Section titled “Responses”Success
object
object
object
Newly created order CUID
Sequential order number
DepositSubmitted on create (or InspectionScheduled when useWalletBalance=true)
Valid next statuses from creation state
Order progress (0 at creation)
Whether order can be cancelled (true at creation)
Whether order is in terminal state (false at creation)
Starts at 1
Creation timestamp
Examples
{ "success": true, "data": { "id": "cmosor2zy000313ny24hgtfy0", "orderNumber": 1042, "status": "DepositSubmitted", "allowedStatusTransitions": [ "DepositConfirmed", "Cancelled" ], "progress": 0, "canCancel": true, "isTerminal": false, "version": 1, "customerId": "cmoabcde000001ny11aabbcc0", "marketerId": "cmoabcde000002ny22aabbcc0", "tenantId": "cmoabcde000003ny33aabbcc0", "carDetails": { "makeEn": "BMW", "modelEn": "3 Series", "year": 2023, "price": 25000 }, "totalAmount": 25000, "currency": "USD", "notes": null, "inspectionDate": null, "customer": { "id": "cmoabcde000001ny11aabbcc0", "name": "Ahmed Ali", "email": "ahmed@example.com" }, "marketer": { "id": "cmoabcde000002ny22aabbcc0", "name": "Sales Rep", "email": "sales@example.com" }, "createdAt": "2026-05-01T08:00:00.000Z", "updatedAt": "2026-05-01T08:00:00.000Z" }}Unauthorized — missing or invalid API key
object
Example
{ "success": false}Forbidden — route not in this key’s allowedRoutes
object
Example
{ "success": false}Rate limit exceeded
object
Example
{ "success": false}Headers
Section titled “Headers”Seconds to wait before retrying
