Update Automation Step
PATCH /automations/:id/steps/:stepId — edit a step in place (type/config) on a disabled automation.
/automations/:id/steps/:stepIdUpdates a step's type and/or config in place. The step's graph key stays stable, so any connections pointing at it keep working — unlike delete-and-re-add, which drops the key and its edges. The automation must be disabled (stop or disable it first). Returns the updated step.
The body is the same shape as Add Step: type (required) plus the type-specific config. See the Steps page for each type's config shape.
idstringrequiredThe automation id.
stepIdstringrequiredThe id of the step to update.
typestringrequiredThe step type (e.g. send_email, delay, condition).
configobjectoptionalThe type-specific configuration that replaces the step's current config.
import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.automations.updateStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', '9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d', {
"type": "delay",
"config": { "duration": "2 days" }
});
console.log({ data, error });Response
{
"id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"key": "welcome",
"type": "delay",
"position": 0,
"config": { "duration": "2 days" }
}As with Add Step, the response is the stored step row: delay, add_to_segment, contact_update and contact_delete are stored exactly as documented, while send_email comes back as type: "send" with config.template_id, and wait_for_event comes back as type: "wait" with config: { event, timeout_hours, poll_minutes, timeout?, filter_rule? } (the natural-language timeout is echoed back only when you sent it that way). A condition config is normalized on write: the documented single { type: "rule", field, operator, value } is stored as { rules: [{ field, operator, value }], match: "all", skip_steps }, and an and / or group is flattened to the same shape with match: "all" / match: "any" — so the response shows rules and match, not the type envelope you sent.
Returns not_found (404) if the automation or step does not exist, and validation_error (422) if the automation is enabled (disable it first) or the step body is invalid. See Errors.