Tags — K8 HQ Content API
Tags operations for K8 HQ Content API. Requests, permissions and responses.
Version 1OpenAPI description (JSON)
Before making requests, read the authentication and request requirements.
Your organization's tags: list, create, change and delete them, get the keys that open them, tag messages, and list what has a tag.
Tag names and colours are sealed in the browser, so K8 HQ stores them encrypted; messages carry tag IDs only. Every member can read tags. Creating a tag needs tags.create and changing or deleting one needs tags.manage. Who may create tags is an organization setting in setup.
Base URL
| Base URL | For |
https://api.k8hq.com/v1 | API tokens and the K8 HQ web app |
Endpoints
Tags
Create a sealed organization tag
POST/tags
People only; requires tags.create. Supply a client-minted tag_ ULID, sealed name and colour, and the current container epoch. An absent-only put prevents replacing an existing ID. A conditional counter enforces the 500-tag limit in the same transaction. The version starts at 1. The browser checks names of 1 to 40 characters, the eight board colours and name uniqueness. Seal ID: <tgs>|<tag>|v<n>. The object is a frame of two seal v2 parts: meta {tagSet: <tgs>, tag: <tag>, version: n}, then names {name, color}. Each part uses its part name (meta or names) and the seal ID as AAD; the DEK is HPKE-wrapped with that seal ID. At most 4 KB sealed before base64 encoding. No names or colours are sent in plaintext.
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. |
Idempotency-Key (header) | string | Up to 255 characters; a retry with the same key gets the first response. |
Request body (JSON)
| Field | Type | Description |
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. |
wdek required | string | The DEK wrapped to the container epoch using the tag seal ID. |
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 created 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. |
| 412 | application/problem+json | If-Match named an older version (version_mismatch). |
| 413 | 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). |
Get the tag-set epoch keys
GET/tags/keys
People only. The readable-board decrypt service seals epoch keys to your recorded user key. Returns the current epoch plus the epochs used by existing tag records. Membership, role and departure conditions guard every wrap response. Only the current epoch wrap is cached in EW with an identity index; historical wraps are returned without caching more rows so membership removal remains atomic. Any zero-access container returns tags_coming_soon.
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. |
x-k8hq-key-sha256 (header) | string | The SHA-256 (hex) of your X25519 public key, as your device computes it from the private key it unlocked. The first time keys are sealed to you, K8 HQ's mail servers pin the directory's key only if it matches (sent by a device that has unlocked the key); afterwards they seal only to the pinned key. A value that doesn't match is refused (key_changed). Older clients that omit the header are still accepted; the key is pinned when a device confirms it. |
Response body (JSON)
| Field | Type | Description |
epochs required | object[] | |
Responses
| Status | Body | Meaning |
| 200 | JSON | The keys. |
| 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). |
| 409 | application/problem+json | The request could not be completed. |
| 412 | application/problem+json | If-Match named an older version (version_mismatch). |
| 413 | 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). |
List organization tag names
GET/tags/names
Access tokens with tags:read: every live organization tag's ID, name and colour, sorted by name, opened by K8 HQ's servers, for autocomplete and name lookup (a board read names only the tags its items use). Readable organizations only: 409 tags_coming_soon in organizations with zero-access encryption. Each tag opened counts as boards.decrypted, and the read is in the audit log once per token and hour. Without the scope, 403 scope_missing; people's sessions read the sealed set from GET /tags.
For API tokens with tags:read.
Response body (JSON)
| Field | Type | Description |
tags required | object[] | |
Responses
| Status | Body | Meaning |
| 200 | JSON | Every live tag, opened. |
| 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). |
| 409 | application/problem+json | The organization's tags aren't available here (tags_coming_soon: zero-access encryption). |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |
Create an organization tag by name
POST/tags/names
API tokens need both tags:read and an explicit tags:create scope, given only by an owner or admin with a passkey when making the token. The token's member must still be an owner or admin and hold tags.create at every create. Guests cannot create tags. This scope is never included in a preset. Send a name and colour; K8 HQ seals them with the current tag-set key. Readable organizations only; zero-access organizations return 409 tags_coming_soon. A name that matches after trimming spaces and ignoring case reuses the existing tag with existing: true, even at a limit. Otherwise each token can create 50 tags, and the organization can have 500. Deleting a tag does not restore the token's allowance. An epoch or tag change retries once, then returns 409. Every name opened for the check counts as boards.decrypted. New tags record the token label and member in the audit log and notify owners and admins without the tag name. The response contains the sealed tag record, so an idempotent replay stores no plaintext name. Rename, recolour, merge and delete still need a person signed in to K8 HQ.
For API tokens with tags:read, tags:create.
Request body (JSON)
| Field | Type | Description |
color required | gray | red | orange | yellow | green | teal | blue | purple | |
name required | string | |
Response body (JSON)
| Field | Type | Description |
createdAt required | string | |
creator required | string | |
epoch required | integer | |
existing required | boolean | True when a tag already had this name. |
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. |
Responses
| Status | Body | Meaning |
| 200 | JSON | The created or existing sealed 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). |
| 409 | application/problem+json | A tag limit was reached, the tags changed twice, or tags are unavailable with zero-access encryption (tags_coming_soon). |
| 412 | application/problem+json | If-Match named an older version (version_mismatch). |
| 413 | 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). |
Update one sealed organization tag
PUT/tags/{tag}
People only; requires tags.manage. Replace one tag record under the current container epoch, using If-Match on that tag’s version. The tag ID in the path selects the record; a body ID, if supplied, must match it. Other tags are unchanged. Seal the next version using the create format. The creator and creation time stay unchanged. The server stores opaque bytes and emits one event containing only the tag ID.
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. |
If-Match (header) required | string | The current version of this tag (a number; quoted is fine). |
Request body (JSON)
| Field | Type | Description |
epoch required | integer | |
object required | string | A frame of two seal v2 parts, meta and names; at most 4 KB sealed. |
wdek required | string | The DEK wrapped to the container epoch using the tag seal ID. |
id | string | Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
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 updated 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. |
| 412 | application/problem+json | If-Match named an older version (version_mismatch). |
| 413 | 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). |
Delete one unused organization tag
DELETE/tags/{tag}
People only; requires tags.manage and If-Match on this tag’s version. Refuses a tag that is in use (409): POST /tags/{tag}/removal deletes one in use. Deletes the record and decrements the tag counter in the same transaction, emitting one event with only the tag ID.
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. |
If-Match (header) required | string | The current version of this tag (a number; quoted is fine). |
Responses
| Status | Body | Meaning |
| 204 | | The tag was deleted. |
| 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). |
| 413 | 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 tag's deletion or merge
GET/tags/{tag}/removal
Whether the tag's removal is running, done or failed. No counts: they would count things in inboxes and on boards the person may not open. People only; requires tags.manage. 404 when the tag was never deleted in use or merged.
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 |
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 | OrganizationTagRemovalStatus | The removal. |
| 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 | 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). |
Delete a tag in use, or merge it into another
POST/tags/{tag}/removal
Takes the tag off every message and board item in the organization that has it, in the background, then deletes it. With into, everything that had it gets that tag instead (once: something that has both keeps one), so nothing's tag count grows and nothing goes over 20 tags; rules that add the tag (the "Add tag" action) are switched to into, each recorded as rule.updated by the person who asked; a deleted tag's rules keep its ID and skip it. Trash, Spam and recoverable deleted messages are included. The tag leaves the tag list at once (it's listed under removing) and can't be added to anything from then on. Each message changes as a tag change (message.tags_changed) and each board item as an item change with a history row, by the person who asked; when it's done, tags.tag.deleted or tags.tag.merged is recorded with IDs and counts only. The body names tags by ID only: anything else in it is refused (400), so no tag name is ever sent. People only (an access token or an assistant gets 403); requires tags.manage (organization owners and admins), checked afresh, and If-Match on this tag's version. Asking again while it runs returns the same removal; asking for a different one answers 409. One removal or merge runs in an organization at a time: starting another while one runs answers 409 ("Another tag is being deleted or merged. Try again when it finishes."), and while one that failed or was cancelled waits for K8 HQ support to restart it, also 409 ("A tag deletion or merge didn't finish, so no other can start. Contact K8 HQ support: they restart it, and it finishes."). K8 HQ staff restart a failed or cancelled removal with k8hqctl job retry; it frees the slot when it finishes. The changes are K8 HQ's cost. 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. |
If-Match (header) required | string | The current version of this tag (a number; quoted is fine). |
Request body (JSON)
| Field | Type | Description |
into | string | Merge into this tag (live, in the same organization, not the tag itself). Leave it out to delete the tag. Pattern: ^tag_[0-9A-HJKMNP-TV-Z]{26}$. |
Response body (JSON)
| Field | Type | Description |
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 | OrganizationTagRemovalStatus | The removal started (or was already running). |
| 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). |
| 413 | 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). |
List what has an organization tag
GET/tags/{tag}/results
Every message and board item in the organization with this tag that the caller can open now, newest first by the message's received time or the item's creation time, at most 50 a page. The tag is named by its ID; its name stays sealed and the browser shows it. Each result's inbox or board is checked afresh (not cached): a whole-container grant in this organization (for a person, also their own notice inbox), the container open and readable. Messages in Trash or Spam and items in Trash are left out, and so is anything in an inbox or board the caller can't open, without saying so: there are no counts. Paging doesn't depend on what was left out: a full page always carries a cursor (the next page may be empty), and a page that reached the end has none. A page reads at most 5,000 index entries, shown or not; only when a page's span holds that many, so that at least 4,951 of them aren't shown (in inboxes or boards the caller can't open, in Trash or Spam, or gone), does a page with fewer than 50 results carry a cursor. So a page's response time, and past 5,000 uses in its span a page that is empty (or short) yet carries a cursor, can hint that the tag is used in inboxes or boards the caller can't open. A rare server error partway through a page can also end it early with a cursor. Nothing ever reveals their names, content, how many there are or which ones. Keep reading until there's none. Readable organizations only: 409 tags_coming_soon otherwise. Each page counts as tags.queries.
People signed in to K8 HQ, and access tokens with tags:read (403 scope_missing without it); a token's results also need messages:read for messages (inboxes only) and boards:read for board items (readable task boards only), within its containers, and its board items carry their plain fields only (read the item for its title). An assistant's delegated session is refused (403).
For API tokens with tags:read and 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. |
cursor (query) | string | The previous page's cursor. It's bound to the caller, organization and tag, and can expire (410 sync_reset: read the first page again). |
Response body (JSON)
| Field | Type | Description |
results required | any[] | |
cursor | string | Where the next page starts; absent at the end. |
Responses
| Status | Body | Meaning |
| 200 | JSON | One page of results. |
| 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 a live tag of this organization (or not an organization the caller is in). |
| 409 | application/problem+json | The organization's tags aren't available here (tags_coming_soon: zero-access encryption). |
| 410 | application/problem+json | The cursor is no longer valid (sync_reset): read the first page again. |
| 503 | application/problem+json | Temporary failure; try again (unavailable). |