Skip to main content
This is the canonical write flow: create a restock plan, then add an item. The same shape applies to other plan types (rebalance, etc.) — only the paths and fields differ.
This creates real data in your organization. Use a token with the right write permission, and test against a non-production organization first if you can.

1. Create the plan

POST /api/restock-plans with name (and optionally brandId, collectionId, description). It returns the new plan’s id and status (DRAFT).
Response:

2. Add an item

POST /api/restock-plans/{planId}/items with variantId, sizeId, shopId, quantity. It returns { "success": true, "itemId": "…" }.

Handle the response

Adding items runs through business rules, so plan for these outcomes:
  • Success{ "success": true, "itemId": "…" }.
  • Blocked by a rulesuccess: false with errorCode: "BUSINESS_RULE_VIOLATION"; read the message and adjust.
  • ValidationerrorCode: "VARIANT_REQUIRED", "QUANTITY_INVALID", etc. Fix the payload.
  • Auth401 UNAUTHORIZED (bad/expired token) or 403 FORBIDDEN (missing permission).
See Error codes for the full mapping.
Other plan types follow the same pattern — e.g. rebalance is POST /api/rebalance-plans then POST /api/rebalance-plans/{id}/items. Browse the exact fields per endpoint in the API Reference tab.