{"openapi":"3.1.0","info":{"title":"Ecord Public API","description":"Ecord Public API. Every request is scoped to a single tenant via an API key (`Authorization: Bearer <key>` or `X-API-Key: <key>`). See https://docs.ecord.app for the full guide.","version":"1.0.0","contact":{"name":"Ecord Support","email":"support@ecord.app","url":"https://docs.ecord.app"},"license":{"name":"Proprietary","url":"https://ecord.app/terms"},"termsOfService":"https://ecord.app/terms"},"paths":{"/api/public/v1/ping":{"get":{"tags":["Meta"],"summary":"Ping","description":"Authenticated health check. Returns the caller's tenant and scopes.","operationId":"ping_api_public_v1_ping_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Ping Api Public V1 Ping Get"}}}}},"security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}]}},"/api/public/v1/orders":{"get":{"tags":["Orders"],"summary":"List Orders","operationId":"list_orders_api_public_v1_orders_get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/OrderStatus"},{"type":"null"}],"title":"Status"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Orders"],"summary":"Create Order","description":"Create an order from an external store. Idempotent on\n(external_platform, external_id): retries return the same order (200).","operationId":"create_order_api_public_v1_orders_post","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/orders/{order_id}":{"get":{"tags":["Orders"],"summary":"Get Order","operationId":"get_order_api_public_v1_orders__order_id__get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/driver/orders":{"get":{"tags":["Driver"],"summary":"List My Orders","operationId":"list_my_orders_api_public_v1_driver_orders_get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/OrderStatus"},{"type":"null"}],"title":"Status"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/driver/orders/{order_id}":{"get":{"tags":["Driver"],"summary":"Get My Order","operationId":"get_my_order_api_public_v1_driver_orders__order_id__get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/driver/orders/{order_id}/status":{"patch":{"tags":["Driver"],"summary":"Update My Order Status","operationId":"update_my_order_status_api_public_v1_driver_orders__order_id__status_patch","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriverOrderStatusUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/driver/orders/{order_id}/deliver":{"post":{"tags":["Driver"],"summary":"Deliver My Order","operationId":"deliver_my_order_api_public_v1_driver_orders__order_id__deliver_post","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriverDeliverRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/customers":{"get":{"tags":["Customers"],"summary":"List Customers","operationId":"list_customers_api_public_v1_customers_get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"phone","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"}},{"name":"external_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCustomerList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Customers"],"summary":"Upsert Customer","operationId":"upsert_customer_api_public_v1_customers_post","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCustomerWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCustomerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/customers/{customer_id}":{"get":{"tags":["Customers"],"summary":"Get Customer","operationId":"get_customer_api_public_v1_customers__customer_id__get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Customer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCustomerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Customers"],"summary":"Update Customer","operationId":"update_customer_api_public_v1_customers__customer_id__patch","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCustomerUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCustomerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/products":{"get":{"tags":["Products"],"summary":"List Products","operationId":"list_products_api_public_v1_products_get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"sku","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sku"}},{"name":"external_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProductList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Products"],"summary":"Upsert Product","operationId":"upsert_product_api_public_v1_products_post","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProductWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProductRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/products/{product_id}":{"get":{"tags":["Products"],"summary":"Get Product","operationId":"get_product_api_public_v1_products__product_id__get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProductRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Products"],"summary":"Update Product","operationId":"update_product_api_public_v1_products__product_id__patch","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProductUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProductRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/sales-invoices":{"get":{"tags":["Sales"],"summary":"List Sales Invoices","description":"Export sales invoices (human drivers + shipping companies, unified).\n\nRead-only. Strictly scoped to the caller's tenant. `invoice_date` reflects\nthe actual collection date the merchant received the cash.","operationId":"list_sales_invoices_api_public_v1_sales_invoices_get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date To"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicSalesInvoiceList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/sales-invoices/{invoice_id}":{"get":{"tags":["Sales"],"summary":"Get Sales Invoice","operationId":"get_sales_invoice_api_public_v1_sales_invoices__invoice_id__get","security":[{"HTTPBearer":[]},{"APIKeyHeader":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicSalesInvoiceRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CollectionStatus":{"type":"string","enum":["pending","collected","failed"],"title":"CollectionStatus"},"DiscountType":{"type":"string","enum":["none","fixed","percentage"],"title":"DiscountType"},"DriverDeliverRequest":{"properties":{"type":{"type":"string","pattern":"^(full|partial)$","title":"Type"},"items":{"anyOf":[{"items":{"$ref":"#/components/schemas/DriverPartialItem"},"type":"array"},{"type":"null"}],"title":"Items"}},"type":"object","required":["type"],"title":"DriverDeliverRequest"},"DriverOrderStatusUpdate":{"properties":{"status":{"$ref":"#/components/schemas/OrderStatus"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","required":["status"],"title":"DriverOrderStatusUpdate"},"DriverPartialItem":{"properties":{"product_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Product Id"},"product_name":{"type":"string","title":"Product Name"},"quantity":{"type":"number","exclusiveMinimum":0.0,"title":"Quantity"},"unit":{"type":"string","title":"Unit","default":"قطعة"},"price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Price"}},"type":"object","required":["product_name","quantity","price"],"title":"DriverPartialItem"},"GeneralOrderStatus":{"type":"string","enum":["open","closed"],"title":"GeneralOrderStatus"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"OrderSource":{"type":"string","enum":["whatsapp","manual","api","n8n","phone","ai","web","easyorders"],"title":"OrderSource"},"OrderStatus":{"type":"string","enum":["pending","confirmed","ready","dispatched","out_for_delivery","delivered","postponed","returned","cancelled","failed_delivery","waiting_redelivery","partial_delivered","support_requested","support_review"],"title":"OrderStatus"},"PaymentStatus":{"type":"string","enum":["unpaid","partial","paid"],"title":"PaymentStatus"},"PublicCustomerList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PublicCustomerRead"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"skip":{"type":"integer","title":"Skip"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["items","total","skip","limit"],"title":"PublicCustomerList"},"PublicCustomerRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"external_platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Platform"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"phone":{"type":"string","title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"zone_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Zone Id"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"total_orders":{"type":"integer","title":"Total Orders"},"successful_orders":{"type":"integer","title":"Successful Orders"},"failed_orders":{"type":"integer","title":"Failed Orders"},"total_spent":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Spent"},"rating":{"type":"string","title":"Rating"},"is_banned":{"type":"boolean","title":"Is Banned"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","phone","total_orders","successful_orders","failed_orders","total_spent","rating","is_banned","created_at","updated_at"],"title":"PublicCustomerRead","description":"Stable, curated public representation of a tenant customer."},"PublicCustomerUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"City"},"zone_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Zone Id"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"PublicCustomerUpdate","description":"PATCH payload — all fields optional; phone/external_* immutable here."},"PublicCustomerWrite":{"properties":{"phone":{"type":"string","maxLength":20,"minLength":3,"title":"Phone"},"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"City"},"zone_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Zone Id"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"external_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"External Id"},"external_platform":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"External Platform"}},"type":"object","required":["phone"],"title":"PublicCustomerWrite","description":"Create/upsert payload. Stats, rating and ban state are never writable."},"PublicOrderCreate":{"properties":{"external_id":{"type":"string","maxLength":200,"minLength":1,"title":"External Id"},"external_platform":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"External Platform"},"customer_phone":{"type":"string","maxLength":20,"title":"Customer Phone"},"customer_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Customer Name"},"delivery_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivery Address"},"zone_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Zone Id"},"items":{"items":{"$ref":"#/components/schemas/PublicOrderItemInput"},"type":"array","title":"Items"},"amount_paid":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount Paid","default":"0"},"discount_type":{"$ref":"#/components/schemas/DiscountType","default":"none"},"discount_value":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Discount Value","default":"0"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"scheduled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Scheduled At"}},"type":"object","required":["external_id","customer_phone"],"title":"PublicOrderCreate","description":"Store-facing order intake. `external_id` is required and enforces\nidempotency (same external_id/platform never creates a duplicate)."},"PublicOrderItemInput":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"quantity":{"type":"number","exclusiveMinimum":0.0,"title":"Quantity","default":1},"unit":{"type":"string","maxLength":50,"title":"Unit","default":"قطعة"},"product_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Product Id"},"unit_price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Unit Price"}},"type":"object","required":["name"],"title":"PublicOrderItemInput"},"PublicOrderList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PublicOrderRead"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"skip":{"type":"integer","title":"Skip"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["items","total","skip","limit"],"title":"PublicOrderList"},"PublicOrderRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"order_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Number"},"status":{"$ref":"#/components/schemas/OrderStatus"},"general_status":{"$ref":"#/components/schemas/GeneralOrderStatus"},"collection_status":{"$ref":"#/components/schemas/CollectionStatus"},"payment_status":{"$ref":"#/components/schemas/PaymentStatus"},"source":{"$ref":"#/components/schemas/OrderSource"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Phone"},"delivery_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivery Address"},"zone_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zone Name"},"driver_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Driver Name"},"items":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Items"},"total_amount":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Total Amount"},"subtotal":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Subtotal"},"delivery_price":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Delivery Price"},"amount_paid":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Amount Paid"},"cash_collected":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Cash Collected"},"currency":{"type":"string","title":"Currency"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"external_platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Platform"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"scheduled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Scheduled At"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Delivered At"},"postponed_until":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Postponed Until"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","order_number","status","general_status","collection_status","payment_status","source","currency","created_at","updated_at"],"title":"PublicOrderRead","description":"Stable, curated public representation of an order."},"PublicProductList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PublicProductRead"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"skip":{"type":"integer","title":"Skip"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["items","total","skip","limit"],"title":"PublicProductList"},"PublicProductRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"external_platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Platform"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sku"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"price":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Price"},"is_free_delivery":{"type":"boolean","title":"Is Free Delivery"},"aliases":{"items":{},"type":"array","title":"Aliases"},"available_units":{"items":{},"type":"array","title":"Available Units"},"default_unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Unit"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","name","price","is_free_delivery","aliases","available_units","is_active","created_at","updated_at"],"title":"PublicProductRead","description":"Stable, curated public representation of a tenant product."},"PublicProductUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sku"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Price"},"is_free_delivery":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Free Delivery"},"aliases":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Aliases"},"available_units":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Available Units"},"default_unit":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Default Unit"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"PublicProductUpdate","description":"PATCH payload — all fields optional; external_* immutable here."},"PublicProductWrite":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sku"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Price"},"is_free_delivery":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Free Delivery"},"aliases":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Aliases"},"available_units":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Available Units"},"default_unit":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Default Unit"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"external_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"External Id"},"external_platform":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"External Platform"}},"type":"object","required":["name"],"title":"PublicProductWrite","description":"Create/upsert payload."},"PublicSalesInvoiceItem":{"properties":{"order_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Order Id"},"order_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Number"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"order_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Order Total"},"commission":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Commission"},"net_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Net Total"},"products":{"items":{"$ref":"#/components/schemas/PublicSalesInvoiceProductLine"},"type":"array","title":"Products"}},"type":"object","required":["order_total","commission","net_total"],"title":"PublicSalesInvoiceItem","description":"A sub-invoice line: one collected order inside the sales invoice."},"PublicSalesInvoiceList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PublicSalesInvoiceSummary"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"skip":{"type":"integer","title":"Skip"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["items","total","skip","limit"],"title":"PublicSalesInvoiceList"},"PublicSalesInvoiceProductLine":{"properties":{"name":{"type":"string","title":"Name"},"quantity":{"type":"number","title":"Quantity"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"price":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Price"}},"type":"object","required":["name","quantity"],"title":"PublicSalesInvoiceProductLine"},"PublicSalesInvoiceRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"invoice_number":{"type":"string","title":"Invoice Number"},"invoice_date":{"type":"string","format":"date","title":"Invoice Date"},"driver_id":{"type":"string","format":"uuid","title":"Driver Id"},"driver_name":{"type":"string","title":"Driver Name"},"driver_kind":{"type":"string","title":"Driver Kind"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount"},"total_commission":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Commission"},"bonus":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Bonus"},"shortage_deduction":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Shortage Deduction"},"debt_deduction":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Debt Deduction"},"net_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Net Amount"},"orders_count":{"type":"integer","title":"Orders Count"},"has_settlement":{"type":"boolean","title":"Has Settlement"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"items":{"items":{"$ref":"#/components/schemas/PublicSalesInvoiceItem"},"type":"array","title":"Items"}},"type":"object","required":["id","invoice_number","invoice_date","driver_id","driver_name","driver_kind","total_amount","total_commission","bonus","shortage_deduction","debt_deduction","net_amount","orders_count","has_settlement","created_at"],"title":"PublicSalesInvoiceRead","description":"Full invoice: header + sub-invoice line items."},"PublicSalesInvoiceSummary":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"invoice_number":{"type":"string","title":"Invoice Number"},"invoice_date":{"type":"string","format":"date","title":"Invoice Date"},"driver_id":{"type":"string","format":"uuid","title":"Driver Id"},"driver_name":{"type":"string","title":"Driver Name"},"driver_kind":{"type":"string","title":"Driver Kind"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount"},"total_commission":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Commission"},"bonus":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Bonus"},"shortage_deduction":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Shortage Deduction"},"debt_deduction":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Debt Deduction"},"net_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Net Amount"},"orders_count":{"type":"integer","title":"Orders Count"},"has_settlement":{"type":"boolean","title":"Has Settlement"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","invoice_number","invoice_date","driver_id","driver_name","driver_kind","total_amount","total_commission","bonus","shortage_deduction","debt_deduction","net_amount","orders_count","has_settlement","created_at"],"title":"PublicSalesInvoiceSummary","description":"Header-only row for the list endpoint (no line items)."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}}},"tags":[{"name":"Orders","description":"Create and query orders."},{"name":"Driver","description":"Shipping-company / external driver order operations."},{"name":"Customers","description":"Customer sync and lookup."},{"name":"Products","description":"Product catalog sync and lookup."},{"name":"Sales","description":"Sales invoices."},{"name":"Webhooks","description":"Outbound event webhooks (HMAC-signed). Not REST endpoints — see https://docs.ecord.app for payload shapes and signature verification."},{"name":"Meta","description":"Authenticated connectivity check."}],"servers":[{"url":"https://api.ecord.app"}]}