Update an automation workflow
Replaces the definition of an existing automation workflow (a draft, an active or a paused one): its name, description, re-entry, triggers and steps. A description or reentry left out is removed. The status does not change: use PUT /automation/workflows/{workflowId}/status for that.
Start from GET /automation/workflows/{workflowId}?format=request: its request is this body, with the version to send. The integer id of an existing trigger or step keeps it, and contacts waiting on a kept step stay on it; a text label, such as reminder, adds a new one; a stored trigger or step the body leaves out is removed. A label written as a whole number, such as “3”, is not a label: it is the id 3, so it names the existing trigger or step 3 (refused with unknown_trigger_id or unknown_step_id when there is none). Give new triggers and steps labels that contain a letter. IDs are never reused, and a step whose type changes is replaced by a new step. A send_email step sent with the template_id it already uses keeps its copy of the template. A call_webhook step keeps its stored URL, auth and headers only when its url is sent back exactly as read (the origin); changing the URL of a webhook that has stored auth or headers without sending them again is refused with unsupported_setting.
To see what an edit would do without writing it, send the same body to POST /automation/workflows/validate?workflow_id={workflowId}.
Refusals, with nothing changed: 409 version_conflict (the workflow changed since it was read: read it again and redo the edit), 409 unsupported_workflow (it has conditions or other parts the API cannot express, listed in unsupported: edit it in the Brevo automation editor), 409 contacts_would_exit (contacts wait on steps the edit removes from an active or paused workflow: send confirm_contact_exit: true to accept), and 400 with every problem and its path (unknown_step_id: an integer ID that is not a step of this workflow).
Authentication
The API key should be passed in the request headers as api-key for authentication.
OAuth 2.0 client_credentials (machine-to-machine) grant. Exchange your app’s client_id/client_secret for a short-lived Bearer token.
Path parameters
Request
The whole new automation, the body GET /automation/workflows/{workflowId} returns with format request, edited, with its version. Unknown fields are refused.
The whole new list of triggers, 1 to 3 trigger objects, each type at most once. A trigger with the integer id that GET /automation/workflows/{workflowId} returned keeps that trigger; a trigger without id (or with a text label) is new; a stored trigger the body leaves out is removed. Ids are never reused. Each object has type plus the fields of that type, at the top level of the object; a field the type does not use is refused. Get the fields with GET /automation/catalog/{type}/schema. Types and their fields: added_to_lists and removed_from_lists (lists: [{"id", "name"}] from GET /contacts/lists; removed_from_lists starts when a contact is removed from one of the lists, not when it is moved from one list to another); order_created, cart_updated, page_visited (no field); manual_trigger (no field: it starts only for the contacts someone adds by hand in the Brevo app once the automation is active; this API cannot add them); custom_event (event_name, one of the event_names that GET /automation/catalog lists for custom_event); contact_match_one_segment (segment: {"id", "name"} from GET /contacts/segments, schedule: {"time": "9:00" (24-hour H:MM or HH:MM), "timezone": "Europe/Paris", "interval": "daily|weekly|monthly|yearly", "day_of_week": 1=Monday ... 7=Sunday (ISO), ...}; it runs on every scheduled date, but without reentry allowed a contact goes through it only once); anniversary (attribute: a date attribute from GET /contacts/attributes, when: same_day|before_the_date|after_the_date, offset: {"duration", "unit": day|week|month} for before or after, schedule: {"time", "timezone"}; it compares day and month only, so it matches every year, and a yearly send, such as a birthday email, needs reentry allowed).
The whole new chain of steps, 1 to 50 step objects: {"id": <id or label>, "type": "<step type>", "<step type>": {<fields>}, "next": <id or label of the next step> or null}. id: the integer id of an existing step, as GET /automation/workflows/{workflowId} returned it, keeps that step and the contacts waiting on it; a text label (letters, digits, _ or -, such as “reminder”) adds a new step; a stored step the body leaves out is removed, and contacts waiting on it leave the automation. Ids are never reused: a new step always gets a new id, and a step sent with another type than the stored one is replaced by a new step. A send_email step sent with the template_id it already uses (as GET /automation/workflows/{workflowId} returns it) keeps its copy of the template; another template_id is copied again. Changing only the tags, frequency_cap, send_window, cc or bcc of a send_email step keeps its copy and updates those settings; this is refused (unsupported_setting) when the step’s template is a saved template rather than the automation’s own copy, or when it would overwrite a stored setting that GET /automation/workflows/{workflowId} does not return. A send_sms step sent with the template_id it already uses (as GET /automation/workflows/{workflowId} returns it) also keeps its copy. Unique ids; a step follows at most one other step, so paths never join again; every path ends with a step whose next is null; the only paths are the variants of a percentage_split and the only loop is a go_to_step. At least one step must not be a time_delay, and the last step cannot be a time_delay. A delete_contact step must be the last step (next null). The fields of each type go in the object named after the type; get them with GET /automation/catalog/{type}/schema. Types and their object: send_email {"template_id", optional "tags", "frequency_cap", "send_window", "cc", "bcc", "event_data"} (an email template from GET /smtp/templates, or one made with POST /smtp/templates with the senderId of an active sender from GET /senders, which the automation sends from; it is copied for the automation; “tags”: a non-empty array of unique, non-empty strings; “frequency_cap”: true applies the account’s email frequency cap to this email; “cc” and “bcc”: {"contact_attribute"}, the exact name of a text attribute from GET /contacts/attributes that holds an email address, matched as for update_contact_attribute, fixed addresses are not supported; “send_window”: see below); time_delay {"duration": ISO 8601 such as P2D, PT2H30M, P1M, P2W}; add_to_list and remove_from_list {"lists": [{"id", "name"}]} from GET /contacts/lists; update_contact_attribute {"attribute", "action": set|clear, "type": text|boolean|category|date|number|multiple_choice, "value", "index", "date_mode": custom|dynamic, "operation": replace|add|subtract} from GET /contacts/attributes (send the exact name: an exact match wins, a unique case-insensitive match is rewritten to the account’s name, and names that differ only in case are refused with invalid_value listing them; an attribute that Brevo maintains itself, such as LAST_EMAIL_OPEN_DATE, is refused with not_available, while Brevo default attributes such as OPT_IN, DOUBLE_OPT-IN or JOB_TITLE, and user attributes whose name starts with "", are accepted, as in the editor; a category needs both “index”, the option’s value in the attribute’s enumeration, which is what is written to the contact, and “value”, that option’s label, shown in the editor; they must name the same option, otherwise the step is refused with invalid_value; a custom date is YYYY-MM-DD, other formats are refused; a number attribute (the float type of GET /contacts/attributes) needs “operation” with set, and “operation” is refused on any other type: replace writes “value”, a JSON number, and add or subtract change the contact’s current value by it (not negative); a multiple_choice “value” is a non-empty array of option labels from the attribute’s multiCategoryOptions; clear works for both and takes no value); call_webhook {"url", "include_contact_attributes", "include_event_data", "auth", "headers"} (include_event_data when not every trigger is an event is accepted with an event_data_unavailable warning; send auth or headers only when call_webhook in GET /automation/catalog has no unavailable_fields listing them: they are refused with not_available when webhook authentication is not enabled for the account); send_sms {"sender", "content" or "template_id", "sms_type": transactional|marketing, optional "unicode", "send_window", "event_data", "link_tracking" (true shortens and tracks the links of the SMS, as the editor's link shortener does), and for a text SMS "manage_us_compliance", "organisation_prefix", "unsubscribe_instructions"} (“template_id”: an SMS template from GET /transactionalSMS/templates, copied for the automation, instead of “content”; it is not allowed with content or the US compliance fields, and it is refused with not_available when send_sms in GET /automation/catalog lists it in unavailable_fields; warnings: unicode_needed, us_compliance_off and event_data_unavailable, see the send_sms object); delete_contact {} (deletes the contact and its data, which cannot be undone; it must be the last step); blocklist_contact {"scope": transactional|marketing|both, "senders": [sender email addresses]} (“senders” is required with transactional, optional with both and refused with marketing; take them from GET /senders, as they are not checked against the account). start_another_workflow {"workflow_id", optional "step_id"} (moves the contact into another automation of the account, from GET /automation/workflows, at its first step or at “step_id”, a step id of that automation as GET /automation/workflows/{workflowId} returns it; never this automation itself, use go_to_step for that; the target must be active when contacts reach the step, otherwise they skip it: an inactive target gives the warning destination_inactive, and an unknown one is refused with workflow_not_found or workflow_step_not_found); go_to_step {"step"} (jumps back to another step of this automation, by its id or label, not to itself or to another go_to_step; it ends its path, so its own next is null; the engine sends a contact through the same go_to_step at most 5 times; a loop with no time_delay in it gives the warning loop_without_delay); percentage_split {"variants": [{"percentage", "next"}]} (divides contacts at random between 2 or more paths: each variant has a percentage, above 0 with at most one decimal, all of them summing to 100, and “next”, the id of the first step of its path or null to end that path at the split; the split’s own next is null; 2 variants on any plan and up to 10 on Enterprise and Pro plans, more is refused with restricted_by_plan). “send_window” (send_email and send_sms) is {"timezone": IANA such as Europe/Paris, required, and exactly one of "days": [{"day": monday ... sunday, "from": "HH:MM", "to": "HH:MM"}] (each day at most once, two-digit 24-hour times from 00:00 to 23:59, from before to; outside them the message waits for the next allowed time) or "exact_date_time": RFC 3339 such as 2026-12-24T09:00:00+01:00, in the future and at most 2 years ahead}; without it the message is sent as soon as the contact reaches the step. “event_data” (send_email and send_sms, optional) is {"mode": "event_triggered_automation"} (the event that started the run) or {"mode": "latest_event_instance", "source", "event_name"} (the contact’s latest event of that kind, whatever started the run; source and event_name are required and must be an event the account has, as in GET /automation/catalog); it is what the {{ params.* }} variables of the message read. Without it, a step of a workflow whose triggers are all events uses the triggering event (reading the workflow back shows it as event_triggered_automation), and other workflows get no event data. event_triggered_automation with no event trigger is accepted with the warning event_data_unavailable (the variables stay empty).
Required. The version that GET /automation/workflows/{workflowId} returned for this automation (with format request it is also inside request). An automation changed since that read is refused with 409 version_conflict.
Optional internal description of the automation. The edit is a full replace, so leaving it out removes the stored description; GET /automation/workflows/{workflowId} with format request includes it in request when the automation has one, so keep it to keep it.
Optional. Whether a contact can enter the automation again: {"allowed": true, "delay": "P1D"}. Omitted = each contact runs this workflow at most once, ever. Set allowed:true (optionally delay) for recurring intents like every order/visit/week/year. delay is one ISO 8601 unit (P1M, P2W, P3D, PT5H, PT30M, at most 12 months), the minimum time before the same contact can enter again. Send delay only with allowed: true; it is refused otherwise. Without allowed: true, validate and create return a reentry_recommended warning for each order_created, cart_updated, page_visited, contact_match_one_segment or anniversary trigger.
Optional. True to accept that the contacts waiting on the steps this edit removes leave the automation (the count is in impact of a dry run). Without it, such an edit of an active or paused automation is refused with 409 contacts_would_exit.
Response
The new version, the one GET /automation/workflows/{workflowId} now returns; send it with the next edit
Problems that do not block, each with path, code, message and, for template warnings, template_id. The codes of validation with workflow_id, plus: template_already_copied (a step kept its copy of a template, so later edits of the source are not used); contacts_may_exit (steps of an active or paused workflow were removed, returned even when no contact was waiting on them); restricted_by_plan, not_available, event_not_found, list_not_found, segment_not_found, attribute_not_found, workflow_not_found and workflow_step_not_found on a trigger or step the edit kept unchanged (create would refuse them); and propagation_incomplete (the change is saved but may take up to an hour to reach running contacts; sending the same edit again repairs it).
What the edit did: workflow {"name_changed", "description_changed", "reentry_changed"}; triggers and steps each {"kept", "changed", "added" [{ref, id, type}], "replaced" [{old_id, old_type, id, type}], "removed", "moved"} (moved is a subset of kept: kept nodes now at another place in the chain); and templates {"copied" [{step_id, source_template_id, template_id}], "kept" [{step_id, template_id}]}
{"waiting_contacts", "steps": [{id, type, waiting_contacts}]}: the contacts that were waiting on removed steps of an active or paused automation
The workflow after the edit, as GET /automation/workflows/{workflowId} returns it