Download OpenAPI specification:
Commerce and order-fulfilment platform API for 4klyft.
This API provides endpoints for managing:
All API endpoints (except /api/docs and /api/v1/iam/auth/*) require JWT Bearer token authentication.
Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Every /api/ request is rate-limited per caller — by your authenticated
identity when a token is present, otherwise by client IP. The
authentication endpoints (/auth/login, /auth/refresh,
/auth/request-password-reset) carry stricter, IP-based limits.
Each response advertises your current budget via headers:
X-RateLimit-Limit — the bucket sizeX-RateLimit-Remaining — tokens left in the current windowX-RateLimit-Reset — Unix timestamp when a token next frees upExceeding a limit returns 429 Too Many Requests (RFC 6585) with a
Retry-After header (seconds to wait). Back off and retry after the
indicated delay rather than hammering the endpoint.
Fulfilment policy — the tenant's routing brain. A policy owns an ordered set of WHEN…THEN rules plus a default strategy (mode + custodian priorities); it is assigned per channel / channel-type / org-default and consulted by the placement engine. Item detail (rules) comes from the event-sourced aggregate; the collection is served from the lean read-model.
All fulfilment policies for the current tenant, newest first.
| page | integer Default: 1 The collection page number |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}
]
}Create a draft policy with a name, default mode, and (optional) custodian priorities.
The new FulfilmentPolicy resource
| name required | string <= 255 characters Default: "" |
| mode required | string Default: "priority" Enum: "priority" "exclusive" |
| custodianPriorities | Array of strings |
| currency | string or null ISO-4217 currency the policy's money thresholds are expressed in. Optional — the org default currency is used (resolved at write time) when omitted. |
{- "name": "",
- "mode": "priority",
- "custodianPriorities": [
- "string"
], - "currency": "string"
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}A single policy with its ordered rules loaded from the aggregate.
| id required | string FulfilmentPolicy identifier |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Activate the policy
| id required | string FulfilmentPolicy identifier |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Archive the policy
| id required | string FulfilmentPolicy identifier |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Assign the policy to a scope (channel / channel-type / org-default)
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| scope required | string Default: "" Enum: "channel" "channel_type" "org_default" |
| scopeKey | string or null |
{- "scope": "channel",
- "scopeKey": "string"
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Clear a scope assignment
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| scope required | string Default: "" Enum: "channel" "channel_type" "org_default" |
| scopeKey | string or null |
{- "scope": "channel",
- "scopeKey": "string"
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Evaluate the policy against a sample order context and return the decision without creating anything.
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| channelId | string or null |
| channelType | string or null |
| destinationCountry | string or null <= 2 characters |
| orderValue | integer or null >= 0 |
| currency | string or null <= 3 characters |
| totalWeightGrams | integer or null >= 0 |
| itemFlags | Array of strings |
| skus | Array of strings |
| categoryIds | Array of strings |
{- "channelId": "string",
- "channelType": "string",
- "destinationCountry": "st",
- "orderValue": 0,
- "currency": "str",
- "totalWeightGrams": 0,
- "itemFlags": [
- "string"
], - "skus": [
- "string"
], - "categoryIds": [
- "string"
]
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "outcome": "assign",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "custodianId": "string",
- "reason": "string"
}Remove a rule
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| ruleId required | string <ulid> Default: "" |
{- "ruleId": ""
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Rename a policy
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| name required | string <= 255 characters Default: "" |
{- "name": ""
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Reorder rules (drag-to-sort priority)
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| orderedRuleIds | Array of strings non-empty |
{- "orderedRuleIds": [
- "string"
]
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Append a rule
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| ruleId | string or null <ulid> |
| enabled | boolean Default: true |
Array of objects (FulfilmentRuleConditionInput) | |
required | object (FulfilmentRuleActionInput) |
{- "ruleId": "string",
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Set the default mode + custodian priorities
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| mode required | string Default: "priority" Enum: "priority" "exclusive" |
| custodianPriorities | Array of strings |
{- "mode": "priority",
- "custodianPriorities": [
- "string"
]
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Replace an existing rule in place
| id required | string FulfilmentPolicy identifier |
The new FulfilmentPolicy resource
| ruleId required | string <ulid> Default: "" |
| enabled | boolean Default: true |
Array of objects (FulfilmentRuleConditionInput) | |
required | object (FulfilmentRuleActionInput) |
{- "ruleId": "",
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "name": "string",
- "mode": "priority",
- "currency": "string",
- "status": "draft",
- "ruleCount": 0,
- "custodianPriorities": [
- "string"
], - "rules": [
- {
- "id": "string",
- "order": 0,
- "enabled": true,
- "conditions": [
- {
- "attribute": "destination_country",
- "operator": "is",
- "values": [
- "string"
]
}
], - "action": {
- "type": "assign_custodian",
- "custodianId": "string",
- "mode": "priority",
- "priorities": [
- "string"
], - "reason": "string"
}
}
], - "createdAt": "string"
}Every sales channel with the fulfilment policy bound at each scope tier and the resolved effective policy.
| page | integer Default: 1 The collection page number |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "channelName": "string",
- "channelCode": "string",
- "channelType": "string",
- "channelPolicy": {
- "policyId": "string",
- "policyName": "string"
}, - "channelTypePolicy": {
- "policyId": "string",
- "policyName": "string"
}, - "orgDefaultPolicy": {
- "policyId": "string",
- "policyName": "string"
}, - "resolvedPolicy": {
- "policyId": "string",
- "policyName": "string"
}, - "resolvedVia": "channel"
}
]
}Retrieve a paginated list of fulfilment orders with optional filters.
| sourceOrderId | string <ulid> |
| number | string |
| custodianId | string <ulid> |
| status | string |
| policyId | string <ulid> |
| page | integer >= 1 Default: 1 |
| itemsPerPage | integer [ 1 .. 100 ] Default: 20 |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}
]
}Retrieve a single fulfilment order by its ULID.
| id required | string FulfilmentOrder identifier |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Cancel a non-terminal fulfilment order with a reason.
| id required | string FulfilmentOrder identifier |
The new FulfilmentOrder resource
| reason required | string [ 1 .. 1024 ] characters Default: "" |
{- "reason": ""
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Flag a fulfilment order as partially-dispatched-only with a reason — the remainder is treated as cancelled.
| id required | string FulfilmentOrder identifier |
The new FulfilmentOrder resource
| reason required | string [ 1 .. 1024 ] characters Default: "" |
{- "reason": ""
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Operator override of the FulfilmentOrder expected delivery date. Pass null/omit to clear.
| id required | string FulfilmentOrder identifier |
The new FulfilmentOrder resource
| expectedDeliveryAt | string or null |
{- "expectedDeliveryAt": "string"
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Operator override of the FulfilmentOrder expected ship-by date. Pass null/omit to clear.
| id required | string FulfilmentOrder identifier |
The new FulfilmentOrder resource
| expectedShipAt | string or null |
{- "expectedShipAt": "string"
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Change the (custodian, warehouse) assignment of a CREATED fulfilment order. Reassignment is forbidden once a custodian has accepted (OPEN) the order.
| id required | string FulfilmentOrder identifier |
The new FulfilmentOrder resource
| custodianId required | string <ulid> Default: "" |
{- "custodianId": ""
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Assign a custodian to a HELD order (policy Reject / Manual review) so it enters the normal assigned lifecycle.
| id required | string FulfilmentOrder identifier |
The new FulfilmentOrder resource
| custodianId required | string <ulid> Default: "" |
{- "custodianId": ""
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "string",
- "number": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "custodianName": "string",
- "node": "string",
- "policyId": "string",
- "appliedRuleIds": [
- "string"
], - "lineItems": [
- {
- "itemId": "string",
- "quantity": 0,
- "trackingRef": "string"
}
], - "status": "held",
- "holdOutcome": "reject",
- "holdReason": "string",
- "expectedShipAt": "string",
- "expectedDeliveryAt": "string",
- "notes": "string",
- "externalIds": {
- "property1": "string",
- "property2": "string"
}, - "createdAt": "string",
- "updatedAt": "string",
- "closedAt": "string"
}Retrieve a fulfilment order together with its 3PL execution snapshot (provider type/status/sync) and a backend-computed operator ladder in a single response.
| orderId required | string FulfilmentOrderPipeline identifier |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "orderId": "string",
- "orderNumber": "string",
- "orderStatus": "string",
- "sourceOrderId": "string",
- "custodianId": "string",
- "node": "string",
- "execution": {
- "providerType": "string",
- "providerExternalId": "string",
- "status": "string",
- "syncedAt": "string",
- "failureReason": "string"
}, - "stages": [
- {
- "key": "string",
- "label": "string",
- "status": "string",
- "at": "string"
}
]
}