Change a draft's trigger

PATCH /api/v1/sequences/{sequenceId}/versions/{versionId} Changes the trigger of a draft — the list or the tag that enrols contacts. Send both fields: the trigger is replaced, never merged.
ConditionAnswer
a draft, both fields valid200 — the version comes back with its new trigger
missing field, unknown triggerType, malformed id400details names the field
trigger target of another organization404 — like a tag that does not exist
the version is not a draft400 — published versions are snapshots; open a draft
Nothing enrols on the new trigger until you publish the draft. Contacts already walking the published version keep entering on the old one, and finish the journey they entered.

Authorization

Role in the organizationThis endpoint
OWNERAllowed
ADMINAllowed
MEMBERRefused — 403
A key carries the role its creator holds in this organization — never a role on AgentsMail itself. See API keys.

Request body

FieldTypeRequiredDescription
triggerTypestringyeslist_joined or tag_added
triggerTargetIdstringyesThe list id for list_joined, the tag id for tag_added

Example

bash
curl -X PATCH -H "x-api-key: $AGENTMAIL_API_KEY" -H "content-type: application/json" \
  -d '{"triggerType":"tag_added","triggerTargetId":"'$TAG_ID'"}' \
  "https://www.agentsmail.io/api/v1/sequences/$SEQUENCE_ID/versions/$VERSION_ID"

Response

  • 200 OK — the call succeeded.
  • 401 Unauthorized — missing or invalid key, or its owner left the organization.
  • 403 Forbidden — the key's owner is a member of the organization, not an admin.
  • 404 Not Found — no such resource, or it belongs to another organization. The API never confirms that an id exists to a caller who has no right to it.
  • 429 Too Many Requests — over 120 requests in a minute for this key.

Response fields

FieldTypeDescription
successbooleanIndicates if the operation was successful
data.idstringUnique identifier for the version
data.sequenceIdstringThe sequence it belongs to
data.versionnumberIts rank, starting at 1
data.statusstringdraft or published
data.publishedAtstringnull
data.triggerTypestringlist_joined or tag_added
data.triggerTargetIdstringThe list or tag that enrols contacts
data.createdAtstringISO creation date
data.updatedAtstringISO date of the last change

Example response

json
{
  "success": true,
  "data": {
    "id": "4d19c0a2",
    "sequenceId": "9b3f2d10",
    "version": 1,
    "status": "subscribed",
    "publishedAt": "2026-08-23T10:22:05.000Z",
    "triggerType": "list_joined",
    "triggerTargetId": "0b7c51e8",
    "createdAt": "2026-08-23T10:22:05.000Z",
    "updatedAt": "2026-08-23T10:22:05.000Z"
  }
}