This API updates the published state of a private workflow. The same endpoint handles both publishing and unpublishing by toggling the published flag in the request body.
A private workflow is a workflow created by a linked account itself — it belongs exclusively to that linked account and is not visible to or shared with the organization.
Request description
This API supports two authentication methods. You can use either a Session Token OR the combination of an Org API key and linked account ID.
Authentication Option 1: Session Token
Bearer token using the session token of the linked account. Format : Bearer <session_token>
Authentication Option 2: Org API Key + Linked Account ID
Your org-level Cobalt API key.
The unique identifier of the linked account to scope the request to.
The environment to target. Accepted values: test, production.
Path Parameters
The ID of the workflow to publish or unpublish. See usage notes below for which ID to pass depending on the operation.
Body Parameters
Set to true to publish the workflow, false to unpublish.
Optional description. Include when publishing.
Usage
Publishing and unpublishing use different workflow IDs. Read the steps below carefully.
Unpublish a workflow
Pass the parent workflow ID with "published": false:
curl --location --request PUT \
'https://api.gocobalt.io/api/v2/public/workflow/<workflow_id>/publish' \
--header 'Authorization: Bearer <session_token>' \
--header 'x-api-key: <your_api_key>' \
--header 'environment: test' \
--header 'Content-Type: application/json' \
--data '{"published": false}'
Publish a workflow
Publishing requires the draft workflow ID , not the parent workflow ID. Follow these two steps:
Step 1 — Fetch the draft workflow ID
Use the Get Draft Workflow endpoint to retrieve the draft:
curl --location \
'https://api.gocobalt.io/api/v2/public/workflow/<workflow_id>/edit' \
--header 'Authorization: Bearer <session_token>'
Copy the _id from the response — this is your draft_workflow_id:
{
"_id" : "69ce22a6ebade1cc4309b647" ,
"associated_workflow" : "69ce22a6ebade1cc4309b641" ,
"name" : "test" ,
"published" : false
}
Step 2 — Publish using the draft workflow ID
Pass the draft_workflow_id into the publish endpoint with "published": true:
curl --location --request PUT \
'https://api.gocobalt.io/api/v2/public/workflow/<draft_workflow_id>/publish' \
--header 'Authorization: Bearer <session_token>' \
--header 'x-api-key: <your_api_key>' \
--header 'environment: test' \
--header 'Content-Type: application/json' \
--data '{"published": true, "description": ""}'
Response description
Returns the updated workflow object reflecting the new published state. The new published state of the workflow — true if published, false if unpublished.
The current version number, incremented on each successful publish.
ISO 8601 timestamp of when the state was last changed.
System generated status code.
System generated error type.
Specific error code to identify the error.
Returned when the provided workflow_id does not exist. System generated status code.
System generated error type.
Specific error code to identify the error.
200 (Published)
200 (Unpublished)
401
404
{
"published" : true ,
"current_version" : 2 ,
"updatedAt" : "2025-07-10T11:22:00.000Z"
}