Update a workflow
/api/v1/workflows/{id}Changes the name, trigger, conditions or actions of a workflow, or disables it. Send only the fields you want to change; trigger, conditions and actions are each replaced as a whole. When any of them or the name changes, the whole workflow is validated again as on create.
enabled: falsedisables the workflow. Enabling a disabled workflow is refused with 422: enable it in the app.- Changes to an enabled workflow apply from the next event.
- The read-only fields of a workflow (
id,type,custom,priority,createdAt,updatedAt) may be sent back unchanged, so you can edit the body ofGET /api/v1/workflows/{id}and send it whole. A differentpriorityis refused: reorder workflows in the app. - To keep a webhook secret, send the
***redacted***value back as you received it, with the webhook action at the same position inactions. To change a secret, send the new value in full. - Only
type: workflowcan be updated. SLA policies are managed in the app. - A request that changes nothing answers 200 with the workflow as it is.
Send dry_run=true to validate the change without saving it. A dry run answers 200 with valid and the list of errors, and when valid, the workflow as it would be after the update.
Required ability: workflows:write.
Request
Authorization
Bearer Token
Provide your API token in the Authorization header. See Authentication to issue one.
Example:Authorization: Bearer ********************
idstring<uuid>requiredThe workflow id (UUID).
Example:6a7b8c9d-0e1f-4a2b-8c3d-4e5f6a7b8c9d
dry_runbooleanoptionalSet to
true(or1) to check the request without changing anything. The response tells you what would happen: the items that would be updated and skipped for a bulk request, or the validation result for a workflow. A dry run does not need anIdempotency-Key.dry_runcan also be sent as a top-level field of the JSON body; the query parameter wins when both are sent. Any value other thantrue,false,1or0is refused with 400. Endpoints that do not list this parameter refusedry_run=truewith 400.Default:false
Example:true
Idempotency-KeystringrequiredA unique value you choose for this write, for example a UUID, so that a retry cannot apply the change twice. 1 to 255 visible ASCII characters, no spaces. On endpoints that support
dry_run, the header is not needed for a dry run.- A key belongs to your API token and to one endpoint (method and path): the same value on another endpoint is a different key.
- Sending the same key with the same body again within 24 hours does not repeat the write. You get the first response back, with the header
Idempotent-Replayed: true. Error responses with a 4xx status are replayed too. - The same key with a different body is refused with 422.
- While the first request is still running, a second one with the same key gets 409.
- A response with a 5xx status is not kept: retry with the same key.
- A missing key, or one that is not 1 to 255 visible ASCII characters, is refused with 400.
- If the key cannot be checked, the request is refused with 503 and nothing is changed.
Example:8f14e45f-ceea-467f-a8d4-5b2c1e0f9a3d
namestringoptionaltriggerWorkflowTriggeroptionalChild attributes
eventsarray[string]requiredTrigger ids from
GET /api/v1/workflows/schema. The workflow runs when any of them happens. A trigger markedexclusivein the schema cannot be combined with others.Example:["when_chat_room_is_open"]
delaySecondsintegeroptionalSeconds to wait. Required with a trigger marked
supportsDelayin the schema, and not allowed otherwise.
conditionsarray[array[WorkflowCondition]]optionalChild attributes
keystringrequiredA condition id from
GET /api/v1/workflows/schema.Example:contact.name
operatorstring | nulloptionalOne of the operators the schema lists for this condition, for example
equalorcontains.valuesanyoptionalWhat to compare with. Its shape depends on the condition (
valueTypein the schema): usually a string, for some conditions an object.uiValuestring | nulloptionalDisplay text used by the app's workflow builder. Optional.
uiFilterOperatorstring | nulloptionalDisplay text used by the app's workflow builder. Optional.
typestring | nulloptionalDisplay hint used by the app's workflow builder. Optional.
badgesanyoptionalDisplay data used by the app's workflow builder. Optional.
actionsarray[WorkflowAction]optionalChild attributes
keystringrequiredAn action id from
GET /api/v1/workflows/schema.Example:auto.assign
valuesanyoptionalThe action's settings. Its shape depends on the action (
valueTypeandfieldsin the schema): a string or an object.uiValuestring | nulloptionalDisplay text used by the app's workflow builder. Optional.
stampbooleanoptionalShow the action in the inbox when it runs. Only for actions marked
supportsStampin the schema.
enabledbooleanoptionalfalsedisables the workflow.trueis accepted only when the workflow is already enabled.dry_runbooleanoptionalSame as the
dry_runquery parameter, which wins when both are sent.
Responses
200The updated workflow. With dry_run=true, the validation result instead (see the dryRun example); nothing was saved.
The updated workflow. With dry_run=true, the validation result instead (see the dryRun example); nothing was saved.
- Option 1Workflow
Child attributes
idstring<uuid> | nulloptionalnullonly in the preview of a create dry run.namestringoptionaltypestringoptionalAllowed values:"workflow", "sla", "ticket_sla"
priorityinteger | nulloptionalPosition in the evaluation order within its type; 1 is first.
enabledbooleanoptionalcustombooleanoptionaltruefor a workflow that agents run by hand (triggerwhen_manually_triggered).triggerWorkflowTriggeroptionalChild attributes
eventsarray[string]requiredTrigger ids from
GET /api/v1/workflows/schema. The workflow runs when any of them happens. A trigger markedexclusivein the schema cannot be combined with others.Example:["when_chat_room_is_open"]
delaySecondsintegeroptionalSeconds to wait. Required with a trigger marked
supportsDelayin the schema, and not allowed otherwise.
conditionsarray[array[WorkflowCondition]]optionalGroups of conditions. Every group must match (AND); within a group any one condition may match (OR). An empty list means always.
Child attributes
keystringrequiredA condition id from
GET /api/v1/workflows/schema.Example:contact.name
operatorstring | nulloptionalOne of the operators the schema lists for this condition, for example
equalorcontains.valuesanyoptionalWhat to compare with. Its shape depends on the condition (
valueTypein the schema): usually a string, for some conditions an object.uiValuestring | nulloptionalDisplay text used by the app's workflow builder. Optional.
uiFilterOperatorstring | nulloptionalDisplay text used by the app's workflow builder. Optional.
typestring | nulloptionalDisplay hint used by the app's workflow builder. Optional.
badgesanyoptionalDisplay data used by the app's workflow builder. Optional.
actionsarray[WorkflowAction]optionalThe actions, run in order.
Child attributes
keystringrequiredAn action id from
GET /api/v1/workflows/schema.Example:auto.assign
valuesanyoptionalThe action's settings. Its shape depends on the action (
valueTypeandfieldsin the schema): a string or an object.uiValuestring | nulloptionalDisplay text used by the app's workflow builder. Optional.
stampbooleanoptionalShow the action in the inbox when it runs. Only for actions marked
supportsStampin the schema.
createdAtstring<date-time> | nulloptionalupdatedAtstring<date-time> | nulloptional
- Option 2WorkflowDryRunResult
Child attributes
dryRunbooleanrequiredAllowed values:true
validbooleanrequirederrorsarray[WorkflowFieldError]requiredChild attributes
pathstringrequiredThe field the problem is in, for example
trigger.events[0]oractions[2].values.queueId.$means the whole body.messagestringrequired
workflowWorkflow | nullrequiredWhen valid, the workflow as it would be stored; otherwise
null.Possible formats
- Option 1Workflow
Child attributes
idstring<uuid> | nulloptionalnullonly in the preview of a create dry run.namestringoptionaltypestringoptionalAllowed values:"workflow", "sla", "ticket_sla"
priorityinteger | nulloptionalPosition in the evaluation order within its type; 1 is first.
enabledbooleanoptionalcustombooleanoptionaltruefor a workflow that agents run by hand (triggerwhen_manually_triggered).triggerWorkflowTriggeroptionalChild attributes
eventsarray[string]requiredTrigger ids from
GET /api/v1/workflows/schema. The workflow runs when any of them happens. A trigger markedexclusivein the schema cannot be combined with others.Example:["when_chat_room_is_open"]
delaySecondsintegeroptionalSeconds to wait. Required with a trigger marked
supportsDelayin the schema, and not allowed otherwise.
conditionsarray[array[WorkflowCondition]]optionalGroups of conditions. Every group must match (AND); within a group any one condition may match (OR). An empty list means always.
Child attributes
keystringrequiredA condition id from
GET /api/v1/workflows/schema.Example:contact.name
operatorstring | nulloptionalOne of the operators the schema lists for this condition, for example
equalorcontains.valuesanyoptionalWhat to compare with. Its shape depends on the condition (
valueTypein the schema): usually a string, for some conditions an object.uiValuestring | nulloptionalDisplay text used by the app's workflow builder. Optional.
uiFilterOperatorstring | nulloptionalDisplay text used by the app's workflow builder. Optional.
typestring | nulloptionalDisplay hint used by the app's workflow builder. Optional.
badgesanyoptionalDisplay data used by the app's workflow builder. Optional.
actionsarray[WorkflowAction]optionalThe actions, run in order.
Child attributes
keystringrequiredAn action id from
GET /api/v1/workflows/schema.Example:auto.assign
valuesanyoptionalThe action's settings. Its shape depends on the action (
valueTypeandfieldsin the schema): a string or an object.uiValuestring | nulloptionalDisplay text used by the app's workflow builder. Optional.
stampbooleanoptionalShow the action in the inbox when it runs. Only for actions marked
supportsStampin the schema.
createdAtstring<date-time> | nulloptionalupdatedAtstring<date-time> | nulloptional
- Option 2null
400The body is not valid JSON, dry_run is not valid, or the Idempotency-Key header is missing or malformed.
The body is not valid JSON, dry_run is not valid, or the Idempotency-Key header is missing or malformed.
messagestringrequirederrorstringoptionalstatusCodeintegerrequired
The API token is missing or invalid.
403The API token does not have the ability this endpoint requires. See "Token abilities" in the introduction.
The API token does not have the ability this endpoint requires. See "Token abilities" in the introduction.
messagestringrequirederrorstringoptionalstatusCodeintegerrequired
404No workflow with this id exists for the token's tenant, or id is not a UUID.
No workflow with this id exists for the token's tenant, or id is not a UUID.
messagestringrequirederrorstringoptionalstatusCodeintegerrequired
409The change would make the workflow a duplicate of another one (same trigger and conditions, and no new kind of action), or a request with the same Idempotency-Key is still running.
The change would make the workflow a duplicate of another one (same trigger and conditions, and no new kind of action), or a request with the same Idempotency-Key is still running.
messagestringrequirederrorstringoptionalstatusCodeintegerrequired
422The change is not valid; errors lists every problem with the path of the field. message is the problem itself when there is only one. Also returned, without errors, when the Idempotency-Key was already used with a different body.
The change is not valid; errors lists every problem with the path of the field. message is the problem itself when there is only one. Also returned, without errors, when the Idempotency-Key was already used with a different body.
messagestringrequirederrorstringoptionalstatusCodeintegerrequirederrorsarray[WorkflowFieldError]optionalChild attributes
pathstringrequiredThe field the problem is in, for example
trigger.events[0]oractions[2].values.queueId.$means the whole body.messagestringrequired
503The Idempotency-Key could not be checked, so the request was not processed. Nothing was changed; retry later.
The Idempotency-Key could not be checked, so the request was not processed. Nothing was changed; retry later.
messagestringrequirederrorstringoptionalstatusCodeintegerrequired