Partner APIs / Crate & Co. API Reference
CBLast edited by Cyrus Bahrami · Crate & Co.

Crate & Co. Order API

v1.0.0 · Base URL https://crate-co-api.vercel.app/api

The order API for the Crate & Co. platform. Outbound endpoints are called from your Salesforce org over the `Crate_Co` Named Credential - you never paste the base URL or a token, the Named Credential supplies both. Inbound actions are invoked by Crate & Co. against autolaunched Flows you expose.

Auth. OAuth 2.0 - Client Credentials. Configure via an External Credential; Salesforce fetches and refreshes the bearer token automatically from the token endpoint https://crate-co-api.vercel.app/api/oauth/token. You never call the token endpoint from a Flow - the Named Credential supplies the token on every callout.

Outbound - called by your org

POST/crate-co/ordersPlace an order
Request
{
  "productSku": "SKU-1000",
  "quantity": 2,
  "destination": "Austin, TX"
}
Response
201 Created
{
  "trackingNumber": "APX-a1b2c3d4",
  "status": "PLACED",
  "orderId": "..."
}

`productSku` and `quantity` are required; `quantity` must be a number, not a string. `destination` is optional. The `trackingNumber` in the response is the key for every follow-up call (check status, cancel) - not `orderId`.

Errors
  • 400 - missing/invalid field
  • 401 - auth failed (auto-retried)
Used in CCI-7
GET/crate-co/orders/{trackingNumber}Check an order's status
Request
- (no body; trackingNumber in the path as a String)
Response
200 OK
{
  "trackingNumber": "APX-a1b2c3d4",
  "status": "SHIPPED",
  "productSku": "SKU-1000",
  "quantity": 2
}

You only ever see orders your own tenant placed. Reads are filtered by the identity in your bearer token, so a tracking number that belongs to another tenant (or doesn't exist) comes back 404 - never revealing that it exists.

Errors
  • 401 - auth failed
  • 404 - unknown order (or not one of yours)
Used in CCI-9
GET/crate-co/orders?status={status}List your orders (filterable)
Request
- (filter via the `status` query param)
Response
200 OK
{
  "count": 2,
  "orders": [
    { "trackingNumber": "APX-a1b2c3d4", "status": "SHIPPED", "productSku": "SKU-1000", "quantity": 2, "destination": "Austin, TX" }
  ]
}

Supported filter: `status`. Returns a `count` alongside your matching orders.

Errors
  • 401 - auth failed
Used in CCI-11
PATCH/crate-co/orders/{trackingNumber}Cancel / update an order
Request
{
  "status": "CANCELLED"
}
Response
200 OK
{
  "trackingNumber": "APX-a1b2c3d4",
  "status": "CANCELLED"
}

PATCH updates part of the resource - you change status, you don't delete the record.

Errors
  • 400 - invalid status
  • 401 - auth failed
  • 404 - unknown order (or not one of yours)
Used in CCI-13

Inbound - called by Crate & Co. against your org

FLOWCount_Account_OrdersCount an account's orders
Request
{ "accountName": "Northwind Traders Ltd" }
Response
{ "orderCount": 3 }

Return a single integer, not a record collection.

Used in CCI-17
FLOWLookup_Order_By_TrackingLook up an order by tracking number
Request
{ "trackingNumber": "APX-SEED-1001" }
Response
{ "orderStatus": "Shipped", "orderDestination": "Denver, CO" }

Filter on the business key (tracking number), not the record Id. Output variable names are the contract - your Flow must expose `orderStatus` and `orderDestination`.

Used in CCI-19
FLOWUpdate_Order_StatusUpdate an order
Request
{ "trackingNumber": "APX-SEED-3001", "newStatus": "Delivered" }
Response
{ "updatedStatus": "Delivered" }

This writes to your records - the Flow must actually commit the change, then read the record back and return that value (not the input) as `updatedStatus`.

Used in CCI-21