Tag keywords — K8 HQ Content API
Tag keywords operations for K8 HQ Content API. Requests, permissions and responses.
Version 1OpenAPI description (JSON)
Before making requests, read the authentication and request requirements.
Show tags in mail apps that support IMAP keywords, such as Thunderbird.
Give a tag a keyword, list the plain keywords already on messages, and convert a plain keyword into a tag. Owners and admins only (tags.manage).
Base URL
| Base URL | For |
https://api.k8hq.com/v1 | API tokens and the K8 HQ web app |
Endpoints
Tag keywords
List plain keywords on messages
GET/tags/keywords
Owners and admins signed in to K8 HQ only (tags.manage). Returns the saved scan result, or scanning with jobId and progress. First use starts one background scan. GET doesn't rescan a saved result unless it has expired (after seven days) or an inbox it scanned is no longer readable (closed, made personal or switching to zero-access); then it starts a fresh scan and returns scanning without the old keywords. The job reads message pages in readable, unmarked inboxes, skipping zero-access, closed, personal and notice inboxes. Counts each message once per keyword, ignoring case, and leaves out keywords starting with $. Plain leftovers of mapped keywords include tagId. Returns at most 100 keywords, sorted ignoring case, with truncated when more were found and scannedAt when finished. Concurrent mail changes can affect counts. K8 HQ pays for scans.
For the web app.
Parameters
| Name | Type | Description |
org (query) | string | The organization (org_). Required for a person signed in to the web app (any organization they're a member of); a token always answers for its own organization. |
Response body (JSON)
| Field | Type | Description |
jobId required | string | |
keywords required | object[] | |
progress required | object | |
status required | scanning | done | failed | |
truncated required | boolean | |
scannedAt | string | |
Responses
| Status | Body | Meaning |
| 200 | JSON | The result. |
| 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 request could not be completed. |
| 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 request could not be completed. |
| 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). |
Refresh mail-app keyword counts
POST/tags/keywords
Starts a paged keyword scan only when none is in flight and the last job finished more than ten minutes ago, or at once when the saved result has expired or an inbox it scanned is no longer readable. Otherwise returns the current scan or saved result. The access, privacy and cost rules of GET /tags/keywords apply.
For the web app.
Parameters
| Name | Type | Description |
org (query) | string | The organization (org_). Required for a person signed in to the web app (any organization they're a member of); a token always answers for its own organization. |
Response body (JSON)
| Field | Type | Description |
jobId required | string | |
keywords required | object[] | |
progress required | object | |
status required | scanning | done | failed | |
truncated required | boolean | |
scannedAt | string | |
Responses
| Status | Body | Meaning |
| 200 | JSON | The result. |
| 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 request could not be completed. |
| 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 request could not be completed. |
| 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). |
Show a tag in mail apps, change its keyword, or stop showing it
PUT/tags/{tag}/keyword
"Show in mail apps" (off for every tag until someone turns it on). With a keyword, mail apps that support IMAP keywords (such as Thunderbird) show the tag on its messages, and a mail app setting or clearing that keyword (ignoring case) adds or removes the tag. The keyword is stored in plain text, so K8 HQ's servers can see it; the tag's name stays sealed. It is an IMAP atom of 1 to 128 printable ASCII characters without spaces or ( ) { % * " \ ], not one that mail apps set on their own ($Forwarded, $MDNSent, $Junk, $NotJunk, Junk, NonJunk, NotJunk, JunkRecorded, $Phishing, $SubmitPending, $Submitted, $MailFlagBit0, $MailFlagBit1, $MailFlagBit2); another tag's keyword, ignoring case, is refused (409). Renaming the tag keeps its keyword. "" stops showing the tag in mail apps. Messages keep their tags either way: mail apps see the change the next time they read flags (within about a minute); mail apps already open aren't told. A mail app saving a message (APPEND) with the keyword saves it with the tag. Deleting or merging the tag frees its keyword. People only; requires tags.manage (organization owners and admins). Records tags.tag.changed with the tag ID and fields (mailApps when turned on or off, keyword when changed), never the keyword. Readable organizations only (409 tags_coming_soon).
For the web app.
Parameters
| Name | Type | Description |
tag (path) required | string | |
org (query) | string | The organization (org_). Required for a person signed in to the web app (any organization they're a member of); a token always answers for its own organization. |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Request body (JSON)
| Field | Type | Description |
keyword required | string | The keyword, or "" to stop showing the tag in mail apps. |
Response body (JSON)
| Field | Type | Description |
createdAt required | string | |
creator required | string | |
epoch required | integer | |
id required | string | Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
object required | string | A frame of two seal v2 parts, meta and names; at most 4 KB sealed. |
schemaVersion required | 1 | |
updatedAt required | string | |
version required | integer | |
wdek required | string | The DEK wrapped to the container epoch using the tag seal ID. |
creatorLabel | string | The creating token's label, when a token created this tag. |
creatorMember | string | The member whose token created this tag. |
keyword | string | The tag's keyword in mail apps (IMAP), while "Show in mail apps" is on: stored in plain text so mail apps can show and set the tag. Absent while it's off. |
Responses
| Status | Body | Meaning |
| 200 | OrganizationTag | The tag. |
| 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 request could not be completed. |
| 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 request could not be completed. |
| 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). |
Follow a keyword conversion
GET/tags/{tag}/keyword/convert
Owners and admins signed in to K8 HQ only (tags.manage). Returns the tag ID and status of its latest keyword conversion, without starting another. Returns 404 if none was started. Returns progress with converted messages and skipped messages that already have twenty tags; keyword text is not returned.
For the web app.
Parameters
| Name | Type | Description |
tag (path) required | string | |
org (query) | string | The organization (org_). Required for a person signed in to the web app (any organization they're a member of); a token always answers for its own organization. |
Response body (JSON)
| Field | Type | Description |
progress required | object | |
status required | running | done | failed | running until the tag is off everything and deleted (done). failed: it stopped and K8 HQ's staff are alerted; the tag stays hidden and unusable until they finish it. |
tag required | string | The tag being deleted or merged. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
into | string | For a merge, the tag asked to merge into. If that tag is itself deleted or merged meanwhile, the merge follows it: to the tag it went into, or, once it's deleted, the merged tag is just deleted. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
Responses
| Status | Body | Meaning |
| 200 | OrganizationTagKeywordConversionStatus | The result. |
| 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 request could not be completed. |
| 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 request could not be completed. |
| 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). |
Convert a plain keyword into a tag
POST/tags/{tag}/keyword/convert
Owners and admins signed in to K8 HQ only (tags.manage). The tag must have its mail-app keyword set. A background job converts matching plain keywords into this tag, ignoring case, in readable, unmarked inboxes. Each message changes once, with its tag index in the same write; a message already carrying the tag keeps one copy. Other keywords stay as they are. Zero-access, personal notice and closed inboxes are excluded. The job stops if the tag keyword changes. A running conversion is returned on repeat requests; a finished or stopped conversion can run again for restored messages. The result gives the tag ID and status; GET this path to follow it. K8 HQ pays for changed messages. The event tags.keyword.converted contains the tag ID and partial count, with status stopped if the keyword changed, the tag was deleted or progress stopped. Messages already at twenty tags are skipped and reported in progress. Mail apps keep seeing the same keyword.
For the web app.
Parameters
| Name | Type | Description |
tag (path) required | string | |
org (query) | string | The organization (org_). Required for a person signed in to the web app (any organization they're a member of); a token always answers for its own organization. |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Response body (JSON)
| Field | Type | Description |
progress required | object | |
status required | running | done | failed | running until the tag is off everything and deleted (done). failed: it stopped and K8 HQ's staff are alerted; the tag stays hidden and unusable until they finish it. |
tag required | string | The tag being deleted or merged. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
into | string | For a merge, the tag asked to merge into. If that tag is itself deleted or merged meanwhile, the merge follows it: to the tag it went into, or, once it's deleted, the merged tag is just deleted. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
Responses
| Status | Body | Meaning |
| 202 | OrganizationTagKeywordConversionStatus | The result. |
| 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 request could not be completed. |
| 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 request could not be completed. |
| 412 | application/problem+json | If-Match named an older version (version_mismatch). |
| 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). |