Save an edited draft
draft_editor_saveSave the fields a person edited in the draft editor. Every field is optional and an omitted one keeps its stored value. No signature is applied, unlike the draft tool's 'update' when it is given a body: the text being saved is the text the person was shown, which already carries one if the inbox has one. Nothing is sent. On IMAP the save returns a NEW draft_id and the old one stops resolving. On IMAP and Gmail the save rebuilds the message from its text, so a draft with attachments, inline images other than its own signature images, or other extra parts is refused and left unchanged. A save against an older id of the draft, or against a revision other than base_revision, is refused as draft_changed and nothing is written.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | Replacement recipient list. Omit to keep the stored one; pass [] to clear it. | |
| to | No | Replacement recipient list. Omit to keep the stored one; pass [] to clear it. | |
| bcc | No | Replacement recipient list. Omit to keep the stored one; pass [] to clear it. | |
| inbox | No | The inbox's email address, as an alternative to inbox_id. | |
| subject | No | Replacement subject line. Omit to keep the stored one. | |
| draft_id | Yes | The draft to act on. On IMAP a draft_id changes on every save, so use the one the most recent draft result returned. | |
| inbox_id | No | The inbox holding the draft. Omit when the workspace has one inbox. | |
| body_text | No | Replacement plain-text body, written exactly as given. When the draft has an HTML part, the edit is made inside it when it can be placed exactly; otherwise a formatted HTML part is dropped (body.formatting_removed) and a plain one is regenerated, so both parts of the message say the same thing. Omit to keep the stored body. | |
| base_revision | No | The draft.revision of the copy being edited (0 when it had none). When the draft has been rewritten since, the save is refused as draft_changed. | |
| add_attachments | No | Files to add, base64. The stored files are kept. 10 MB in all per save. | |
| remove_attachments | No | Stored files to remove, by position in draft.attachments, each naming the file it means. Every other file is kept byte for byte. Refused as draft_changed when the file at that position is another one, and on Outlook, where a save cannot remove one. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| card | No | Which card this envelope renders: 'draft_editor' or 'receipt'. | |
| state | No | Where the draft stands: editing, sent, cancelled (discarded, or the card was hidden or shown), or error. | |
| dashboard_url | No | Absolute link to the signed-in dashboard. Always present, and the one link that still works when the rest of the envelope cannot be parsed. | |
| schema_version | No | Card envelope version. A client that does not know this version should fall back to dashboard_url. |