> For the complete documentation index, see [llms.txt](https://api-docs.easyday.dk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.easyday.dk/commerce.md).

# Commerce

## GET /v1/commerce/customers

> Lists customers for the authenticated tenant.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Commerce"}],"paths":{"/v1/commerce/customers":{"get":{"tags":["Commerce"],"summary":"Lists customers for the authenticated tenant.","parameters":[{"name":"email","in":"query","description":"Filter to an exact (case-insensitive) email match.","schema":{"type":"string"}},{"name":"page","in":"query","description":"1-based page number.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32","default":1}},{"name":"pageSize","in":"query","description":"Page size, clamped to 1-200.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32","default":50}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/PagedResultOfCustomerVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/PagedResultOfCustomerVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/PagedResultOfCustomerVm"}}}}}}}},"components":{"schemas":{"PagedResultOfCustomerVm":{"required":["total","page","pageSize","items"],"type":"object","properties":{"total":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"page":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"pageSize":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CustomerVm"}}},"description":"Paged list response."},"CustomerVm":{"required":["id","name","active"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"no":{"type":["null","string"]},"name":{"type":"string"},"email":{"type":["null","string"]},"phone":{"type":["null","string"]},"active":{"type":"boolean"}}}}}}
```

## GET /v1/commerce/customers/{id}

> Gets one customer.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Commerce"}],"paths":{"/v1/commerce/customers/{id}":{"get":{"tags":["Commerce"],"summary":"Gets one customer.","parameters":[{"name":"id","in":"path","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/CustomerVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/CustomerVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/CustomerVm"}}}},"404":{"description":"Not Found","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"CustomerVm":{"required":["id","name","active"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"no":{"type":["null","string"]},"name":{"type":"string"},"email":{"type":["null","string"]},"phone":{"type":["null","string"]},"active":{"type":"boolean"}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## GET /v1/commerce/orders

> Lists orders for the authenticated tenant, newest first. Draft/pending-payment\
> baskets are excluded unless includeDrafts is set.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Commerce"}],"paths":{"/v1/commerce/orders":{"get":{"tags":["Commerce"],"summary":"Lists orders for the authenticated tenant, newest first. Draft/pending-payment\nbaskets are excluded unless includeDrafts is set.","parameters":[{"name":"customerId","in":"query","description":"Filter to one customer's orders.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"}},{"name":"includeDrafts","in":"query","description":"Include in-progress baskets, not just finalized orders/invoices.","schema":{"type":"boolean","default":false}},{"name":"page","in":"query","description":"1-based page number.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32","default":1}},{"name":"pageSize","in":"query","description":"Page size, clamped to 1-200.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32","default":50}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/PagedResultOfOrderVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/PagedResultOfOrderVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/PagedResultOfOrderVm"}}}}}}}},"components":{"schemas":{"PagedResultOfOrderVm":{"required":["total","page","pageSize","items"],"type":"object","properties":{"total":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"page":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"pageSize":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"items":{"type":"array","items":{"$ref":"#/components/schemas/OrderVm"}}},"description":"Paged list response."},"OrderVm":{"required":["id","status","type","channelId","currencyId","lines"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"publicKey":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"type":{"type":"string"},"orderDate":{"type":["null","string"],"format":"date-time"},"channelId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"currencyId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"customerId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/OrderLineVm"}}}},"OrderLineVm":{"required":["id","productId","quantity"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"productId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"quantity":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["number","string"],"format":"double"},"unitPrice":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["null","number","string"],"format":"double"},"comment":{"type":["null","string"]}}}}}}
```

## POST /v1/commerce/orders

> Creates a finalized (non-draft) order in one call - for an external system that\
> has already decided the order is final, not for building up a basket incrementally.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Commerce"}],"paths":{"/v1/commerce/orders":{"post":{"tags":["Commerce"],"summary":"Creates a finalized (non-draft) order in one call - for an external system that\nhas already decided the order is final, not for building up a basket incrementally.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/OrderVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/OrderVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/OrderVm"}}}},"400":{"description":"Bad Request","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"CreateOrderRequest":{"required":["channelId","currencyId","lines"],"type":"object","properties":{"channelId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"currencyId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"customerId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"description":"Must belong to the authenticated tenant if provided; omit for a guest order.","format":"int32"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/CreateOrderLineRequest"}}}},"CreateOrderLineRequest":{"required":["productId","quantity"],"type":"object","properties":{"productId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Must belong to the authenticated tenant.","format":"int32"},"quantity":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["number","string"],"format":"double"},"unitPrice":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["null","number","string"],"format":"double"},"comment":{"type":["null","string"]}}},"OrderVm":{"required":["id","status","type","channelId","currencyId","lines"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"publicKey":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"type":{"type":"string"},"orderDate":{"type":["null","string"],"format":"date-time"},"channelId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"currencyId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"customerId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/OrderLineVm"}}}},"OrderLineVm":{"required":["id","productId","quantity"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"productId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"quantity":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["number","string"],"format":"double"},"unitPrice":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["null","number","string"],"format":"double"},"comment":{"type":["null","string"]}}},"ErrorResponse":{"required":["error"],"type":"object","properties":{"error":{"type":"string"}},"description":"Error response shape used by 400 Bad Request responses."}}}}
```

## GET /v1/commerce/orders/{id}

> Gets one order with its lines.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Commerce"}],"paths":{"/v1/commerce/orders/{id}":{"get":{"tags":["Commerce"],"summary":"Gets one order with its lines.","parameters":[{"name":"id","in":"path","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/OrderVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/OrderVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/OrderVm"}}}},"404":{"description":"Not Found","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"OrderVm":{"required":["id","status","type","channelId","currencyId","lines"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"publicKey":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"type":{"type":"string"},"orderDate":{"type":["null","string"],"format":"date-time"},"channelId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"currencyId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"customerId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/OrderLineVm"}}}},"OrderLineVm":{"required":["id","productId","quantity"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"productId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"quantity":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["number","string"],"format":"double"},"unitPrice":{"pattern":"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$","type":["null","number","string"],"format":"double"},"comment":{"type":["null","string"]}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```
