DELETE /api/v1/sequences/{sequenceId}/versions/{versionId}
Discards a draft — the way out of the one-draft rule.
| Condition | Answer |
|---|---|
| a draft, and not the only version | 200 |
| not a draft | 400 — published and archived versions are kept forever |
| the sequence's only version | 400 — it carries the trigger; delete the sequence instead |
Authorization
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused — 403 |
Path parameters
| Parameter | Type | Description |
|---|---|---|
sequenceId | string | Required. The sequence |
versionId | string | Required. The draft to discard — a published version is refused |
Example
bash
curl -X DELETE -H "x-api-key: $AGENTMAIL_API_KEY" \
"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 amemberof the organization, not anadmin.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
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the operation was successful |
data.id | string | Identifier of what was removed |
Example response
json
{
"success": true,
"data": {
"id": "4d19c0a2"
}
}