Sending — K8 HQ Content API
Sending operations for K8 HQ Content API. Requests, permissions and responses.
Version 1OpenAPI description (JSON)
Before making requests, read the authentication and request requirements.
Send mail from an inbox, save or discard drafts, and list senders to unsubscribe from.
Base URL
| Base URL | For |
https://api.k8hq.com/v1 | API tokens and the K8 HQ web app |
Endpoints
Sending
Save a draft
PUT/inboxes/{inbox}/drafts/{draft}
Saves a version of a draft into the inbox's Drafts folder, flagged draft and seen, the way a mail app saves one (IMAP APPEND): mail apps see it arrive, and it's billed like theirs (messages.saved, and storage while it's kept). Saving the same draft ID again stores the new version and removes the previous one (mail apps see it expunged). To edit a draft a mail app made, give its message ID as replaces: the save takes its place (only a draft version: a message moved into Drafts can't be). A draft another member saved can be replaced or adopted only with messages:write. Not for K8's assistant sessions. Sending with the draft's ID (POST /inboxes/{inbox}/messages) removes the draft once sent. Saving requires edit access to the inbox. Access tokens also need messages:send. If a token names a member, it must match your current membership. Drafts can be up to 25 MB. A person or token may save 20 drafts in an inbox at once, then one every 2 seconds. Zero-access inboxes are refused (zero_access): K8 HQ can't read them, so it can't keep a draft there that mail apps could show.
For API tokens with messages:send and the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
draft (path) required | string | The draft's ID (draft_ and 16 to 64 letters, digits, - or _), chosen by the client and kept for every save of the draft. |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Request body (JSON)
| Field | Type | Description |
channel required | email | |
email required | object | Exactly one of raw or sealed. |
from | string | The address the draft is written from, if chosen (a bare address). |
replaces | string | A message in Drafts (msg_…) this draft takes the place of, e.g. one a mail app made; removed with this save. Ignored once it's gone. |
{"channel":"email","email":{"raw":"RnJvbTogaGVsbG9AZXhhbXBsZS5jb20NClN1YmplY3Q6IGRyYWZ0DQoNCnN0aWxsIHdyaXRpbmcNCg=="},"from":"hello@example.com"}
Response body (JSON)
| Field | Type | Description |
draftId required | string | |
messageId required | string | The message in Drafts holding this version (msg_…); each save makes a new one. |
Responses
| Status | Body | Meaning |
| 200 | SavedDraft | Saved. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 402 | application/problem+json | The 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. |
| 403 | application/problem+json | The token lacks messages:send, a web session saved raw, the inbox is zero-access (zero_access), or the draft (the current version, or replaces) is another member's and the caller lacks messages:write. |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 409 | application/problem+json | The same Idempotency-Key is still running (in_progress), or the draft was saved somewhere else at the same moment (conflict): save again. |
| 413 | application/problem+json | Over 25 MB. |
| 422 | application/problem+json | replaces names a message that isn't a draft in Drafts (one moved there, not saved there by a mail app or K8 HQ). |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too many saves (rate_limited). Retry-After says when to save again. A token paused by a daily limit also gets this response. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Discard a draft
DELETE/inboxes/{inbox}/drafts/{draft}
Removes a draft's current version from Drafts for good (mail apps see it expunged). With replaces, a mail app's draft this one was adopting is removed too, even if it was never saved here. Discarding requires edit access to the inbox. Access tokens also need messages:send. If a token names a member, it must match your current membership. Discarding another member's draft also requires messages:write.
For API tokens with messages:send and the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
draft (path) required | string | The draft's ID (draft_ and 16 to 64 letters, digits, - or _), chosen by the client and kept for every save of the draft. |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
replaces (query) | string | A message in Drafts (msg_…) the draft was adopting. |
Responses
| Status | Body | Meaning |
| 204 | | Discarded. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 402 | application/problem+json | The 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. |
| 403 | application/problem+json | The token lacks messages:send, or the draft is another member's and the caller lacks messages:write. |
| 404 | application/problem+json | No such draft (never saved, or already discarded or sent), or the inbox isn't one you may use. |
| 409 | application/problem+json | The same Idempotency-Key is still running (in_progress), or the draft was saved somewhere else at the same moment (conflict). |
| 422 | application/problem+json | replaces names a message that isn't a draft in Drafts (one moved there, not saved there by a mail app or K8 HQ). |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Send a message
POST/inboxes/{inbox}/messages
Sending requires edit access to the inbox. K8 HQ applies the same sending checks and limits as sending from a mail app and files a copy in Sent. If an access token names a member, it must match your current membership. For email, give the RFC 5322 message either as raw (API tokens) or sealed to the inbox's epoch key and bound to a draft ID (the web app; the server opens it to send). Up to 100 recipients and 25 MB. When you send a saved draft using its draft ID (draftId), K8 HQ removes the draft after sending. If it cannot remove the draft, the send still succeeds and the response includes a warning. Prefer: dry-run checks the sender, the From header and who is handling the conversation and stops: nothing is sent, counted or filed. With hold, K8 HQ checks the sender, From header, who is handling the conversation, pages-domain recipients and available credit without reserving credit, scanning or counting a send. It stores the sealed submission and summary, keeps the draft until the message is sent and returns 202 with outboxId and sendAt. At most 100 scheduled messages per person per inbox. Undo has no separate hold charge. Scheduled holds count once as messages.outbox ($0.00003), and again after the first 20 time changes, at change 21 and each 20 after it; storage is counted while held. Tokens cannot request holds (400). Zero-access holds are refused (403 zero_access). Repeating an Idempotency-Key replays the response. If you claim while replying, you still need access to the shared inbox and permission to reply to get the saved response. A dry run with hold runs these preflight checks and stores no hold. To claim a conversation while replying, use an access token that belongs to a member who can reply in the shared inbox. Use ticket claims in an inbox that uses tickets. If the reply fails, K8 HQ releases the claim it took for that reply. A new claim counts as one change. A dry run takes no claim.
For API tokens with messages:send and the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Prefer (header) | dry-run | dry-run to check without sending. |
Request body (JSON)
| Field | Type | Description |
channel required | email | |
from required | string | An endpoint address the inbox may send as (GET /inboxes/{inbox}/endpoints); for email it must match the message's From header. |
to required | string[] | Every recipient (for email: To, Cc and Bcc), as bare addresses. |
answers | string | The message this reply answers (msg_). Held sends mark it answered only after sending. |
claim | string | The claim ID for this reply. Use an access token and include claimSecret. You can't use a claim with a scheduled send. Use new to claim an existing conversation as you send the reply. Pattern: ^(clm_[0-9A-HJKMNP-TV-Z]{26}|new)$. |
claimSecret | string | The secret for this claim. Give 32 to 128 random bytes encoded as base64url without padding. Use an access token. |
draftId | string | A draft (PUT /inboxes/{inbox}/drafts/{draft}) to remove once the message is sent. A sealed message's own draftId counts as this; give it here for raw. Pattern: ^draft_[A-Za-z0-9_-]{16,64}$. |
email | object | Exactly one of raw or sealed. |
hold | any | People only, with a sealed submission. Undo waits 5 to 30 seconds; a scheduled send waits between one minute and 366 days. No holds in zero-access inboxes yet. Ticket replies support Undo only. |
replaces | string | A mail app's draft in Drafts (msg_…) this message was written from, removed once it's sent if it's still there (with draftId). |
ticket | object | A reply from a ticket board (design note 0021 section 5.3; people only). Before sending, in one conditional write, the ticket's last message must still be after and nobody else may be sending a reply to it, or the answer is 409 ticket_changed; force (Send anyway) overrides both. Completing a parent with unfinished subitems also requires version, acknowledgeIncomplete and the reviewed completionVersion; force never bypasses this consent. The reply goes through ordinary sending checks. Its Sent copy joins the ticket and applies the selected status only while the checked child/config versions remain current; otherwise mail is preserved and status stays unchanged. |
{"channel":"email","email":{"raw":"RnJvbTogaGVsbG9AZXhhbXBsZS5jb20NClRvOiBzYW1AZXhhbXBsZS5vcmcNClN1YmplY3Q6IGhpDQoNCmhlbGxvDQo="},"from":"hello@example.com","to":["sam@example.org"]}
Response body (JSON)
| Field | Type | Description |
sent required | boolean | False for a dry run. |
claim | string | The claim ID when a reply was sent with claim: "new". Pattern: ^clm_[0-9A-HJKMNP-TV-Z]{26}$. |
dryRun | boolean | |
messageId | string | The stored Sent copy's K8 HQ message ID, including when a copy was already stored. Absent for a dry run or if the message was sent but its Sent copy could not be stored. Older replayed responses may omit it. Pattern: ^msg_[0-9A-HJKMNP-TV-Z]{26}$. |
warning | string | Shown if K8 HQ sent the message and could not remove the draft. |
Responses
| Status | Body | Meaning |
| 200 | Sent | Accepted for delivery (or checked, for a dry run). Includes the stored Sent copy's messageId when available; repeating the Idempotency-Key returns the same response and messageId. A reply sent with claim: "new" also returns the claim ID. |
| 202 | JSON | Held until sendAt. |
| 400 | application/problem+json | Check the request. Use an access token for claim fields. You can't include a claim with hold. The value new needs a reply in an existing conversation. |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 402 | application/problem+json | The 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. |
| 403 | application/problem+json | The inbox can't send as from, the token lacks messages:send, or a web session sent raw, or the draft it names is another member's and the caller lacks messages:write. To use claim: "new", the access token must belong to a member who can reply in the inbox. |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 409 | application/problem+json | A request with the same Idempotency-Key is still running (in_progress), or a reply's ticket changed (ticket_changed: reason is message, replied or sending, and item the ticket as it is now). K8 HQ also refuses a reply when someone else is handling the conversation (claim_held) or the claim changes before the reply is sent (claim_lost). If K8 HQ asks an access token to claim before replying, it returns claim_required. A request to claim while replying returns claimed when another session holds the claim, or claim_on_ticket when the inbox uses tickets. |
| 412 | application/problem+json | If-Match named an older version (version_mismatch); item, when present, is the item as it is now. |
| 422 | application/problem+json | Refused: a sending limit or policy, with the reason. |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Get delivery status for a sent message
GET/inboxes/{inbox}/messages/{msg}/delivery
Recipient results for mail sent through K8 HQ. Available to anyone who can open the message, including members of zero-access inboxes. No plaintext addresses or remote server text are returned. salt is 16 bytes in unpadded base64url; h is the first 16 characters of base64url(SHA-256(salt bytes followed by the lowercase address in UTF-8)). Match To and Cc locally; unmatched hashes represent Bcc or other envelope recipients. Sending can be shown for one hour after sentAt. Delivered means the receiving mail server accepted the message; it does not indicate whether anyone opened it. Results are kept until the message is purged. A 404 with code not_found means no delivery record is available or the message is inaccessible. A mail.delivery.* event is a signal to fetch this endpoint again.
For API tokens with messages:read and the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
msg (path) required | string | Message ID (msg_…). |
If-None-Match (header) | string | The ETag of a copy you have. |
Response body (JSON)
| Field | Type | Description |
recipients required | object[] | |
salt required | string | Pattern: ^[A-Za-z0-9_-]{22}$. |
sentAt required | string | |
rejected | string | |
Responses
| Status | Body | Meaning |
| 200 | MessageDelivery | Delivery status. |
| 304 | | Not modified: your copy is current. |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 409 | application/problem+json | A form's response that came past its daily limit (held): release it to open it. |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
List scheduled mail
GET/inboxes/{inbox}/outbox
People who can read the inbox can see its scheduled mail and Undo holds. Sealed summaries let the browser show the list without fetching whole messages. Mail apps do not see these items. At the send time K8 HQ checks the author still has access and can send, then checks sending policy again. A failed or uncertain send produces a private member notice; it is not copied to outside addresses. A restarted dispatcher sends overdue held messages, but never repeats an uncertain send.
For the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
cursor (query) | string | The previous page's nextCursor. |
Response body (JSON)
| Field | Type | Description |
items required | OutboxItem[] | |
nextCursor required | string | |
Responses
| Status | Body | Meaning |
| 200 | JSON | A page of held and failed messages. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Read a scheduled message
GET/inboxes/{inbox}/outbox/{outbox}
Returns the sealed submission, envelope (including Bcc) and summary for a signed-in person with inbox read access. ETag is the version for PATCH. The browser opens the message with its inbox key.
For the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
outbox (path) required | string | The held message ID (obx_). |
Response body (JSON)
| Field | Type | Description |
envelope required | object | |
item required | OutboxItem | |
sealed required | OutboxSealed | |
summary required | OutboxSealed | |
Responses
| Status | Body | Meaning |
| 200 | JSON | The stored submission. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Change a send time
PATCH/inboxes/{inbox}/outbox/{outbox}
Changing a held message requires edit access to the inbox. To change a message you did not write, you also need messages:write. Give its version in If-Match. sendAt now asks for sending as soon as possible. Other times need zone and must be between one minute and 366 days from now. An Undo hold can only be sent now or cancelled. The first 20 time changes are included. Change 21 and each 20 after it count one more messages.outbox for scheduled holds.
For the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
outbox (path) required | string | The held message ID (obx_). |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
If-Match (header) required | string | The message version from ETag, quoted or unquoted. |
Request body (JSON)
| Field | Type | Description |
sendAt required | string | An RFC 3339 time, or now. |
zone | string | An IANA time zone; required for a future time. |
Response body (JSON)
| Field | Type | Description |
author required | string | |
createdAt required | string | |
draftId required | string | |
id required | string | |
kind required | undo | scheduled | |
msgId required | string | |
schemaVersion required | integer | |
sendAt required | string | |
size required | integer | |
status required | held | sending | failed | unknown | held waits for its send time; sending has been claimed and cannot be cancelled; failed was not sent; unknown could have been sent and is never sent again automatically. Later sending reports can resolve unknown as sent. Failed and unknown items stay for 30 days and count toward storage until removed. |
summary required | OutboxSealed | |
version required | integer | |
zone required | string | |
answers | string | |
failure | object | |
ticket | object | The ticket reference, last message and version of the send claim. |
Responses
| Status | Body | Meaning |
| 200 | OutboxItem | The updated message. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 402 | application/problem+json | The 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. |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 409 | application/problem+json | The message is being sent (in_progress and outboxStatus sending), or it changed during cancellation (conflict). Reload before trying again. |
| 412 | application/problem+json | If-Match named an older version (version_mismatch). |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Cancel a scheduled message
DELETE/inboxes/{inbox}/outbox/{outbox}
You can cancel your own hold or remove your own failed or unconfirmed send while you can still view the inbox. To do this for another member, you need edit access and messages:write. A dispatch claim wins with 409 in_progress; already sent or removed is 404. Cancel removes the due row, releases the ticket claim and subtracts storage. To edit, the browser reads the sealed message, cancels first, then saves it as a draft using the same draftId. This route does not create a draft.
For the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
outbox (path) required | string | The held message ID (obx_). |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Responses
| Status | Body | Meaning |
| 204 | | Cancelled or removed. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 402 | application/problem+json | The 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. |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 409 | application/problem+json | The message is being sent (in_progress and outboxStatus sending), or it changed during cancellation (conflict). Reload before trying again. |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
List newsletter senders
GET/inboxes/{inbox}/subscriptions
Groups received newsletters and mailing lists by From address, ignoring case. Includes messages from the last 12 months tagged bulk or list, or with a checked one-click, email or page unsubscribe method. Spam, Trash, drafts and outgoing mail are excluded, including messages also in another folder. Counts and the newest message cover those matching messages. The newest field contains only id, unsubscribe when known and senderVerified when known. Subject, recipients, labels and other message details are not included; fetch the message when needed. No link or proof is returned. The latest unsubscribe record and an active block rule for this inbox are joined when present. Unsubscribed means accepted, sent, page-opened or email-sent; failed, refused and pending records remain subscribed. Still sending can be shown when lastAt is more than two days after a completed record. A pending record over one minute old is shown as failed with reason timeout. Read access to this inbox is required. Tokens need messages:read and must allow this inbox and its organization. The listing changes nothing and remains available when the organization is read-only. Each page costs one api.requests plus api.data_out.kb. Counts use the first page time for up to 15 minutes; concurrent mail, moves or record changes can change later pages. Pages hold up to 100 senders. Sort volume uses count30 descending, recent uses lastAt descending, and name ignores case and falls back to the address. Ties use address ascending. No mail is opened.
For API tokens with messages:read and the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
sort (query) | volume | recent | name | |
filter (query) | all | subscribed | unsubscribed | |
cursor (query) | string | |
Response body (JSON)
| Field | Type | Description |
senders required | Subscription[] | |
nextCursor | string | Opaque next page cursor, omitted on the last page. Reuse with the same inbox, sort and filter within 15 minutes. |
Responses
| Status | Body | Meaning |
| 200 | SubscriptionPage | Senders in this inbox. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 426 | application/problem+json | K8 HQ has been updated. Reload this page. |
| 429 | application/problem+json | Too 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. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Read a sender's unsubscribe result
GET/inboxes/{inbox}/unsubscribes
People signed in to K8 HQ only, with current send access to this inbox. Tokens and assistants cannot use this route. The sender address is matched without letter case. A pending record older than 60 seconds is returned as failed and can be retried.
For the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
sender (query) required | string | The sender address from the received message. |
Response body (JSON)
| Field | Type | Description |
record required | any | |
Responses
| Status | Body | Meaning |
| 200 | UnsubscribeResponse | The saved result; record is null on GET when nobody has asked yet. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 503 | application/problem+json | Temporarily unavailable. An invoke error includes the failed record and Retry-After: 60; retry with a new Idempotency-Key. |
Ask a sender to stop mail to this inbox
POST/inboxes/{inbox}/unsubscribes
People signed in to K8 HQ only, with current send access. One-click needs a received, verified message whose signed headers allowed this method and whose receipt-time proof matches one of candidates (or the older url) exactly. Spam, Trash and flagged spam cannot be used. K8 HQ never decrypts the message to find the link. The usage charge is reserved before egress and billed only on a TCP connection ($0.000018 per connected attempt). A timeout or 5xx permits one automatic retry after two seconds, subject to the caps and credit check. Pending claims prevent concurrent effects. Failed/refused requests can be retried with a new Idempotency-Key; other results replay for 24 hours. GET reads the latest result. For email, pass the header's mailto candidates and from: K8 HQ sends the request from that address through the normal email checks and stores it in Sent (the older sentMessageId form is deprecated). An email the sending gate refuses for credit answers 402 out_of_credit. A page record only says the person opened a page; K8 HQ sends no request.
For the web app.
Parameters
| Name | Type | Description |
inbox (path) required | string | Inbox ID (ibx_…). |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Request body (JSON)
| Field | Type | Description |
messageId required | string | |
method required | one-click | email | page | |
candidates | string[] | For one-click or email: raw URIs from the List-Unsubscribe header, in any order. Send https URIs for one-click and mailto URIs for email. K8 HQ checks each against the proof saved when this message arrived and uses the match. Do not normalize the URIs. Unmatched or unusable entries are ignored; no match returns 422 proof_mismatch. An empty array has no match. Links are never stored. Takes precedence over url. Email candidates need a raw URI proof from receipt; older messages may only support the older sentMessageId form. |
consent | zero-access-url | Required for one-click in a zero-access inbox, after the person agrees to share the link with K8 HQ for this request. |
from | string | Required for email with candidates: one of this inbox's sender addresses. K8 HQ sends to the matched mailto address through the normal email checks. Only its subject and body fields are used; other mailto fields cannot add recipients. |
sentMessageId | string | Older email form, accepted for one release when candidates is absent: the Sent message in this inbox. Cannot be used with candidates. |
url | string | Older one-click form, accepted for one release when candidates is absent. Send candidates instead. The exact link is used once and never stored. |
Response body (JSON)
| Field | Type | Description |
record required | any | |
Responses
| Status | Body | Meaning |
| 200 | UnsubscribeResponse | The saved result; record is null on GET when nobody has asked yet. |
| 400 | application/problem+json | The request is malformed (invalid). |
| 401 | application/problem+json | No token, or it expired: sign in again (unauthenticated). |
| 402 | application/problem+json | out_of_credit or read_only. No request was sent. |
| 403 | application/problem+json | The token lacks the scope (scope_missing), the container is zero-access (zero_access), or the caller may not use this operation (forbidden). |
| 404 | application/problem+json | Not found, or not yours (not_found). |
| 409 | application/problem+json | not_eligible, already_unsubscribed (with record), or in_progress (an Idempotency-Key is running). |
| 413 | application/problem+json | Request too large. |
| 422 | application/problem+json | bad_url or proof_mismatch. No request was sent. |
| 429 | application/problem+json | sender_cap, organization_cap or destination_cap. Retry-After is in seconds for organization and destination caps. |
| 503 | application/problem+json | Temporarily unavailable. An invoke error includes the failed record and Retry-After: 60; retry with a new Idempotency-Key. |