K8 HQ

Folders and recovery — K8 HQ Content API

Folders and recovery operations for K8 HQ Content API. Requests, permissions and responses.

Version 1OpenAPI description (JSON)

Browse operation groups

Before making requests, read the authentication and request requirements.

Manage folders, recover removed messages, and move a sender’s existing mail with Undo.

Base URL

Base URLFor
https://api.k8hq.com/v1API tokens and the K8 HQ web app

Endpoints

Folders and recovery

List labels

GET/inboxes/{inbox}/labels

The inbox's labels (folders in a mail app): INBOX first, then special-use labels (Sent, Drafts, Trash, Spam, Archive), then the rest by name. A message can carry several labels. Labels people create can be renamed and deleted; system labels can't.

For API tokens with messages:read and the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).

Response body (JSON)

FieldTypeDescription
labels requiredLabel[]

Responses

StatusBodyMeaning
200JSONThe labels.
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Create a label

POST/inboxes/{inbox}/labels

Creates an empty label (a folder in mail apps, which see it at once). File messages into it with Move or label a message. An inbox can have up to 100 labels besides the system ones. The name stays out of events: label.created carries only the ID. Creating a folder requires edit access to the inbox.

For API tokens with messages:write and the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Request body (JSON)

FieldTypeDescription
name requiredstringUnique in the inbox, ignoring case. / may separate levels, as mail apps show them (Work/2026); INBOX is reserved.
{"name":"Receipts"}

Response body (JSON)

FieldTypeDescription
id requiredstring
name requiredstring
total requiredinteger
unread requiredinteger
convertingbooleanThis folder is being turned into a tag.
specialUse\Sent | \Drafts | \Trash | \Junk | \ArchiveThe label's role, as IMAP names it.

Responses

StatusBodyMeaning
201LabelThe new label.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024): it has been out of credit for 60 days, so nothing can be changed until an owner adds credit.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonThe inbox already has a label with that name (conflict), or the same Idempotency-Key is still running (in_progress). If access changed while saving (conflict), reload and try again.
422application/problem+jsonThe inbox has the most labels allowed (rejected).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Rename a label

PATCH/inboxes/{inbox}/labels/{label}

Renames a label people created; its messages stay in it. System labels (INBOX, Sent, Drafts, Trash, Spam, Archive) can't be renamed. Renaming a folder requires edit access to the inbox.

For API tokens with messages:write and the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Request body (JSON)

FieldTypeDescription
name requiredstringUnique in the inbox, ignoring case. / may separate levels, as mail apps show them (Work/2026); INBOX is reserved.
{"name":"Receipts"}

Response body (JSON)

FieldTypeDescription
id requiredstring
name requiredstring
total requiredinteger
unread requiredinteger
convertingbooleanThis folder is being turned into a tag.
specialUse\Sent | \Drafts | \Trash | \Junk | \ArchiveThe label's role, as IMAP names it.

Responses

StatusBodyMeaning
200LabelThe renamed label.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024): it has been out of credit for 60 days, so nothing can be changed until an owner adds credit.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonAnother label has that name (conflict), or the same Idempotency-Key is still running (in_progress). If access changed while saving (conflict), reload and try again.
422application/problem+jsonA system label (rejected).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Delete a label

DELETE/inboxes/{inbox}/labels/{label}

Takes every message out of the label (each a message.unlabeled event), then deletes it (label.deleted). Messages stay in their other labels; a message in no other label moves to Archive (message.moved): messages never end up in no folder. The folder is hidden as soon as deletion starts. A label with many messages answers 202 and finishes in the background; deleting it again resumes a delete that was cut off. System labels can't be deleted. Deleting a folder requires edit access to the inbox. If access changes after deletion starts, the folder stays hidden and an editor can finish by deleting it again.

For API tokens with messages:write and the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Response body (JSON)

FieldTypeDescription
id requiredstring
status requireddeleting

Responses

StatusBodyMeaning
202JSONStill taking messages out of the label; it finishes in the background.
204Deleted.
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024): it has been out of credit for 60 days, so nothing can be changed until an owner adds credit.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonAccess changed while saving (conflict). Reload and try again. A request with the same Idempotency-Key may also still be running (in_progress).
422application/problem+jsonA system label (rejected).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Delete messages forever

POST/inboxes/{inbox}/labels/{label}/delete-forever

Deletes chosen messages in the inbox's Trash or Spam for good, at once. Messages not in the folder are skipped. The folder: the inbox's Trash or Spam (422 rejected for any other). People only: a person signed in to the web app, never an access token (403; programs delete for good with a mail app's EXPUNGE in Trash over IMAP) or an assistant (403). Edit access to the inbox or form is required. Needs a passkey used in the last 5 minutes (401 step_up_required); per-action confirmation (design note 0013, kind trash.empty) replaces that when it ships. A message is deleted for good only while this folder is its one label, checked again at the moment it's deleted: a message also in another folder (or filed in one meanwhile) only leaves this one and stays there. Each deletion is a message.deleted event (mode purged, with a reason) and is billed as messages.purged; storage goes down. Final: unlike emptying, a message deleted forever can't be recovered (/recoverable). Deleted mail leaves K8 HQ's backups within about 6 weeks. Works the same in zero-access inboxes (nothing is decrypted).

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Request body (JSON)

FieldTypeDescription
messages requiredstring[]The messages (msg_), up to 100.
{"messages":["msg_01J9Z3Q4W5E6R7T8Y9U0I1O2P3"]}

Response body (JSON)

FieldTypeDescription
kept requiredintegerAlso in another folder: they only left this one.
purged requiredintegerDeleted for good.
skipped requiredintegerNot in this folder (or changed meanwhile).

Responses

StatusBodyMeaning
200JSONWhat happened to them.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024): it has been out of credit for 60 days, so nothing can be changed until an owner adds credit.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonThe request stops if access changes (conflict). If some messages were already deleted or removed from the folder, applied gives their count. A request with the same Idempotency-Key may also still be running (in_progress).
422application/problem+jsonNot Trash or Spam (rejected).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Empty Trash or Spam

POST/inboxes/{inbox}/labels/{label}/empty

Deletes for good everything in the inbox's Trash or Spam when asked (not mail that arrives meanwhile), in the background: poll the job for progress. Asking again before anything new arrives returns the same job. The folder: the inbox's Trash or Spam (422 rejected for any other). People only: a person signed in to the web app, never an access token (403; programs delete for good with a mail app's EXPUNGE in Trash over IMAP) or an assistant (403). Edit access to the inbox or form is required. Needs a passkey used in the last 5 minutes (401 step_up_required); per-action confirmation (design note 0013, kind trash.empty) replaces that when it ships. A message is deleted for good only while this folder is its one label, checked again at the moment it's deleted: a message also in another folder (or filed in one meanwhile) only leaves this one and stays there. Each deletion is a message.deleted event (mode purged, with a reason) and is billed as messages.purged. For 35 days the people with access to the inbox can recover what was deleted (GET /inboxes/{inbox}/recoverable); its storage is billed until then, and then it leaves K8 HQ's backups within about 6 weeks. Works the same in zero-access inboxes (nothing is decrypted).

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Response body (JSON)

FieldTypeDescription
createdAt requiredstring
id requiredstringThe job (job_).
kept requiredintegerAlso in another folder: they only left this one.
purged requiredintegerDeleted for good so far.
skipped requiredintegerNot in the folder any more when their turn came (moved, restored or deleted meanwhile).
status requiredqueued | running | waiting | succeeded | failed | cancelledwaiting: a step failed and is retried shortly; failed: stopped for good (for example, the person lost access to the inbox).
total requiredintegerHow many messages the folder held when asked (for a progress bar).
finishedAtstring

Responses

StatusBodyMeaning
202EmptyFolderJobEmptying started (or already under way).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024): it has been out of credit for 60 days, so nothing can be changed until an owner adds credit.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonAccess changed while saving (conflict). Reload and try again. A request with the same Idempotency-Key may also still be running (in_progress).
422application/problem+jsonNot Trash or Spam (rejected).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Get an emptying's progress

GET/inboxes/{inbox}/labels/{label}/empty/{job}

How far emptying Trash or Spam has got. People only, as for emptying (403 for tokens and assistants).

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
job (path) requiredstringThe emptying job (job_).

Response body (JSON)

FieldTypeDescription
createdAt requiredstring
id requiredstringThe job (job_).
kept requiredintegerAlso in another folder: they only left this one.
purged requiredintegerDeleted for good so far.
skipped requiredintegerNot in the folder any more when their turn came (moved, restored or deleted meanwhile).
status requiredqueued | running | waiting | succeeded | failed | cancelledwaiting: a step failed and is retried shortly; failed: stopped for good (for example, the person lost access to the inbox).
total requiredintegerHow many messages the folder held when asked (for a progress bar).
finishedAtstring

Responses

StatusBodyMeaning
200EmptyFolderJobThe emptying.
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
422application/problem+jsonNot Trash or Spam (rejected).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Turn a folder into a tag

POST/inboxes/{inbox}/labels/{label}/tag

Adds an organization tag to every message in a folder, moves each back to Inbox, then deletes the empty folder. People who manage the inbox only, checked afresh at the start and at every step. Access tokens and assistants cannot start a conversion. Create or choose the tag first; the body names its ID. Starting is refused with 409 folder_rules while any rule files into the folder, including paused rules and app rules. The response lists only rules you can see, after checking that you manage the folder. Rules are never changed automatically. While the job runs, the folder shows as converting and cannot be renamed, deleted or receive new messages. Rule saves targeting it are refused. One conversion runs per folder. Repeating the request for the same tag returns the running job. Each move is billed to the organization as messages.writes; tagging has no separate charge. A message with 20 other tags stays in the folder and stops the job. Failure or cancellation keeps the folder and releases its lock. A crash resumes safely. Readable organizations only (409 tags_coming_soon).

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Request body (JSON)

FieldTypeDescription
tag requiredstringThe organization tag to use: live, in the inbox's organization. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$.

Response body (JSON)

FieldTypeDescription
job requiredstringThe conversion job (job_).
label requiredstringThe folder (lbl_).
messages requiredintegerMessages tagged and moved back to Inbox.
status requiredrunning | done | failed
tag requiredstringThe tag (tag_).
reasonaccess | tag_deleted | zero_access | folder_deleted | rules | tag_limit | not_empty | folder_changedWhy the conversion stopped.

Responses

StatusBodyMeaning
202FolderTagStatusThe change started (or was already under way).
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024).
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonRules file into the folder (folder_rules, with only the rules you can see), another conversion holds the folder, permissions changed, or tags are unavailable for a zero-access organization (tags_coming_soon).
422application/problem+jsonNot a folder people made (Inbox and the built-in folders can't be turned into tags).
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Follow a folder turning into a tag

GET/inboxes/{inbox}/labels/{label}/tag/{job}

Whether the folder's change into a tag is running, done or failed, with counts of this inbox's messages. People who manage the inbox only (an access token or an assistant gets 403). The job is the one POST /inboxes/{inbox}/labels/{label}/tag answered with; it can be followed after the folder is gone.

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
label (path) requiredstringLabel ID (lbl_…).
job (path) requiredstring

Response body (JSON)

FieldTypeDescription
job requiredstringThe conversion job (job_).
label requiredstringThe folder (lbl_).
messages requiredintegerMessages tagged and moved back to Inbox.
status requiredrunning | done | failed
tag requiredstringThe tag (tag_).
reasonaccess | tag_deleted | zero_access | folder_deleted | rules | tag_limit | not_empty | folder_changedWhy the conversion stopped.

Responses

StatusBodyMeaning
200FolderTagStatusThe change.
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonTags are coming soon for this organization (tags_coming_soon).
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

List recoverable deleted messages

GET/inboxes/{inbox}/recoverable

Messages deleted for good from the inbox's Trash or Spam in the last 35 days (Empty Trash or Empty Spam, the 30-day auto-delete, a mail app's expunge in Trash), newest message first, one page at a time: pass nextCursor back as cursor. Messages deleted with Delete forever aren't here: that's final. Mail deleted before 2026-10-16, when recovery began, isn't either. People only: a person signed in to the web app, never an access token (403) or an assistant (403). Anyone with access to the inbox may. Works the same in zero-access inboxes (nothing is decrypted).

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
limit (query)integerPage size, 1 to 100.
cursor (query)stringThe nextCursor of the previous page.

Response body (JSON)

FieldTypeDescription
days requiredintegerHow many days deleted messages stay recoverable (35).
messages requiredRecoverableMessage[]
nextCursorstring

Responses

StatusBodyMeaning
200JSONOne page of recoverable messages.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Recover deleted messages

POST/inboxes/{inbox}/recoverable/recover

Puts chosen recoverable messages back, each in the folder it was in before Trash (or the Inbox; Spam for a message deleted from Spam), with its flags and a new UID (mail apps see it arrive). Each is a message.restored event and is billed as messages.restored; mail recovered out of Spam is billed as received mail, once. A message that can't be recovered in this inbox (past its 35 days, or recovered already) is gone; other messages in the request can still be recovered. A message that is already back is present. People only: a person signed in to the web app, never an access token (403) or an assistant (403). You need permission to edit the inbox. Works the same in zero-access inboxes (nothing is decrypted).

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
Idempotency-Key (header)stringUp to 255 characters; a retry with the same key gets the first response.

Request body (JSON)

FieldTypeDescription
messages requiredstring[]The messages (msg_), up to 100.
{"messages":["msg_01J9Z3Q4W5E6R7T8Y9U0I1O2P3"]}

Response body (JSON)

FieldTypeDescription
gone requiredintegerNo longer recoverable.
present requiredintegerAlready back (put back another way).
recovered requiredintegerPut back.
results requiredobject[]

Responses

StatusBodyMeaning
200JSONWhat happened to each.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe organization is read-only (read_only, design note 0024): it has been out of credit for 60 days, so nothing can be changed until an owner adds credit.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonInbox access changed, the inbox is being removed, or the same request is in progress.
426application/problem+jsonK8 HQ has been updated. Reload this page.
429application/problem+jsonToo many requests (rate_limited). The token is paused until midnight UTC if it goes over its daily request or download limit, or reaches its daily recipient limit. A message with more recipients than the token has left today is refused. If the token has some recipients left, you can send to fewer. Too many attempts with a wrong token also return this response.
503application/problem+jsonTemporary failure; try again (unavailable).

Find a sender's latest move

GET/inboxes/{inbox}/sender-moves

For people signed in to K8 HQ with messages:write and full access to this inbox. Tokens, assistants, outbox-only access and personal notice access are refused. Keep existing mail by default; start this job only after the person chooses Archive or Trash. The server takes the verified From address from messageId and uses before as the confirmation time (or the request time when omitted). It counts before moving: over 10,000 matches fails with reason too_many_messages and moves nothing. Only received mail from that checked address in this inbox, before confirmation, moves; starred mail and mail already in the target stay. Progress is durable across restarts. Each message moves with its saved source folders and new version. Undo is a second, idempotent job available for committed moves for 24 hours after the job succeeds, fails or is cancelled; changed, deleted or relabelled messages are skipped. Missing source folders are also skipped. undoJobId replaces undoUntil once Undo is started. The latest lookup accepts any verified message from that sender in this inbox and returns the last job that committed a move. Empty or failed attempts that moved nothing do not replace it, so the reader can find Undo after reopening. starredKept counts matching starred mail separately from skipped changes. Jobs and saved folders are kept for seven days after completion. A message in more than 19 folders stops the job before moving any mail (too_many_folders); move it by hand instead. One messages.writes per moved message (including Undo), plus normal api.requests. No mail is deleted for good.

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
messageId (query) requiredstring

Response body (JSON)

FieldTypeDescription
before requiredstring
createdAt requiredstring
finishedAt requiredstring
id requiredstring
inboxId requiredstring
moved requiredinteger
skipped requiredinteger
starredKept requiredintegerMatching messages kept because they were starred when counted, separate from messages skipped after a change.
status requiredqueued | running | waiting | succeeded | failed | cancelled
target requiredarchive | trash
total requiredinteger
undoOf requiredstring
reasontoo_many_messages | stopped | too_many_folders
undoJobIdstring
undoUntilstringUndo deadline for committed moves in a succeeded, failed or cancelled job. Absent when no messages moved or Undo has started.

Responses

StatusBodyMeaning
200SenderMoveThe saved move and its progress.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
503application/problem+jsonTemporary failure; try again (unavailable).

Move a sender's existing mail

POST/inboxes/{inbox}/sender-moves

For people signed in to K8 HQ with messages:write and full access to this inbox. Tokens, assistants, outbox-only access and personal notice access are refused. Keep existing mail by default; start this job only after the person chooses Archive or Trash. The server takes the verified From address from messageId and uses before as the confirmation time (or the request time when omitted). It counts before moving: over 10,000 matches fails with reason too_many_messages and moves nothing. Only received mail from that checked address in this inbox, before confirmation, moves; starred mail and mail already in the target stay. Progress is durable across restarts. Each message moves with its saved source folders and new version. Undo is a second, idempotent job available for committed moves for 24 hours after the job succeeds, fails or is cancelled; changed, deleted or relabelled messages are skipped. Missing source folders are also skipped. undoJobId replaces undoUntil once Undo is started. The latest lookup accepts any verified message from that sender in this inbox and returns the last job that committed a move. Empty or failed attempts that moved nothing do not replace it, so the reader can find Undo after reopening. starredKept counts matching starred mail separately from skipped changes. Jobs and saved folders are kept for seven days after completion. A message in more than 19 folders stops the job before moving any mail (too_many_folders); move it by hand instead. One messages.writes per moved message (including Undo), plus normal api.requests. No mail is deleted for good.

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
Idempotency-Key (header) requiredstring

Request body (JSON)

FieldTypeDescription
messageId requiredstring
target requiredarchive | trash
beforestringThe time the person confirmed, in RFC 3339. Must not be in the future. Omit to use the request time. Keep this value when retrying.

Response body (JSON)

FieldTypeDescription
before requiredstring
createdAt requiredstring
finishedAt requiredstring
id requiredstring
inboxId requiredstring
moved requiredinteger
skipped requiredinteger
starredKept requiredintegerMatching messages kept because they were starred when counted, separate from messages skipped after a change.
status requiredqueued | running | waiting | succeeded | failed | cancelled
target requiredarchive | trash
total requiredinteger
undoOf requiredstring
reasontoo_many_messages | stopped | too_many_folders
undoJobIdstring
undoUntilstringUndo deadline for committed moves in a succeeded, failed or cancelled job. Absent when no messages moved or Undo has started.

Responses

StatusBodyMeaning
202SenderMoveThe saved move and its progress.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
503application/problem+jsonTemporary failure; try again (unavailable).

Check a sender move

GET/inboxes/{inbox}/sender-moves/{job}

For people signed in to K8 HQ with messages:write and full access to this inbox. Tokens, assistants, outbox-only access and personal notice access are refused. Keep existing mail by default; start this job only after the person chooses Archive or Trash. The server takes the verified From address from messageId and uses before as the confirmation time (or the request time when omitted). It counts before moving: over 10,000 matches fails with reason too_many_messages and moves nothing. Only received mail from that checked address in this inbox, before confirmation, moves; starred mail and mail already in the target stay. Progress is durable across restarts. Each message moves with its saved source folders and new version. Undo is a second, idempotent job available for committed moves for 24 hours after the job succeeds, fails or is cancelled; changed, deleted or relabelled messages are skipped. Missing source folders are also skipped. undoJobId replaces undoUntil once Undo is started. The latest lookup accepts any verified message from that sender in this inbox and returns the last job that committed a move. Empty or failed attempts that moved nothing do not replace it, so the reader can find Undo after reopening. starredKept counts matching starred mail separately from skipped changes. Jobs and saved folders are kept for seven days after completion. A message in more than 19 folders stops the job before moving any mail (too_many_folders); move it by hand instead. One messages.writes per moved message (including Undo), plus normal api.requests. No mail is deleted for good.

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
job (path) requiredstring

Response body (JSON)

FieldTypeDescription
before requiredstring
createdAt requiredstring
finishedAt requiredstring
id requiredstring
inboxId requiredstring
moved requiredinteger
skipped requiredinteger
starredKept requiredintegerMatching messages kept because they were starred when counted, separate from messages skipped after a change.
status requiredqueued | running | waiting | succeeded | failed | cancelled
target requiredarchive | trash
total requiredinteger
undoOf requiredstring
reasontoo_many_messages | stopped | too_many_folders
undoJobIdstring
undoUntilstringUndo deadline for committed moves in a succeeded, failed or cancelled job. Absent when no messages moved or Undo has started.

Responses

StatusBodyMeaning
200SenderMoveThe saved move and its progress.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
503application/problem+jsonTemporary failure; try again (unavailable).

Undo a sender move

POST/inboxes/{inbox}/sender-moves/{job}/undo

For people signed in to K8 HQ with messages:write and full access to this inbox. Tokens, assistants, outbox-only access and personal notice access are refused. Keep existing mail by default; start this job only after the person chooses Archive or Trash. The server takes the verified From address from messageId and uses before as the confirmation time (or the request time when omitted). It counts before moving: over 10,000 matches fails with reason too_many_messages and moves nothing. Only received mail from that checked address in this inbox, before confirmation, moves; starred mail and mail already in the target stay. Progress is durable across restarts. Each message moves with its saved source folders and new version. Undo is a second, idempotent job available for committed moves for 24 hours after the job succeeds, fails or is cancelled; changed, deleted or relabelled messages are skipped. Missing source folders are also skipped. undoJobId replaces undoUntil once Undo is started. The latest lookup accepts any verified message from that sender in this inbox and returns the last job that committed a move. Empty or failed attempts that moved nothing do not replace it, so the reader can find Undo after reopening. starredKept counts matching starred mail separately from skipped changes. Jobs and saved folders are kept for seven days after completion. A message in more than 19 folders stops the job before moving any mail (too_many_folders); move it by hand instead. One messages.writes per moved message (including Undo), plus normal api.requests. No mail is deleted for good.

For the web app.

Parameters

NameTypeDescription
inbox (path) requiredstringInbox ID (ibx_…).
job (path) requiredstring

Response body (JSON)

FieldTypeDescription
before requiredstring
createdAt requiredstring
finishedAt requiredstring
id requiredstring
inboxId requiredstring
moved requiredinteger
skipped requiredinteger
starredKept requiredintegerMatching messages kept because they were starred when counted, separate from messages skipped after a change.
status requiredqueued | running | waiting | succeeded | failed | cancelled
target requiredarchive | trash
total requiredinteger
undoOf requiredstring
reasontoo_many_messages | stopped | too_many_folders
undoJobIdstring
undoUntilstringUndo deadline for committed moves in a succeeded, failed or cancelled job. Absent when no messages moved or Undo has started.

Responses

StatusBodyMeaning
202SenderMoveThe saved move and its progress.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
403application/problem+jsonThe token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden).
404application/problem+jsonNot found, or not yours (not_found).
409application/problem+jsonCredit is needed, the request key was reused, or Undo is no longer available.
503application/problem+jsonTemporary failure; try again (unavailable).