Skip to main content

Overview

Create a new order for the authenticated user. The order is automatically associated with the tenant specified in the X-Tenant-ID header.

Authorization

  • User must be authenticated with a valid Bearer token
  • User must be a member of the tenant
  • Requires X-Tenant-ID header

Tenant Scoping

Orders are automatically associated with the tenant from the X-Tenant-ID header. The system ensures that:
  • Products in the order belong to the same tenant
  • The delivery address belongs to the authenticated user
  • All data is isolated per tenant

Request Body

Example Usage

Success Response

Error Responses

Validation Error (422)

Server Error (500)

Notes

  • The order is created within a database transaction for data integrity
  • If any part of the order creation fails, the entire transaction is rolled back
  • All order items are validated before creation
  • The authenticated user is automatically set as the order owner