Publish workflow
Publishes the draft of a workflow: the draft is validated with the publish rules (exactly one trigger, every node
reachable from it, a cron trigger in seconds mode needs an interval of at least 10 seconds),
the previously published version is archived and the workflow becomes active. From then on the trigger runs
this version. A workflow without a draft but with a published version is simply set back to active.
No body is needed.
Base URL:
POST: https://api.smsgatewayapi.com/v1/flows/{flow_id}/publishExample:
POST: https://api.smsgatewayapi.com/v1/flows/flw_5d41402abc4b2a76b9719d911017c592/publish
| Parameter | Input | Description | |
|---|---|---|---|
| client_id | API client ID | Developer › API & Webhooks › API credentials | Required |
| client_secret | API client secret | A cs_ credential, shown once when you create it under Developer › API & Webhooks › API credentials | Required |
| flow_id | workflow ID | The public ID (flw_...) of the workflow as returned by List workflows; the numeric ID is accepted too | Required |
<?php
//PHP - cURL
$ch = curl_init();
$url = "https://api.smsgatewayapi.com/v1/flows/{flow_id}/publish";
$client_id = "XXX"; // Your API client ID (required)
$client_secret = "YYY"; // Your API client secret (required)
$data = [
//No parameters: an empty JSON object is fine
];
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-Client-Id: $client_id",
"X-Client-Secret: $client_secret",
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
?>
Example success response:
{
"id": "flw_5d41402abc4b2a76b9719d911017c592",
"uuid": "c0a8012e-4f5b-4d6c-8e9f-1a2b3c4d5e6f",
"name": "STOP = opt-out",
"status": "active",
"trigger_type": "inbound_message",
"trigger_config": {
"triggerType": "inbound_message",
"inboxId": 0
},
"published_version_number": 1,
"draft_version_number": null,
"has_draft_changes": false,
"published_at": "2026-09-08T10:20:00+02:00",
"updated_at": "2026-09-08T10:20:00+02:00",
"nodes": [ ... ],
"edges": [ ... ],
"viewport": null,
"meta": null,
"version_number": 1,
"version_status": "published"
}
Example error response:
{
"error": 165,
"errorMsg": "Flow cannot be published: nodes.2: node 'opt_out' is not reachable from the trigger",
"error_info": [
{
"path": "nodes.2",
"message": "node 'opt_out' is not reachable from the trigger"
}
]
}