Orders
8 operations in the orders namespace.
orders.allocateOrder
Section titled “orders.allocateOrder”Commit roasted stock to an order
POST /rpc/v1/orders.allocateOrderAllocates 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.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes | |
strategy |
fefo | fifo |
no |
Example
Section titled “Example”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 '{}'orders.confirmOrder
Section titled “orders.confirmOrder”Confirm an order so it becomes demand
POST /rpc/v1/orders.confirmOrderOnly 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.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes |
Example
Section titled “Example”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 '{}'orders.createCustomer
Section titled “orders.createCustomer”Create a customer
POST /rpc/v1/orders.createCustomerRequires permission orders.write and the orders module on the organization’s plan.
Request
Section titled “Request”| 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 |
Example
Section titled “Example”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 '{}'orders.createOrder
Section titled “orders.createOrder”Create a sales order
POST /rpc/v1/orders.createOrderAn 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.
Request
Section titled “Request”| 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 |
Example
Section titled “Example”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 '{}'orders.getOrder
Section titled “orders.getOrder”Get an order with its lines
POST /rpc/v1/orders.getOrderAlso 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.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes |
Example
Section titled “Example”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 '{}'orders.listCustomers
Section titled “orders.listCustomers”List customers
POST /rpc/v1/orders.listCustomersAlso 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.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
filter |
object | no | |
page |
object | no |
Example
Section titled “Example”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 '{}'orders.listOrders
Section titled “orders.listOrders”List sales orders
POST /rpc/v1/orders.listOrdersAlso 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.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
filter |
object | no | |
page |
object | no |
Example
Section titled “Example”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 '{}'orders.releaseOrderAllocation
Section titled “orders.releaseOrderAllocation”Return allocated stock to available
POST /rpc/v1/orders.releaseOrderAllocationRequires permission orders.write and the orders module on the organization’s plan.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
orderLineId |
string | yes |
Example
Section titled “Example”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 '{}'