K8 HQ Setup API
Create organizations, domains and containers. Selected operations also accept personal agent credentials when enabled.
Operation groups
Organizations
Create, list, rename and delete organizations, and choose which services each one offers.
12 operations
Organization billing
Who pays for an organization, the fallback payer, and caps on what agents may spend each month.
7 operations
Domains
Add a domain, prove it's yours with DNS records (or one-click DNS setup), and manage its fee and addresses.
13 operations
Inboxes
Create and remove inboxes, and move addresses between them.
7 operations
Boards
Create task and ticket boards, give and remove access, and remove boards.
6 operations
Forms
Create form pages whose responses arrive like mail.
4 operations
Contacts
Organization-owned contact books and membership.
7 operations
Calendar
Set up your K8 HQ calendar the first time you open it.
1 operation
Health
Check a domain's mail health, and the moving checklist and monitors that go with it.
7 operations
Personal agent actions (conditional)
Selected actions for personal apps, available only when the service is enabled. Each attempt checks current access.
10 operations
Find an operation by name
- List my organizations —
GET /v1/organizations - Create an organization —
POST /v1/organizations - Delete an organization —
DELETE /v1/organizations/{orgId} - Set organization icon —
PUT /v1/organizations/{orgId}/icon - Remove organization icon —
DELETE /v1/organizations/{orgId}/icon - Organization services catalog and availability —
GET /v1/organizations/{orgId}/services - Change organization service availability —
PATCH /v1/organizations/{orgId}/services - An organization's settings —
GET /v1/organizations/{orgId}/settings - Change organization settings —
PATCH /v1/organizations/{orgId}/settings - Cancel a deletion —
POST /v1/orgs/delete/cancel - Choose who may create organization tags —
POST /v1/tags/settings - Read an explicit monthly agent spending cap —
GET /v1/organizations/{orgId}/billing/agent-budget - Configure an explicit monthly agent spending cap —
PUT /v1/organizations/{orgId}/billing/agent-budget - Read an explicit monthly agent spending cap —
GET /v1/organizations/{orgId}/billing/agent-budget/credentials/{credentialId} - Configure an explicit monthly agent spending cap —
PUT /v1/organizations/{orgId}/billing/agent-budget/credentials/{credentialId} - Change the fallback —
PUT /v1/organizations/{orgId}/billing/fallback - Offer billing to another owner —
POST /v1/orgs/payer/offer - Take over billing —
POST /v1/orgs/payer/take - Check a domain —
POST /v1/domains/check - One-click DNS setup: a signed link for one step —
POST /v1/domains/connect - One-click DNS setup: check after coming back —
POST /v1/domains/connect/return - A proof notice's release link: release the claim —
POST /v1/domains/release - A proof notice's release link: which domain —
POST /v1/domains/release/info - List domains —
GET /v1/organizations/{orgId}/domains - Add a domain —
POST /v1/organizations/{orgId}/domains - Change how a domain's fee is paid —
PATCH /v1/organizations/{orgId}/domains/{domain} - Remove a domain —
DELETE /v1/organizations/{orgId}/domains/{domain} - List a domain's addresses —
GET /v1/organizations/{orgId}/domains/{domain}/addresses - One-click DNS setup: what the domain's DNS host offers —
GET /v1/organizations/{orgId}/domains/{domain}/connect-info - Get a domain's MAIL FROM —
GET /v1/organizations/{orgId}/domains/{domain}/mail-from - Choose a domain's MAIL FROM —
PUT /v1/organizations/{orgId}/domains/{domain}/mail-from - Keep an inbox —
POST /v1/inboxes/delete/cancel - Move an address to a new inbox —
POST /v1/inboxes/promote - Read an inbox's encryption status —
POST /v1/inboxes/zero-access/status - List the organization's inboxes —
GET /v1/organizations/{orgId}/inboxes - Create an inbox —
POST /v1/organizations/{orgId}/inboxes - List inbox removals —
GET /v1/organizations/{orgId}/inboxes/removals - Remove an inbox —
DELETE /v1/organizations/{orgId}/inboxes/{inboxId} - Keep a board —
POST /v1/boards/delete/cancel - Create a task or ticket board —
POST /v1/organizations/{orgId}/boards - List board removals —
GET /v1/organizations/{orgId}/boards/removals - Remove a board —
DELETE /v1/organizations/{orgId}/boards/{boardId} - Give someone access to a board —
PUT /v1/organizations/{orgId}/boards/{boardId}/members/{memberId} - Remove someone's access to a board —
DELETE /v1/organizations/{orgId}/boards/{boardId}/members/{memberId} - Keep a form —
POST /v1/forms/delete/cancel - Create a form —
POST /v1/organizations/{orgId}/forms - List form removals —
GET /v1/organizations/{orgId}/forms/removals - Remove a form —
DELETE /v1/organizations/{orgId}/forms/{formId} - Cancel book removal before purge begins —
POST /v1/books/delete/cancel - Create an organization-owned contact book —
POST /v1/organizations/{orgId}/books - Read a contact book and current capabilities —
GET /v1/organizations/{orgId}/books/{bookId} - Rename a book with optimistic concurrency —
PATCH /v1/organizations/{orgId}/books/{bookId} - Schedule book removal with seven-day cancelable grace —
DELETE /v1/organizations/{orgId}/books/{bookId} - Give a member book access —
POST /v1/organizations/{orgId}/books/{bookId}/members - Revoke book access while protecting owners and the last holder —
DELETE /v1/organizations/{orgId}/books/{bookId}/members/{memberId} - Set up your calendar —
POST /v1/organizations/{orgId}/calendar - Confirm a sender sends the organization's mail —
POST /v1/health/senders/confirm - Undo a sender's confirmation —
POST /v1/health/senders/unconfirm - Check a domain's health —
POST /v1/organizations/{orgId}/domains/{domain}/health-checks - Dismiss a Needs-attention finding —
POST /v1/organizations/{orgId}/health/dismissals - The Health monitors —
GET /v1/organizations/{orgId}/health/monitors - The moving checklist —
GET /v1/organizations/{orgId}/mail-move - Change the moving checklist —
PATCH /v1/organizations/{orgId}/mail-move - Set only this personal app family’s explicit monthly cap. —
PUT /v1/organizations/{orgId}/billing/agent-budget/own - Cancel only a pending role or removal request made by the authorizing person through this app. —
POST /v1/organizations/{orgId}/changes/{changeId}/decline - Add one ordinary address to the exact inbox. —
POST /v1/organizations/{orgId}/inboxes/{inboxId}/addresses - Remove the path address with no request body. —
DELETE /v1/organizations/{orgId}/inboxes/{inboxId}/addresses/{address} - Move the path address to another inbox in this organization. —
POST /v1/organizations/{orgId}/inboxes/{inboxId}/addresses/{address}/move - Disable inbox behavior only. —
PATCH /v1/organizations/{orgId}/inboxes/{inboxId}/settings - Create a rule under current consent, approval and access to every referenced inbox and event type. —
POST /v1/organizations/{orgId}/rules - Change editable rule fields only. —
PATCH /v1/organizations/{orgId}/rules/{ruleId} - Pause the exact rule. —
POST /v1/organizations/{orgId}/rules/{ruleId}/pause - Resume the exact rule after checking live consent and access again, retaining the sponsoring app. —
POST /v1/organizations/{orgId}/rules/{ruleId}/resume
Using this API
Set K8 HQ up without help: create an organization, add a domain and the DNS records that prove it's yours, and create inboxes with addresses there. Each step is what the web app's setup screens call. The Sign-in API starts the session these calls need; the Content API reads and sends mail once an inbox exists.
Requests. Resource reads use GET without a body. Creation uses POST and partial updates use PATCH, as documented. Use these headers where applicable:
content-type: application/json.x-amz-content-sha256: the body's SHA-256 in lowercase hex. CloudFront signs every request to this service; a JSON mutation without the right hash is refused with 403 before it gets here (not a problem detail). Hash exactly the bytes sent; bodyless GET requests do not need this header.x-k8hq-token: the access token of a person's own session, from the Sign-in API. Legacy API tokens and assistants' delegated tokens aren't accepted (401). Selected operations also have a conditional personal agent contract described here.
Recent passkey. For sessions, every change (creating or renaming an organization, adding or checking a domain, creating an inbox) needs a passkey used in the last 5 minutes, and answers 401 step_up_required otherwise: confirm with the Sign-in API's passkey confirmation and retry with the new access token. Listings don't.
Browsers. Only https://app.k8hq.com may call this API from a browser: CORS preflights from other origins are refused, and a request whose Origin names another site gets 403 forbidden. No cookies are used.
Limits. Each address may make 100 changes (POST, PUT, PATCH or DELETE) to /setup/ in 5 minutes. Reads and preflights do not count toward this limit; all requests still count toward the API limit of 3000 requests per address in 5 minutes. Too many changes returns 429 rate_limited with a problem body and Retry-After: 300; a person may create 3 organizations a day and 20 in all, and have one domain waiting for its TXT record at a time.
The path to a working inbox: Create an organization, Add a domain, add its TXT record, Check, add the three DKIM CNAMEs, Check again until verified, then Create an inbox.
Errors are RFC 9457 problem details with a stable code; see Error codes.
Resource operations use GET for reads, POST for creation and workflows, PATCH for partial updates, and DELETE for removal. Personal agent credentials are accepted only for the operations marked with a conditional personal agent contract, when that service is enabled. JSON mutation bodies sent through CloudFront need their x-amz-content-sha256 hash; GET requests have no body.
Confirmed deletion through the public edge. Delete an organization, domain, inbox, board, form or contact book with a bodyless DELETE and x-k8hq-delete-confirm: encodeURIComponent(typedText). Encode the exact typed UTF-8 text once (maximum 4096 encoded bytes). For example, deleting the organization named “Équipe” uses:
http DELETE /setup/v1/organizations/org_example HTTP/1.1 Host: api.k8hq.com x-k8hq-token: <person-session-access-token> x-k8hq-delete-confirm: %C3%89quipe
Send no body, content-type, or x-amz-content-sha256 for this request. Domain DELETE alone also accepts x-k8hq-remove-addresses: true or false (omitted means false). These headers carry input, not authorization or a signed passkey confirmation. Never combine them with a body. JSON-body canonical DELETE remains supported for direct/local callers, but the deployed public CloudFront OAC edge is known to reject DELETE bodies even with their hash; use headers there.
Personal agents (conditional). Send Authorization: Bearer k8a1_... or Authorization: Bearer k8m1_... through the edge that preserves bearer credentials; do not combine this with x-k8hq-token. The service is off by default and requires explicit operator activation. The documented contract does not enable access. Every attempt, including replay, checks current membership, consent, the exact app approval, credential limits, resource state and any required acknowledgment. Independent service credentials and legacy tokens do not gain these actions.
Personal agent changes require Idempotency-Key: 16 to 128 visible ASCII characters. The key is bound to the person, connection and organization. Different input with the same key fails with 409 conflict. A committed change returns its original result and operation-id (aop_...); replay checks current access and returns the same ID without repeating the change. After an unknown reply, keep the exact input and key. There is no 24-hour key reuse window: active connections retain bindings. Recovery uses GET /api/v1/operations/{aop} on the Content API and checks current access to the original action; it returns only that action’s allowed status fields. A scheduled deletion receipt does not mean deletion has finished.
Personal agent JSON bodies reject unknown or duplicate fields and are limited to 4096 bytes (65536 bytes for rules). On shared routes the session and personal agent body schemas are alternatives: use the Agent schema linked in the operation for the narrower agent contract. A person’s recent-passkey requirement does not apply to an admitted personal agent action; it instead needs the explicit unattended-risk acknowledgment when listed. No other session action becomes available to an agent.
Base URL
| Base URL | For |
|---|---|
https://api.k8hq.com/setup | The K8 HQ web app, and programs acting with a person's session |
curl https://api.k8hq.com/setup/v1/organizations \
-H "x-k8hq-token: $ACCESS_TOKEN"
Error reference
Error codes
Errors are RFC 9457 problem details (application/problem+json) whose type links here. Branch on code; detail is for people and may change.
| Code | Meaning |
|---|---|
invalid | 400: malformed or invalid input; detail says what to fix (a name of 1 to 100 characters, a domain like example.com, 1 to 10 addresses). |
unauthenticated | 401: no session, or it expired or was revoked, or the token isn't a person's own session (assistants' delegated tokens are refused here): refresh or sign in again. |
step_up_required | 401: the change needs a passkey used in the last 5 minutes. Confirm with Start a passkey confirmation on the Sign-in API and retry with the new access token. On a change that needs a confirmation (until confirmations are enforced, a recent passkey still does), the answer also carries action and summary: confirm that instead, as for confirmation_required. |
forbidden | 403: the person may not do this in the organization (it needs an owner or admin), or a browser Origin other than the web app's. |
not_found | 404: no such call, or no such inbox or domain in the organization. |
org_limit | 429: the person created 3 organizations today (try tomorrow), or 20 in all (ask K8 HQ). |
new_payer_orgs | 409: a new payer (until their first card payment is 30 days old, and longer after a chargeback or early fraud warning) pays for at most 3 organizations: creating one (its creator pays) or taking over billing is refused at 3. Ask K8 HQ support at support@k8hq.com. |
unproven_domain | 409: the person already has a domain waiting for its TXT record, in any organization. Finish that one (Check it once the record is in place) or wait until it's released, 7 days after it was added. |
domain_taken | 409: another organization uses the domain. |
domain_limit | 409: the organization has 50 domains, the most it may have without asking K8 HQ. |
domain_expired | 410: the TXT record wasn't found within 7 days, so the domain was released. Add it again for a new record. |
domain_unverified | 409: an address's domain isn't verified in the organization yet: add its records, then Check. |
address_taken | 409: one of the addresses is already in use. |
confirm_name | 400: deleting an organization needs its name typed exactly as it's shown (or its ID if it has none); removing an inbox, its name or one of its addresses; removing a domain, the domain. |
owner_only | 403: only an owner can do this (delete the organization or cancel its deletion, pay for it, be offered billing). |
not_payer | 403: only the person who pays for the organization can change its fallback or offer billing to someone else. |
conflict | 409: billing changed meanwhile (an offer, a handover): read the settings again and retry. Moving an address to a new inbox: the address isn't in the inbox any more. |
org_closed | 410: the organization is being deleted: nothing can change in it any more. |
owner_left_recently | 409: an owner left or was removed in the last 7 days, so the organization can't be scheduled for deletion until 7 days have passed. |
nonpayment_deletion | 409: the pending deletion is K8 HQ's, because the organization has been out of credit for months (design note 0024): owners can't cancel it; adding credit stops it. |
inbox_kept | 409: a member's personal notice inbox (it goes when they leave) or the DMARC reports inbox (ask K8 HQ) isn't removed this way, nor are their addresses moved to a new inbox, nor those of an inbox readable only with its members' own keys; detail says which. |
addresses_left | 409: the domain still has addresses. List a domain's addresses shows them; remove them first, or remove the domain with removeAddresses true. |
platform_domain | 409: k8hq.com, k8hq.net and their subdomains are K8 HQ's own and are never removed. |
domain_removing | 409: the domain is being removed: it can't be checked or added again, or get addresses, until that finishes. |
removal_limit | 429: the organization removed 10 inboxes and domains today; try again tomorrow. |
removal_started | 409: the inbox's purge has started (or it isn't being removed), so it can't be kept. |
address_reserved | 409: the address was freed (deleted, or its inbox removed) in the last 7 days: until then only an owner can put it on another inbox. |
address_not_moved | 409: moving an address to a new inbox made the inbox but didn't move the address (it changed meanwhile, or its domain or inbox is being removed). The address is where it was; inboxId is the new, empty inbox: move an address there, or remove it. With discarded true the new inbox was removed again (the person's access couldn't be given): try again. |
connect_unsupported | 409: the domain's DNS host doesn't offer one-click setup for this step (or not now). Add the records yourself; checkDomain works the same. |
connect_not_now | 409: the step doesn't fit the domain now: mail-verify is for a pending domain, mail-setup for a proven or verified one, mail-dmarc for a verified one. |
dmarc_exists | 409: the domain already has a DMARC record (_dmarc); K8 HQ leaves it as it is (a second one would make DMARC invalid for the domain). |
rate_limited | 429: too many one-click setup links: 20 an hour per organization, 5 per domain, and mail-verify links 10 a day per organization (3 on sending probation); try again later. |
release_invalid | 404: not a valid release link, it was used already, or the claim it names is gone. |
release_expired | 410: the release link has expired (they work for 14 days). |
no_credit | 402: the organization has been out of credit for more than a week (design note 0024), so domains and inboxes can't be added until an owner adds credit on the Billing page. Removing them still works. |
read_only | 402: the organization has been out of credit for 60 days (design note 0024), so it's read-only: its name, domains (adding, checking, fee plans, one-click setup) and inboxes can't be changed or added until an owner adds credit on the Billing page. Removing inboxes and domains still works. |
unavailable | 503 (also 405, a method other than POST): a temporary problem; retry with backoff. |
ticket_inbox | 409: that inbox can't have a ticket board (it has one or isn't one of the organization's shared inboxes). |
ticket_members | 409: a ticket board's members are its inbox's; change the inbox's access instead. |
service_disabled | The organization has disabled this service. Existing data remains readable and exportable; an owner or admin can re-enable it in Services settings. |
service_unknown | 400. Choose a service from this organization's Services list. |
version_mismatch | 412: the contact book changed; reload its current version before retrying. |
last_holder | 409: a contact book must keep at least one member who can edit it. |
book_read_only | 409: the contact book is pending removal or purge has started; changes are blocked. |
move_changed | 409: the moving checklist changed since the displayed version. Read its current state and review it before retrying; do not apply an old action to a new checklist. |
mail_from_in_use | 409: the MAIL FROM name chosen already has records in the domain's DNS, or they couldn't be checked: choose a name that's free. |
mail_has_addresses | 409: Mail can be turned off only when the organization has no active email addresses. Remove or disable them first. |
mail_off | 409: Mail is off for the organization, so email addresses can't be added. Turn it on under Services. |
sender_unknown | 404: the sender isn't one the domain's DMARC reports named in the last 90 days (Health, confirm a sender). |
confirmation_required | 401: the change needs a passkey confirmation of exactly it (design note 0013). The answer carries action (the description to confirm) and a short summary: send action to [Begin a confirmation](/auth/docs#confirmBegin), run the passkey prompt, [finish it](/auth/docs#confirmFinish) and retry the same request with the confirmation in x-k8hq-confirm. Asking with x-k8hq-confirm: ? gets this answer without the change being made. |
confirmation_invalid | 403: the confirmation isn't valid for this session (another session's or person's, or not signed by K8 HQ): confirm again. |
confirmation_expired | 409: the confirmation timed out (it lives 2 minutes): confirm again. |
confirmation_mismatch | 409: the change isn't the one confirmed: the request, or what it changes, is different now. Show the current state and let the person confirm again; never retry silently. |
confirmation_used | 409: the confirmation was already used (each confirms one change, once): confirm again. |
needs_person | 403: only a person signed in to K8 HQ can make this change with a passkey confirmation, never an API token or an assistant. |
health_changed | 409: the Health finding changed; read it again before dismissing it. |
shared_spam_unavailable | 403: shared spam reports are not available yet. |
zero_access | 403: zero-access organizations cannot contribute shared spam reports. |
client_outdated | 426: K8 HQ has been updated. Reload this page. |
Find a schema by name
- AgentAddressInput
- AgentBoardResult
- AgentBookInput
- AgentBookResult
- AgentBudgetCap
- AgentConfirmationInput
- AgentCreateRuleInput
- AgentEmptyInput
- AgentFormInput
- AgentFormResult
- AgentInboxInput
- AgentInboxResult
- AgentInboxSettingsInput
- AgentMoveAddressInput
- AgentOK
- AgentOrganizationDeletionResult
- AgentOwnCapInput
- AgentOwnCapResult
- AgentPermissionGrowthSettings
- AgentProblem
- AgentRemovalReceipt
- AgentRuleAction
- AgentRuleResult
- AgentRuleVersionInput
- AgentServiceView
- AgentTaskBoardInput
- AgentTemplate
- AgentUpdateRuleInput
- AgentWebFlag
- AppObservation
- Attribution
- BounceObservation
- CreditObservation
- DnsRecord
- Domain
- DomainHealth
- Fallback
- HealthDismissal
- HealthItem
- HealthRecord
- MailFrom
- MailFromOption
- MonitorChange
- MonitorDay
- MonitorItem
- Move
- MoveChange
- MoveInfo
- Org
- Problem
- SeenSender
- Services
- SessionCreateBoardResourceInput
- SessionCreateBoardResourceResult
- SessionCreateBookResourceInput
- SessionCreateBookResourceResult
- SessionCreateFormResourceInput
- SessionCreateFormResourceResult
- SessionCreateInboxResourceInput
- SessionCreateInboxResourceResult
- SessionDeleteBoardResourceInput
- SessionDeleteBoardResourceResult
- SessionDeleteBookResourceInput
- SessionDeleteBookResourceResult
- SessionDeleteFormResourceInput
- SessionDeleteFormResourceResult
- SessionDeleteInboxResourceInput
- SessionDeleteInboxResourceResult
- SessionDeleteOrgResourceInput
- SessionDeleteOrgResourceResult
- Settings
- VolumeObservation
- ZeroAccessEncryption
- ZeroAccessOutboxBlocker