Traceability
4 operations in the traceability namespace.
traceability.issueCertificate
Section titled “traceability.issueCertificate”Freeze a traceability certificate
POST /rpc/v1/traceability.issueCertificateMaterializes the chain as it is RIGHT NOW and mints a public QR token. Deliberately a snapshot: lots get merged, split and consumed after coffee ships, so re-deriving the chain later would describe something other than what was in the bag.
Requires permission traceability.read and the core module on the organization’s plan.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
roastedLotId |
string | yes | |
orderLineId |
string | no | |
fulfillmentId |
string | no |
Example
Section titled “Example”curl -X POST https://api.roastery.run/rpc/v1/traceability.issueCertificate \ -H "Authorization: Bearer $ROASTERY_API_KEY" \ -H "X-Roastery-Org: $ORG_ID" \ -H "Content-Type: application/json" \ -d '{}'traceability.listCertificates
Section titled “traceability.listCertificates”Issued certificates
POST /rpc/v1/traceability.listCertificatesAlso available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.
Requires permission traceability.read and the core 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/traceability.listCertificates \ -H "Authorization: Bearer $ROASTERY_API_KEY" \ -H "X-Roastery-Org: $ORG_ID" \ -H "Content-Type: application/json" \ -d '{}'traceability.traceBackward
Section titled “traceability.traceBackward”What went into this coffee
POST /rpc/v1/traceability.traceBackwardAlso available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.
Walks the lineage graph upstream in ONE query — a shipment reaches its contracts, a bag reaches its farms. The recall direction: given something a customer has, find everything that could be affected.
Requires permission traceability.read and the core module on the organization’s plan.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
kind |
producer | green_lot | roast_batch | roasted_lot | blend_lot | product_batch | order_line |
yes | |
id |
string | yes |
Example
Section titled “Example”curl -X POST https://api.roastery.run/rpc/v1/traceability.traceBackward \ -H "Authorization: Bearer $ROASTERY_API_KEY" \ -H "X-Roastery-Org: $ORG_ID" \ -H "Content-Type: application/json" \ -d '{}'traceability.traceForward
Section titled “traceability.traceForward”Where this coffee ended up
POST /rpc/v1/traceability.traceForwardAlso available as GET with a URL-encoded input query parameter, so the response can be HTTP-cached.
The other recall direction, and the one that actually matters when a lot is found to be contaminated: given a green lot, find every customer who received it.
Requires permission traceability.read and the core module on the organization’s plan.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
kind |
producer | green_lot | roast_batch | roasted_lot | blend_lot | product_batch | order_line |
yes | |
id |
string | yes |
Example
Section titled “Example”curl -X POST https://api.roastery.run/rpc/v1/traceability.traceForward \ -H "Authorization: Bearer $ROASTERY_API_KEY" \ -H "X-Roastery-Org: $ORG_ID" \ -H "Content-Type: application/json" \ -d '{}'