Create an order
Prices every line from the catalog, applies an active discount code,
and reserves stock (or queues production for made-to-order lines) line
by line. The order starts pending. Emits the orders.created webhook.
For a sale taken at the counter, with payment, use
POST /stores/{store_id}/orders/manual.
Authorization
bearer_auth Authorization: Bearer <token>. Either a session access token from POST /auth/login (refresh it with POST /auth/refresh) or a store API token (mobi_st_…). A store API token works only for the store it was issued in, and can do at most what its issuing user can there, narrowed to the scopes it was issued with.
In: header
Path Parameters
Store id
uuidHeader Parameters
A unique value (e.g. a UUID) per logical request. Retrying with the same key within 24 hours replays the first response instead of repeating the side effect; the replay carries Idempotent-Replayed: true. Reusing a key for a different request is a 422 idempotency_key_reused; retrying while the first is still running is a 409 idempotency_request_in_progress. JSON bodies up to 1 MB.
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/stores/497f6eca-6276-4993-bfeb-53cbbbba6f08/orders" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "product_variant_id": "3346b03a-4660-4dfb-b5d0-e13608e6ced8", "quantity": 0 } ] }'{
"allowed_status_transitions": [
"draft"
],
"cancelled_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"currency": "string",
"customer_document": "string",
"customer_email": "string",
"customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
"customer_name": "string",
"customer_phone": "string",
"danfe_url": "string",
"discount_cents": 0,
"freight_external_order_code": "string",
"freight_provider_code": "string",
"freight_quote_id": "7c41832f-da8e-4574-aa21-0a7c4fbcbe9e",
"freight_snapshot_json": {},
"freight_status": "string",
"fulfillment_method": "string",
"fulfillment_status": null,
"has_nfe": true,
"has_pending_builds": true,
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_test": true,
"items": [
{
"build_quantity": 0,
"build_status": "string",
"expected_ready_at": "2019-08-24T14:15:22Z",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"image_url": "string",
"order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
"product_id": "0d012afa-f885-4e65-aeca-37e27701e2d1",
"quantity": 0,
"reserved_quantity": 0,
"shipped_quantity": 0,
"sku": "string",
"title": "string",
"total_cents": 0,
"unit_price_cents": 0,
"variant_id": "8a2d415d-59aa-4132-bef3-011f97c4a0f6"
}
],
"next_build_ready_at": "2019-08-24T14:15:22Z",
"nf_value_cents": 0,
"nfe_key": "string",
"nfe_number": "string",
"notes": "string",
"number": "string",
"payer_document": "string",
"payment_expires_at": "2019-08-24T14:15:22Z",
"payment_intent_status": null,
"payment_method": "string",
"payment_provider_code": "string",
"payment_status": null,
"pickup_location_id": "5eb4dd60-b565-4dc0-8014-f7a790828fbb",
"pickup_location_snapshot_json": {},
"placed_at": "2019-08-24T14:15:22Z",
"refundable_cents": 0,
"refunded_cents": 0,
"refunds": [
{
"amount_cents": 0,
"created_at": "2019-08-24T14:15:22Z",
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
"currency": "string",
"external_id": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
"payment_intent_id": "7e322e88-5311-4979-b283-b9a687137f41",
"provider_code": "string",
"reason": "string"
}
],
"sales_channel_id": "77111faa-6b1b-4b6a-8288-d59a136e22da",
"shipments": [
{
"carrier_name": "string",
"cdf_price_id": 0,
"cdf_quotation_code": "string",
"cost_cents": 0,
"created_at": "2019-08-24T14:15:22Z",
"delivered_at": "2019-08-24T14:15:22Z",
"freight_external_order_code": "string",
"freight_payer": "string",
"freight_provider_code": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"items": [
{
"order_item_id": "c3e40b5c-b9ae-413a-b96e-5aa0514f5ae6",
"ordered_quantity": 0,
"quantity": 0,
"sku": "string",
"title": "string"
}
],
"notes": "string",
"order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
"shipped_at": "2019-08-24T14:15:22Z",
"status": "draft",
"store_id": "7fe87115-950c-4ae8-bd7e-970406bc9ac0",
"tracking_code": "string",
"tracking_events": [
{
"comment": "string",
"datetime": "string",
"event": "string",
"occurred_at": "2019-08-24T14:15:22Z"
}
],
"tracking_json": {},
"updated_at": "2019-08-24T14:15:22Z"
}
],
"shipping_cents": 0,
"shipping_contact": null,
"shipping_option": null,
"status": "draft",
"store_id": "7fe87115-950c-4ae8-bd7e-970406bc9ac0",
"subtotal_cents": 0,
"tax_cents": 0,
"total_cents": 0,
"updated_at": "2019-08-24T14:15:22Z"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}