Skip to content

Orders

8 operations in the orders namespace.

Commit roasted stock to an order

POST /rpc/v1/orders.allocateOrder

Allocates each line by first-expiry-first-out. Allocation moves no stock — it records a claim so the same kilogram cannot be promised twice; the weight leaves inventory at fulfilment. A partial allocation is reported as a shortfall rather than treated as success.

Requires permission orders.write and the orders module on the organization’s plan.

Field Type Required Description
id string yes
strategy fefo | fifo no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.allocateOrder \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Confirm an order so it becomes demand

POST /rpc/v1/orders.confirmOrder

Only confirmed orders reach production planning. A draft is a conversation; scheduling against one would roast coffee nobody has agreed to buy.

Requires permission orders.write and the orders module on the organization’s plan.

Field Type Required Description
id string yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.confirmOrder \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Create a customer

POST /rpc/v1/orders.createCustomer

Requires permission orders.write and the orders module on the organization’s plan.

Field Type Required Description
name string yes
code string yes
customerType wholesale | cafe | retail | distributor | subscription | internal | export no
currency string no
paymentTermsDays integer no
contactEmail string no
shippingAddress string no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.createCustomer \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Create a sales order

POST /rpc/v1/orders.createOrder

An external order id makes re-importing the same webstore order a no-op rather than a duplicate — the failure mode of every integration that polls.

Requires permission orders.write and the orders module on the organization’s plan.

Field Type Required Description
orderNumber string yes
customerId string yes
channel direct | webstore | edi | marketplace | api no
externalOrderId string no
currency string no
requestedShipAt string no
lines object[] yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.createOrder \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Get an order with its lines

POST /rpc/v1/orders.getOrder

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

Requires permission orders.read and the orders module on the organization’s plan.

Field Type Required Description
id string yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.getOrder \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

List customers

POST /rpc/v1/orders.listCustomers

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

Requires permission orders.read and the orders module on the organization’s plan.

Field Type Required Description
filter object no
page object no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.listCustomers \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

List sales orders

POST /rpc/v1/orders.listOrders

Also available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.

Requires permission orders.read and the orders module on the organization’s plan.

Field Type Required Description
filter object no
page object no
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.listOrders \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'

Return allocated stock to available

POST /rpc/v1/orders.releaseOrderAllocation

Requires permission orders.write and the orders module on the organization’s plan.

Field Type Required Description
orderLineId string yes
Terminal window
curl -X POST https://api.roastery.run/rpc/v1/orders.releaseOrderAllocation \
-H "Authorization: Bearer $ROASTERY_API_KEY" \
-H "X-Roastery-Org: $ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'