API Reference

Update Automation Step

PATCH /automations/:id/steps/:stepId — edit a step in place (type/config) on a disabled automation.

PATCH/automations/:id/steps/:stepId

Updates 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.

Path parameters
idstringrequired

The automation id.

stepIdstringrequired

The id of the step to update.

Body parameters
typestringrequired

The step type (e.g. send_email, delay, condition).

configobjectoptional

The type-specific configuration that replaces the step's current config.

Request
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" }
}

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.