K8 HQ

Tag keywords — K8 HQ Content API

Tag keywords 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.

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 URLFor
https://api.k8hq.com/v1API 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

NameTypeDescription
org (query)stringThe 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)

FieldTypeDescription
jobId requiredstring
keywords requiredobject[]
progress requiredobject
status requiredscanning | done | failed
truncated requiredboolean
scannedAtstring

Responses

StatusBodyMeaning
200JSONThe result.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe request could not be completed.
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 could not be completed.
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).

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

NameTypeDescription
org (query)stringThe 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)

FieldTypeDescription
jobId requiredstring
keywords requiredobject[]
progress requiredobject
status requiredscanning | done | failed
truncated requiredboolean
scannedAtstring

Responses

StatusBodyMeaning
200JSONThe result.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe request could not be completed.
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 could not be completed.
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).

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

NameTypeDescription
tag (path) requiredstring
org (query)stringThe 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)stringUp to 255 characters; a retry with the same key gets the first response.

Request body (JSON)

FieldTypeDescription
keyword requiredstringThe keyword, or "" to stop showing the tag in mail apps.

Response body (JSON)

FieldTypeDescription
createdAt requiredstring
creator requiredstring
epoch requiredinteger
id requiredstringPattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$.
object requiredstringA frame of two seal v2 parts, meta and names; at most 4 KB sealed.
schemaVersion required1
updatedAt requiredstring
version requiredinteger
wdek requiredstringThe DEK wrapped to the container epoch using the tag seal ID.
creatorLabelstringThe creating token's label, when a token created this tag.
creatorMemberstringThe member whose token created this tag.
keywordstringThe 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

StatusBodyMeaning
200OrganizationTagThe tag.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe request could not be completed.
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 could not be completed.
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 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

NameTypeDescription
tag (path) requiredstring
org (query)stringThe 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)

FieldTypeDescription
progress requiredobject
status requiredrunning | done | failedrunning 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 requiredstringThe tag being deleted or merged. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$.
intostringFor 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

StatusBodyMeaning
200OrganizationTagKeywordConversionStatusThe result.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe request could not be completed.
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 could not be completed.
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).

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

NameTypeDescription
tag (path) requiredstring
org (query)stringThe 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)stringUp to 255 characters; a retry with the same key gets the first response.

Response body (JSON)

FieldTypeDescription
progress requiredobject
status requiredrunning | done | failedrunning 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 requiredstringThe tag being deleted or merged. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$.
intostringFor 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

StatusBodyMeaning
202OrganizationTagKeywordConversionStatusThe result.
400application/problem+jsonThe request is malformed (invalid).
401application/problem+jsonNo token, or it expired: sign in again (unauthenticated).
402application/problem+jsonThe request could not be completed.
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 could not be completed.
412application/problem+jsonIf-Match named an older version (version_mismatch).
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).