Skip to content

Throw the draft away and go back to the live version

POST /automation/{id}/draft/discard

Needs edit access. The draft becomes a copy of the published version at a new revision. 409 `nothing_to_discard_to` if it was never published. An optional `draft_revision` is compare-and-set: a stale one is a 409 `draft_conflict`. A different version going live (a publish or rollback) while the discard runs is also a 409 `draft_conflict`, so the draft is never marked as matching a version that is no longer live.

Path Parameters

idstring
required·

Resource id

Request Body

draft_revisioninteger

Response Body

access_summary
access_viastring
agent_edit_blocked_bystring,null

Why the Agent cannot edit it, for a caller who otherwise could. Null when available, or when the caller cannot edit at all.

Possible values:
assistant_disabledllm_not_configurednot_permittednull
attentionobject,null
can_agent_editboolean

The in-app Agent can edit this workflow for the caller.

can_discard_draftboolean

The caller may throw the draft away and go back to the live version.

can_manageboolean
can_publishboolean
can_revoke_shareboolean
can_runboolean
can_see_sharesboolean
can_shareboolean
can_transferboolean
can_useboolean
created_atstring
descriptionstring
draftobject
definition
definition_validboolean
revisioninteger
updated_atstring
updated_bystring,null
updated_by_namestring,null
updated_clientstring,null

The MCP client that made the last edit, when updated_via is mcp.

updated_viastring,null

Where the last draft edit came from.

Possible values:
consoleagentmcpapinull
draft_changesobject
countinteger
ever_publishedboolean

False until a first publish; there is nothing to compare against before then.

itemsobject[]
5 properties
areastring
changestring
Possible values:
addedchangedremoved
keystring,null
labelstring
wordsstring
moreinteger

Changes beyond the listed items.

removed_stepsarray

Steps the draft no longer has, with where they were.

step_marks

Per step key: added or changed, for the diagram.

draft_revisioninteger
draft_step_countinteger
draft_tierstring,null
draft_updated_atstring
draft_updated_bystring,null
enabledboolean
engineobject
active_runsinteger
in_syncboolean
next_run_atstring,null
queued_runsinteger
engine_config_revinteger
engine_synced_revinteger
glanceobject

Absent when the caller is below use access (run history is what the runs tab shows) or while it is not known yet.

appsobject[]

Connected apps the live version uses (the draft, if never published), most-used first.

3 properties
connector_idstring
icon_urlstring,null
namestring
apps_moreinteger

Apps beyond apps.

run_historyobject[]

Runs per UTC day by the day each was queued, oldest first, ending today. Dry runs excluded.

4 properties
daystring · date
failedinteger
otherinteger

Canceled, skipped or still going.

succeededinteger
idstring
labelsobject
steps
toolboxes
namestring
owner_avatar_urlstring,null

The person's picture: their stored profile picture, else a Gravatar URL (d=404, 96px) derived from their email (the address itself is not sent), else null. Draw initials when it is null or the image fails to load.

owner_display_namestring,null
owner_user_idstring
paused_reasonstring,null
publish_requiresobject
blocked_reasonstring,null
permissionstring,null
published_atstring,null
published_revisioninteger,null
published_tierstring,null
published_version
published_version_idstring,null
published_version_numberinteger,null
run_summary
run_summary_updated_atstring,null
statsobject

The same 14 days as glance.run_history. Absent below use access, or when the run history is not known.

next_run_atstring,null
oldest_waiting_atstring,null
runs_14dinteger
success_rate_14dnumber,null

Succeeded / (succeeded + failed) over the same 14 days; null when none finished.

waiting_countinteger

Pending approvals: runs parked on a person.

statusstring
Possible values:
draftactivedisabledpaused
trigger_summaryobject
cron_countinteger
manual_countinteger
updated_atstring
curl -X POST 'https://api.elaichi.ai/automation/<id>/draft/discard' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"draft_revision":0}'
const body = {
  "draft_revision": 0
};

const response = await fetch('https://api.elaichi.ai/automation/<id>/draft/discard', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import os
import requests

url = "https://api.elaichi.ai/automation/<id>/draft/discard"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "draft_revision": 0
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())