Publish a product
Checks that nothing blocks publishing, then publishes. When something does, the first step ends the workflow and blockers says what to fix, in order: account blockers (business registration, store settings) are fixed in the dashboard, product blockers (category, compliance documents) through the API.
What you need
- product_idstringRequired
The product to publish (
prd_...).
Step 1: Get a product
Read the product. publishing.can_publish is true once its designs are approved and nothing else blocks it; otherwise publishing.blockers lists each blocker with a code and what to do.
{
"path id": "$inputs.product_id"
}Succeeds when:
$statusCode == 200$response.body#/publishing/can_publish == true
Keeps for the next steps:
review_status:$response.body#/review/statusblockers:$response.body#/publishing/blockers
Step 2: Publish a product
Publish. Refused with plan_limit_reached when your plan limit of public products is reached, or cannot_publish (with details.blockers) if something changed since the check.
{
"path id": "$inputs.product_id"
}Succeeds when:
$statusCode == 200
Otherwise:
plan_limit_reached: stop the workflow when$statusCode == 403.cannot_publish: stop the workflow when$statusCode == 409.
Keeps for the next steps:
is_public:$response.body#/publishing/is_public
As a workflow file
The workflow returns:
is_public:$steps.publish.outputs.is_publicblockers:$steps.check_product.outputs.blockers
Values starting with $ are filled in as you go: $inputs.x is something you provide, $steps.s.outputs.o is a value an earlier step returned, and $response.body#/path a field of this response.
This recipe is the workflow publish_product of arazzo.json, an Arazzo 1.0 document that tools and AI agents can follow step by step.