{
  "openapi": "3.1.0",
  "info": {
    "title": "K8 HQ Setup API",
    "version": "1",
    "summary": "Create organizations, domains and containers. Selected operations also accept personal agent credentials when enabled.",
    "description": "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](https://api.k8hq.com/auth/docs) starts the session these calls need; the [Content API](https://api.k8hq.com/docs) reads and sends mail once an inbox exists.\n\n**Requests.** Resource reads use GET without a body. Creation uses POST and partial updates use PATCH, as documented. Use these headers where applicable:\n\n- `content-type: application/json`.\n- `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.\n- `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.\n\n**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](https://api.k8hq.com/auth/docs/sessions#stepUpBegin) and retry with the new access token. Listings don't.\n\n**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.\n\n**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.\n\n**The path to a working inbox:** [Create an organization](#createOrgResource), [Add a domain](#addDomainResource), add its TXT record, [Check](#checkDomain), add the three DKIM CNAMEs, Check again until `verified`, then [Create an inbox](#createInboxResource).\n\n**Errors** are [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem details with a stable `code`; see [Error codes](#errors).\n\nResource 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.\n\n**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:\n\n```http\nDELETE /setup/v1/organizations/org_example HTTP/1.1\nHost: api.k8hq.com\nx-k8hq-token: <person-session-access-token>\nx-k8hq-delete-confirm: %C3%89quipe\n```\n\nSend 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.\n\n**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.\n\nPersonal 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.\n\nPersonal 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."
  },
  "servers": [
    {
      "url": "https://api.k8hq.com/setup",
      "description": "The K8 HQ web app, and programs acting with a person's session"
    }
  ],
  "security": [
    {
      "session": []
    }
  ],
  "tags": [
    {
      "name": "Organizations",
      "description": "Create, list, rename and delete organizations, and choose which services each one offers."
    },
    {
      "name": "Organization billing",
      "description": "Who pays for an organization, the fallback payer, and caps on what agents may spend each month."
    },
    {
      "name": "Domains",
      "description": "Add a domain, prove it's yours with DNS records (or one-click DNS setup), and manage its fee and addresses."
    },
    {
      "name": "Inboxes",
      "description": "Create and remove inboxes, and move addresses between them."
    },
    {
      "name": "Boards",
      "description": "Create task and ticket boards, give and remove access, and remove boards.\n\nTask boards (design note 0021): creating one and who has access. Items, comments and the board's config are in the [Content API](https://api.k8hq.com/docs)."
    },
    {
      "name": "Forms",
      "description": "Create form pages whose responses arrive like mail.\n\nForms (design note 0019): public form pages whose responses are stored like mail."
    },
    {
      "name": "Contacts",
      "description": "Organization-owned contact books and membership."
    },
    {
      "name": "Calendar",
      "description": "Set up your K8 HQ calendar the first time you open it."
    },
    {
      "name": "Health",
      "description": "Check a domain's mail health, and the moving checklist and monitors that go with it."
    },
    {
      "name": "Personal agent actions (conditional)",
      "description": "Selected actions for personal apps, available only when the service is enabled. Each attempt checks current access."
    }
  ],
  "paths": {
    "/v1/organizations/{orgId}/calendar": {
      "post": {
        "operationId": "preparePrimaryCalendar",
        "tags": [
          "Calendar"
        ],
        "summary": "Set up your calendar",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Your calendar is ready."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "The calendar could not be opened or changed. Refresh and try again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization is read-only because it is out of credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags/settings": {
      "post": {
        "operationId": "setOrganizationTagCreation",
        "summary": "Choose who may create organization tags",
        "description": "Only an organization owner may change this setting. With createMembers true (the default), every member may create tags. With false, only owners and admins may create them. This does not change who may read or manage tags. Requires a person’s own signed-in session.",
        "tags": [
          "Organizations"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "orgId",
                  "createMembers"
                ],
                "additionalProperties": false,
                "properties": {
                  "orgId": {
                    "type": "string",
                    "pattern": "^org_"
                  },
                  "createMembers": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Who may create tags.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "createMembers"
                  ],
                  "properties": {
                    "createMembers": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request could not be completed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "The request could not be completed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The request could not be completed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The request could not be completed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request could not be completed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/check": {
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "checkDomain",
        "summary": "Check a domain",
        "description": "Looks up the domain's DNS and moves it on as far as it can: with the TXT record found it's `proven`, and the answer lists three DKIM CNAMEs to add; with those found too (Amazon SES checks them, which can take a while after they're added) it's `verified`, and inboxes can have addresses there. Call again after adding records; `missing` says what's still not found. Once proven, the organization's invite links may sign up people without a K8 HQ account.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "domain": {
                    "type": "string"
                  }
                },
                "required": [
                  "orgId",
                  "domain"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "domain": "example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Where the domain stands now.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    }
                  },
                  "required": [
                    "domain"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "Another organization proved it first (`domain_taken`), or it's being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Its TXT record wasn't found within 7 days, and it was released (`domain_expired`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/domains/connect": {
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "connectDomain",
        "summary": "One-click DNS setup: a signed link for one step",
        "description": "Makes a link, signed by K8 HQ, that asks the domain's DNS host to add one step's records; open it in the same window. The DNS host shows its own page to approve, then sends the person back to `https://app.k8hq.com/setup/connect?attempt=...`, where the web app calls `connectReturn`. Everything in the link comes from K8 HQ's own records (the proof token, the DKIM tokens, the return address); nothing from the request but the step. For `mail-dmarc` the domain's `_dmarc` record is looked up now, and the link is refused if one exists; `dmarc@` the domain is routed to the organization's DMARC reports first. A link works with its attempt for an hour. At most 20 links an hour per organization and 5 per domain, and `mail-verify` links at most 10 a day per organization (3 on sending probation). Only for DNS hosts K8 HQ has enabled (`connect_unsupported` otherwise). Needs `domains.manage`.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `domain.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "service": {
                    "type": "string",
                    "enum": [
                      "mail-verify",
                      "mail-setup",
                      "mail-dmarc",
                      "mail-from"
                    ],
                    "description": "`mail-verify`: the TXT record that proves the organization controls the domain (a pending domain). `mail-setup`: the three DKIM CNAMEs and K8 HQ's sender merged into the SPF record (a proven or verified domain). `mail-dmarc`: a DMARC record in monitoring mode (`p=none`) with reports to `dmarc@` the domain (a verified domain with no DMARC record). `mail-from`: the MX and SPF records of the domain's MAIL FROM name (a verified domain whose MAIL FROM name has no other records). Moving mail (MX) isn't offered yet."
                  }
                },
                "required": [
                  "orgId",
                  "domain",
                  "service"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "domain": "example.com",
                "service": "mail-verify"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The link to open.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "The DNS host's apply URL, signed."
                    },
                    "attempt": {
                      "type": "string",
                      "description": "The attempt (`dca_...`)."
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "url",
                    "attempt",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The organization has no such domain, or one-click setup is off (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The DNS host doesn't offer this step (`connect_unsupported`), the step doesn't fit the domain now (`connect_not_now`), the domain already has a DMARC record (`dmarc_exists`), or it's being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many links in the last hour (`rate_limited`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "domain.change"
      }
    },
    "/v1/domains/connect/return": {
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "connectReturn",
        "summary": "One-click DNS setup: check after coming back",
        "description": "Checks the domain's DNS for an attempt, as `checkDomain` does, without a new passkey confirmation: the attempt (made with one in the last hour) and the person's `domains.manage` in its organization authorize it; otherwise `not_found`. The attempt is used up once its check finds what the step adds (`done`); until then (DKIM can take a while to be seen) it may be checked again, up to 30 times.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "attempt": {
                    "type": "string",
                    "description": "The attempt from the return address (`dca_...`)."
                  }
                },
                "required": [
                  "attempt"
                ]
              },
              "example": {
                "attempt": "dca_..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Where the domain stands now.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgId": {
                      "type": "string"
                    },
                    "service": {
                      "type": "string",
                      "enum": [
                        "mail-verify",
                        "mail-setup",
                        "mail-dmarc",
                        "mail-from"
                      ],
                      "description": "`mail-verify`: the TXT record that proves the organization controls the domain (a pending domain). `mail-setup`: the three DKIM CNAMEs and K8 HQ's sender merged into the SPF record (a proven or verified domain). `mail-dmarc`: a DMARC record in monitoring mode (`p=none`) with reports to `dmarc@` the domain (a verified domain with no DMARC record). `mail-from`: the MX and SPF records of the domain's MAIL FROM name (a verified domain whose MAIL FROM name has no other records). Moving mail (MX) isn't offered yet."
                    },
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    },
                    "done": {
                      "type": "boolean",
                      "description": "The check found what the step adds."
                    }
                  },
                  "required": [
                    "orgId",
                    "service",
                    "domain",
                    "done"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such attempt for this person, used up or expired (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Another organization proved the domain first (`domain_taken`), or it's being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The domain's TXT record wasn't found within 7 days, and it was released (`domain_expired`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/domains/release/info": {
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "releaseInfo",
        "summary": "A proof notice's release link: which domain",
        "description": "When a domain is proven after a one-click link was made for it, K8 HQ mails `postmaster@` and `admin@` the domain once, with a link to release the claim, for the domain's owner, who may have no K8 HQ account: no session. This shows the domain the link names before anything is done.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "The token from the release link (`t`)."
                  }
                },
                "required": [
                  "token"
                ]
              },
              "example": {
                "token": "..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain the link names; `released` once it was used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "released": {
                      "type": "boolean"
                    },
                    "orgId": {
                      "type": "string",
                      "description": "The organization that claimed the domain (`org_...`)."
                    },
                    "orgName": {
                      "type": "string",
                      "description": "Its display name, as its people chose it."
                    },
                    "disputed": {
                      "type": "boolean",
                      "description": "The release didn't remove the domain (the organization is past probation, or has addresses of its own there): its sending is stopped and K8 HQ looks into it."
                    }
                  },
                  "required": [
                    "domain",
                    "orgId",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "description": "Not a valid release link (`release_invalid`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The link has expired (`release_expired`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/domains/release": {
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "release",
        "summary": "A proof notice's release link: release the claim",
        "description": "Acts on the claim the link names, once, if that organization still holds the same domain record. An organization on sending probation with no addresses of its own there loses the domain (it's removed, with K8 HQ's DMARC reports route). Otherwise the domain is disputed: every record and address stays, nothing is sent from it, and K8 HQ looks into it; the organization's owners are told either way. Links expire after 14 days. No session (see `releaseInfo`).",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "The token from the release link (`t`)."
                  }
                },
                "required": [
                  "token"
                ]
              },
              "example": {
                "token": "..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The claim is being released.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "released": {
                      "type": "boolean"
                    },
                    "orgId": {
                      "type": "string",
                      "description": "The organization that claimed the domain (`org_...`)."
                    },
                    "orgName": {
                      "type": "string",
                      "description": "Its display name, as its people chose it."
                    },
                    "disputed": {
                      "type": "boolean",
                      "description": "The release didn't remove the domain (the organization is past probation, or has addresses of its own there): its sending is stopped and K8 HQ looks into it."
                    }
                  },
                  "required": [
                    "domain",
                    "orgId",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "description": "Not a valid release link, used already, or the claim it names is gone (`release_invalid`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The link has expired (`release_expired`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/inboxes/promote": {
      "post": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "promoteAddress",
        "summary": "Move an address to a new inbox",
        "description": "Creates an inbox named `name` in the organization and moves one of an inbox's addresses into it as its first address (Settings > Organization > Inboxes > Edit, \"Move to a new inbox…\"). No mail to the address is refused at any point: until the move, mail arrives where it did; from then on, in the new inbox, which also sends as the address. Mail already received stays in the old inbox. The person gets access to the new inbox as its owner, as with [Create an inbox](#createInboxResource); nobody else does until someone gives them access.\n\nIt happens in steps: the new inbox is made empty, the person's access is given, then the address moves in one step. If the move fails (the address changed meanwhile, say), the answer is `409 address_not_moved` with the new, empty inbox's `inboxId`: the address still receives where it was. Move it there with the Content API's move, or remove the empty inbox.\n\nNeeds what creating an inbox needs (`containers.create`, `inbox.addresses.manage` and `domains.manage`), plus `inbox.addresses.manage` on the inbox the address leaves, which the person is in. Not for a catch-all address, the DMARC reports inbox, a personal notice inbox, or an inbox readable only with its members' own keys.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `inbox.promote`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "inboxId": {
                    "type": "string",
                    "description": "The inbox the address is on now (`ibx_...`).",
                    "pattern": "^ibx_"
                  },
                  "endpointId": {
                    "type": "string",
                    "description": "The address to move (`ept_...`), as the Content API lists an inbox's addresses.",
                    "pattern": "^ept_"
                  },
                  "name": {
                    "type": "string",
                    "description": "The new inbox's name, 1 to 100 characters, which everyone in it sees."
                  }
                },
                "required": [
                  "orgId",
                  "inboxId",
                  "endpointId",
                  "name"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "inboxId": "ibx_01J...",
                "endpointId": "ept_01J...",
                "name": "Support"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new inbox, with the address on it.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "inboxId": {
                      "type": "string",
                      "description": "The new inbox (`ibx_...`).",
                      "pattern": "^ibx_"
                    },
                    "endpointId": {
                      "type": "string",
                      "description": "The address that moved (`ept_...`): its ID stays the same.",
                      "pattern": "^ept_"
                    }
                  },
                  "required": [
                    "inboxId",
                    "endpointId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "No such inbox in the organization, or the person isn't in it (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The address's domain isn't verified (`domain_unverified`); the address isn't in the inbox any more (`conflict`); the inbox's addresses are K8 HQ's to set up, or it's readable only with its members' own keys (`inbox_kept`); or the new inbox was made but the address didn't move (`address_not_moved`, with its `inboxId`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization has been out of credit for more than a week (`no_credit`, design note 0024): domains and inboxes can't be added until an owner adds credit. Removing them still works. From 60 days it's read-only (`read_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-k8hq-confirm": "inbox.promote"
      }
    },
    "/v1/inboxes/delete/cancel": {
      "post": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "cancelInboxDeletion",
        "summary": "Keep an inbox",
        "description": "Keeps an inbox whose removal hasn't purged it yet: any owner, no passkey (like cancelling an organization's deletion). It opens again as it was: its mail, addresses, everyone's access and mail apps' tokens, and the rules its removal paused. The owners and its members are told.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "inboxId": {
                    "type": "string",
                    "description": "The inbox (`ibx_...`).",
                    "pattern": "^ibx_"
                  }
                },
                "required": [
                  "orgId",
                  "inboxId"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "inboxId": "ibx_01J..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Kept.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "inboxId": {
                      "type": "string",
                      "description": "The inbox (`ibx_...`).",
                      "pattern": "^ibx_"
                    }
                  },
                  "required": [
                    "inboxId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Only an owner can (`owner_only`), or not a member (`forbidden`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such inbox in the organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Its purge has started, or it isn't being removed (`removal_started`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/orgs/payer/offer": {
      "post": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "offerBilling",
        "summary": "Offer billing to another owner",
        "description": "The payer offers to hand billing to another owner, who accepts within 7 days with `/v1/orgs/payer/take`. They're told.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `payer.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "memberId": {
                    "type": "string",
                    "description": "A member (`mem_...`).",
                    "pattern": "^mem_"
                  }
                },
                "required": [
                  "orgId",
                  "memberId"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "memberId": "mem_01J..."
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "They don't pay for it (`not_payer`), or the member isn't an owner (`owner_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Offered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgId": {
                      "type": "string",
                      "description": "The organization (`org_...`).",
                      "pattern": "^org_"
                    },
                    "offerTo": {
                      "type": "string",
                      "description": "A member (`mem_...`).",
                      "pattern": "^mem_"
                    }
                  },
                  "required": [
                    "orgId",
                    "offerTo"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Billing changed meanwhile: look again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "payer.change"
      }
    },
    "/v1/orgs/payer/take": {
      "post": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "takeBilling",
        "summary": "Take over billing",
        "description": "An owner becomes the organization's payer, with their own funding: accepting the payer's offer, or taking billing over (design note 0004 section 4). The fallback is off until they turn theirs on; the old payer's unused purchased credit goes back to them. Every owner is told.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `payer.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  }
                },
                "required": [
                  "orgId"
                ]
              },
              "example": {
                "orgId": "org_01J..."
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "Only an owner can pay for an organization (`owner_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "They pay for it now.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgId": {
                      "type": "string",
                      "description": "The organization (`org_...`).",
                      "pattern": "^org_"
                    }
                  },
                  "required": [
                    "orgId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Billing changed meanwhile: look again (`conflict`); or a new payer pays for 3 organizations already, the most while they're new (`new_payer_orgs`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "payer.change"
      }
    },
    "/v1/orgs/delete/cancel": {
      "post": {
        "tags": [
          "Organizations"
        ],
        "operationId": "cancelOrgDeletion",
        "summary": "Cancel a deletion",
        "description": "Cancels the organization's pending deletion (any owner; no passkey, so it's always quick): nothing is removed. Every owner is told. Not a deletion K8 HQ scheduled because the organization stayed out of credit (`deleteReason` `nonpayment`): adding credit stops that one.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  }
                },
                "required": [
                  "orgId"
                ]
              },
              "example": {
                "orgId": "org_01J..."
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "No deletion is waiting to be cancelled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Only an owner can (`owner_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The deletion is K8 HQ's, because the organization has been out of credit for months (`nonpayment_deletion`): adding credit on the Billing page stops it.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgId": {
                      "type": "string",
                      "description": "The organization (`org_...`).",
                      "pattern": "^org_"
                    }
                  },
                  "required": [
                    "orgId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/forms/delete/cancel": {
      "post": {
        "tags": [
          "Forms"
        ],
        "operationId": "cancelFormDeletion",
        "summary": "Keep a form",
        "description": "Keeps a form whose removal hasn't purged it yet: any owner, no passkey (like keeping an inbox). It comes back with its responses and everyone's access, paused if it was live: its members resume or publish it. The owners and its members are told.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "formId": {
                    "type": "string",
                    "description": "The board (`frm_...`).",
                    "pattern": "^frm_"
                  }
                },
                "required": [
                  "orgId",
                  "formId"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "formId": "frm_01J..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Kept.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "formId": {
                      "type": "string",
                      "description": "The board (`frm_...`).",
                      "pattern": "^frm_"
                    }
                  },
                  "required": [
                    "formId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Only an owner can (`owner_only`), or not a member (`forbidden`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such form in the organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Its purge has started, or it isn't being removed (`removal_started`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/boards/delete/cancel": {
      "post": {
        "tags": [
          "Boards"
        ],
        "operationId": "cancelBoardDeletion",
        "summary": "Keep a board",
        "description": "Keeps a board whose removal hasn't purged it yet: any owner, no passkey (like keeping an inbox). It opens again as it was: its items, links and everyone's access. The owners and its members are told.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "boardId": {
                    "type": "string",
                    "description": "The board (`brd_...`).",
                    "pattern": "^brd_"
                  }
                },
                "required": [
                  "orgId",
                  "boardId"
                ]
              },
              "example": {
                "orgId": "org_01J...",
                "boardId": "brd_01J..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Kept.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "boardId": {
                      "type": "string",
                      "description": "The board (`brd_...`).",
                      "pattern": "^brd_"
                    }
                  },
                  "required": [
                    "boardId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Only an owner can (`owner_only`), or not a member (`forbidden`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such board in the organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Its purge has started, or it isn't being removed (`removal_started`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/books/delete/cancel": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "cancelBookDeletion",
        "summary": "Cancel book removal before purge begins",
        "description": "Cancel book removal before purge begins. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string"
                  },
                  "bookId": {
                    "type": "string"
                  }
                },
                "required": [
                  "orgId",
                  "bookId"
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Cancel book removal before purge begins.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bookId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "bookId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations": {
      "get": {
        "tags": [
          "Organizations"
        ],
        "operationId": "listOrgsResource",
        "summary": "List my organizations",
        "description": "The organizations the person is in, with their names and what the person may set up in each.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Their organizations, by ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Org"
                      }
                    }
                  },
                  "required": [
                    "orgs"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Organizations"
        ],
        "operationId": "createOrgResource",
        "summary": "Create an organization",
        "description": "Creates an organization with the person as its owner. A person may create 3 a day and 20 in all. A new organization starts with no credit: it can receive mail, and sending waits until it has some.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "1 to 100 characters, no control characters; spaces are tidied. It can't include K8 HQ (in any case, spaced or not).",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Porter Design"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new organization.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "org": {
                      "$ref": "#/components/schemas/Org"
                    }
                  },
                  "required": [
                    "org"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "429": {
            "description": "Too many organizations (`org_limit`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "A new payer pays for 3 organizations already, the most while they're new (`new_payer_orgs`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}/settings": {
      "get": {
        "tags": [
          "Organizations"
        ],
        "operationId": "orgSettingsResource",
        "summary": "An organization's settings",
        "description": "Its name, time zone and status, for any member; owners also see who pays, the payer's fallback and the sending probation.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Settings"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Organizations"
        ],
        "operationId": "renameOrgResource",
        "summary": "Change organization settings",
        "description": "Changes the organization's display name or time zone: owners (`org.settings.change`).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "1 to 100 characters. It can't include K8 HQ (in any case, spaced or not), except in K8 HQ's own organizations.",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "timeZone": {
                    "type": "string",
                    "description": "An IANA time zone, such as America/New_York or UTC. UTC when unset.",
                    "minLength": 1,
                    "example": "America/New_York"
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "name"
                    ]
                  },
                  {
                    "required": [
                      "timeZone"
                    ]
                  }
                ]
              },
              "example": {
                "name": "Porter Design Studio"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The settings changed, as stored.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgId": {
                      "type": "string",
                      "description": "The organization (`org_...`).",
                      "pattern": "^org_"
                    },
                    "name": {
                      "type": "string"
                    },
                    "timeZone": {
                      "type": "string",
                      "description": "An IANA time zone, such as America/New_York or UTC. UTC when unset.",
                      "minLength": 1,
                      "example": "America/New_York"
                    }
                  },
                  "required": [
                    "orgId"
                  ],
                  "additionalProperties": false,
                  "anyOf": [
                    {
                      "required": [
                        "name"
                      ]
                    },
                    {
                      "required": [
                        "timeZone"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}/services": {
      "get": {
        "tags": [
          "Organizations"
        ],
        "operationId": "orgServicesResource",
        "summary": "Organization services catalog and availability",
        "description": "Returns the services available for this organization and the value of each switch. Owners and admins manage switches independently of resource grants.\n\n**Independent program contract (conditional).** When enabled, an independent program may read only its own organization’s services with `Authorization: Bearer k8s1_...` and current `org.view` authority. Do not combine credentials. This read checks the current credential, service identity, grant, app approval, publisher and organization state. It returns only `catalog` and `services`, without `manageServices`; it creates no receipt and needs no `Idempotency-Key`. No personal-agent credential is accepted here. This contract grants no permission to change services or read content. The service is off by default and requires explicit operator activation.",
        "security": [
          {
            "session": []
          },
          {
            "serviceCredential": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Services"
                    },
                    {
                      "$ref": "#/components/schemas/AgentServiceView"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_PROGRAMS=on"
        ],
        "x-k8hq-reads": [
          {
            "id": "setup.organization.services",
            "principals": [
              "organization-service"
            ],
            "permissions": [
              "org.view"
            ],
            "receipt": null
          }
        ]
      },
      "patch": {
        "tags": [
          "Organizations"
        ],
        "operationId": "changeOrgServicesResource",
        "summary": "Change organization service availability",
        "description": "Owners and admins manage service availability independently of resource grants. Enable all available services affects stable services only. Choose a service ID from the organization’s catalog. Other IDs return `service_unknown`.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "serviceId": {
                    "type": "string",
                    "description": "A service ID from the organization’s services catalog."
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "enableAllAvailable": {
                    "type": "boolean"
                  }
                },
                "required": [],
                "oneOf": [
                  {
                    "required": [
                      "serviceId",
                      "enabled"
                    ],
                    "not": {
                      "required": [
                        "enableAllAvailable"
                      ]
                    }
                  },
                  {
                    "required": [
                      "enableAllAvailable"
                    ],
                    "properties": {
                      "enableAllAvailable": {
                        "const": true
                      }
                    },
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "serviceId"
                          ]
                        },
                        {
                          "required": [
                            "enabled"
                          ]
                        }
                      ]
                    }
                  }
                ]
              },
              "example": {
                "serviceId": "boards",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Services"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Mail can't be turned off while the organization has active email addresses (mail_has_addresses).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}/domains": {
      "get": {
        "tags": [
          "Domains"
        ],
        "operationId": "listDomainsResource",
        "summary": "List domains",
        "description": "The organization's domains and the DNS records each needs, for members with `domains.manage` (owners and admins).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The domains.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domains": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Domain"
                      }
                    }
                  },
                  "required": [
                    "domains"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "addDomainResource",
        "summary": "Add a domain",
        "description": "Adds a domain to the organization and returns the TXT record that proves the organization controls it. Add the record at the domain's DNS host, then [Check](#checkDomain) it within 7 days, or the domain is released. A person may have one domain waiting for its TXT record at a time, across all their organizations. Adding a domain the organization already has returns it as it stands (with a new TXT value and another 7 days, if its time had run out).\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `domain.add`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "A domain name, such as `example.com`."
                  }
                },
                "required": [
                  "domain"
                ]
              },
              "example": {
                "domain": "example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain, `pending`, with its TXT record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    }
                  },
                  "required": [
                    "domain"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedConfirm"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "Another domain of theirs is waiting (`unproven_domain`), another organization has it (`domain_taken`), or the organization has 50 (`domain_limit`), or it's being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization has been out of credit for more than a week (`no_credit`, design note 0024): domains and inboxes can't be added until an owner adds credit. Removing them still works. From 60 days it's read-only (`read_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "x-k8hq-confirm": "domain.add"
      }
    },
    "/v1/organizations/{orgId}/inboxes": {
      "get": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "orgInboxesResource",
        "summary": "List the organization's inboxes",
        "description": "The organization's inboxes (not personal notice inboxes, nor ones being removed), whether or not you're in them, with their addresses and whether you can open each one's mail; for members with `containers.delete` (owners and admins). It never shows mail, nor who else is in an inbox.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's inboxes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "inboxes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "inboxId": {
                            "type": "string",
                            "description": "The inbox (`ibx_...`).",
                            "pattern": "^ibx_"
                          },
                          "label": {
                            "type": "string",
                            "description": "Its name, or its first address."
                          },
                          "addresses": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Its addresses."
                          },
                          "access": {
                            "type": "boolean",
                            "description": "Whether you're in it (can read its mail)."
                          },
                          "unchecked": {
                            "type": "boolean",
                            "description": "True if a connected AI can send from this inbox without anyone checking."
                          }
                        },
                        "required": [
                          "inboxId",
                          "label",
                          "addresses",
                          "access"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "inboxes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "createInboxResource",
        "summary": "Create an inbox",
        "description": "Creates an inbox and gives the person access to it as its owner: with 1 to 10 addresses on the organization's verified domains (local parts may have letters, digits and `. _ + -`; catch-all addresses aren't made here), which needs `containers.create`, `inbox.addresses.manage` and `domains.manage`; or with no addresses and a name, which needs only `containers.create` (no domain needed; addresses can be added later). Then read and send through the [Content API](https://api.k8hq.com/docs).\n\nWith addresses, needs a passkey confirmation of this change (`x-k8hq-confirm`: `inbox.create`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works. With no addresses, needs a passkey sign-in in the last five minutes.\n\n**Personal agent contract (conditional).** Create an inbox with one to ten distinct ordinary email addresses. This variant does not accept a name or an addressless inbox. The server chooses the inbox ID and commits initial creator access with creation. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.createInboxResource`. Permissions: `containers.create`, `inbox.addresses.manage`, `domains.manage`. Unattended-risk acknowledgment: required. Receipt: `atomic-inbox-create-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `resources.inboxId`. Agent input: [AgentInboxInput](#schema-AgentInboxInput). Agent result: [AgentInboxResult](#schema-AgentInboxResult).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionCreateInboxResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentInboxInput"
                  }
                ]
              },
              "example": {
                "addresses": [
                  "hello@example.com",
                  "dee@example.com"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new inbox.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionCreateInboxResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentInboxResult"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AgentSessionBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedConfirm"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbidden"
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "409": {
            "description": "A domain isn't verified (`domain_unverified`), or an address is in use (`address_taken`), or one was freed in the last 7 days and only an owner may reuse it (`address_reserved`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict",
                                "domain_unverified",
                                "address_taken",
                                "address_reserved",
                                "mail_off"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "The organization has been out of credit for more than a week (`no_credit`, design note 0024): domains and inboxes can't be added until an owner adds credit. Removing them still works. From 60 days it's read-only (`read_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 402
                            },
                            "code": {
                              "enum": [
                                "read_only",
                                "no_credit",
                                "unavailable"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "Current resource state prevents this change. Branch on the stable code.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 410
                        },
                        "code": {
                          "enum": [
                            "org_closed"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "x-k8hq-confirm": "inbox.create",
        "x-k8hq-actions": [
          {
            "id": "setup.createInboxResource",
            "permissions": [
              "containers.create",
              "inbox.addresses.manage",
              "domains.manage"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-inbox-create-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "resources.inboxId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/boards": {
      "post": {
        "tags": [
          "Boards"
        ],
        "operationId": "createBoardResource",
        "summary": "Create a task or ticket board",
        "description": "Creates a task board (design note 0021) with the person as its first member, or, with `inboxId`, a ticket board linked to that inbox (step B): the inbox's mail opens and joins its tickets, and its members are the inbox's (it has no members of its own). The person must be able to edit the inbox; one ticket board an inbox, never a member's personal notice inbox or the inbox that collects DMARC reports (reports about mail sent from your domains). A ticket board's statuses also need an `active` and a `closed` one; without statuses it gets New, Open, Waiting on customer, Solved and Closed by category. Statuses are IDs and categories (`todo`, `active`, `waiting`, `done`, `closed`; at least one `todo` and one `done`; at most 20); their names are sealed by the browser into the board's config next (`PUT /api/v1/boards/{board}/config`, If-Match 0). Without statuses the board gets To do, In progress, Waiting and Done by category. Needs `boards.create`; at most 200 boards an organization. Refused while the organization is read-only (out of credit for 60 days).\n\n**Personal agent contract (conditional).** Create only a task board, with initial creator access. Ticket inbox links, caller-chosen IDs, keys and sealed configuration are not accepted. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.createBoardResource.task`. Permissions: `boards.create`. Unattended-risk acknowledgment: required. Receipt: `atomic-task-board-create-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `resources.boardId`. Agent input: [AgentTaskBoardInput](#schema-AgentTaskBoardInput). Agent result: [AgentBoardResult](#schema-AgentBoardResult).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionCreateBoardResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentTaskBoardInput"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new board.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionCreateBoardResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentBoardResult"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AgentSessionBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): nothing can be added until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 402
                            },
                            "code": {
                              "enum": [
                                "read_only",
                                "unavailable"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No such inbox, or the person has no access to it.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The inbox can't have a ticket board (`ticket_inbox`): it has one or isn't one of the organization's shared inboxes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          }
        },
        "x-k8hq-step-up": true,
        "x-k8hq-actions": [
          {
            "id": "setup.createBoardResource.task",
            "permissions": [
              "boards.create"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-task-board-create-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "resources.boardId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/forms": {
      "post": {
        "tags": [
          "Forms"
        ],
        "operationId": "createFormResource",
        "summary": "Create a form",
        "description": "Creates a form (design note 0019) with the person as its first member: a draft with the folders New, Done, Spam, Trash and Held and a daily limit of 500 responses. Its fields are written in the browser, sealed (`PUT /api/v1/forms/{form}/draft`), and published through the content API (`POST /api/v1/forms/{form}/publish`). Needs `forms.create`; at most 200 forms an organization. Refused from day 7 out of credit, as new inboxes and domains are.\n\n**Personal agent contract (conditional).** Create only an empty draft form with retentionDays zero and initial creator access. Positive retention, publication and sealed definitions are not accepted. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.createFormResource`. Permissions: `forms.create`. Unattended-risk acknowledgment: required. Receipt: `atomic-draft-form-create-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `resources.formId`. Agent input: [AgentFormInput](#schema-AgentFormInput). Agent result: [AgentFormResult](#schema-AgentFormResult).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionCreateFormResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentFormInput"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new form.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionCreateFormResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentFormResult"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AgentSessionBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "402": {
            "description": "Out of credit for 7 days or more, or read-only (design note 0024): nothing can be added until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 402
                            },
                            "code": {
                              "enum": [
                                "read_only",
                                "unavailable"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          }
        },
        "x-k8hq-step-up": true,
        "x-k8hq-actions": [
          {
            "id": "setup.createFormResource",
            "permissions": [
              "forms.create"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-draft-form-create-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "resources.formId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/books": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "createBookResource",
        "summary": "Create an organization-owned contact book",
        "description": "Create an organization-owned contact book. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.\n\n**Personal agent contract (conditional).** Create an organization-owned contact book. Members normalize to the authorizing member alone for self (books.create), or to any other member set for shared (containers.create and unattended acknowledgment). The server chooses the book ID and commits the initial grants with creation; it returns bookId, not a book object. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.createBookResource.self` (self). Permissions: `books.create`. Unattended-risk acknowledgment: not required. Receipt: `atomic-book-create-self-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `resources.bookId`. Action `setup.createBookResource.shared` (shared). Permissions: `containers.create`. Unattended-risk acknowledgment: required. Receipt: `atomic-book-create-shared-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `resources.bookId`. Agent input: [AgentBookInput](#schema-AgentBookInput). Agent result: [AgentBookResult](#schema-AgentBookResult).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionCreateBookResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentBookInput"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/AgentSessionBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "200": {
            "description": "Create an organization-owned contact book.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionCreateBookResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentBookResult"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization cannot add resources now. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 402
                        },
                        "code": {
                          "enum": [
                            "read_only",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "x-k8hq-actions": [
          {
            "id": "setup.createBookResource.self",
            "permissions": [
              "books.create"
            ],
            "unattendedAcknowledgment": false,
            "receipt": {
              "profile": "atomic-book-create-self-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "resources.bookId"
            ],
            "variant": "self"
          },
          {
            "id": "setup.createBookResource.shared",
            "permissions": [
              "containers.create"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-book-create-shared-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "resources.bookId"
            ],
            "variant": "shared"
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/icon": {
      "put": {
        "tags": [
          "Organizations"
        ],
        "operationId": "setOrgIcon",
        "summary": "Set organization icon",
        "description": "Changes the organization icon. Requires org.settings.change (owners by default) and a recent passkey. Icons are visible to organization members. The server validates and normalizes PNG images; audit events contain no image data.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The saved icon, or an empty string after removal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "orgId",
                    "icon"
                  ],
                  "properties": {
                    "orgId": {
                      "type": "string"
                    },
                    "icon": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "orgId": "org_example",
                  "icon": ""
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted or has been deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "icon"
                ],
                "properties": {
                  "icon": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 87406,
                    "description": "data:image/png;base64, followed by a PNG of at most 64 KiB decoded; square, 1–256 pixels."
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Organizations"
        ],
        "operationId": "removeOrgIcon",
        "summary": "Remove organization icon",
        "description": "Changes the organization icon. Requires org.settings.change (owners by default) and a recent passkey. Icons are visible to organization members. The server validates and normalizes PNG images; audit events contain no image data.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The saved icon, or an empty string after removal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "orgId",
                    "icon"
                  ],
                  "properties": {
                    "orgId": {
                      "type": "string"
                    },
                    "icon": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "orgId": "org_example",
                  "icon": ""
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted or has been deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}/books/{bookId}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "operationId": "bookInfoResource",
        "summary": "Read a contact book and current capabilities",
        "description": "Read a contact book and current capabilities. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bookId",
            "in": "path",
            "required": true,
            "description": "bookId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Read a contact book and current capabilities.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "book": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "orgId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "modseq": {
                          "type": "integer"
                        },
                        "version": {
                          "type": "integer"
                        },
                        "deleting": {
                          "type": "boolean"
                        },
                        "purging": {
                          "type": "boolean"
                        },
                        "purgeAt": {
                          "type": "string"
                        },
                        "createdAttribution": {
                          "$ref": "#/components/schemas/Attribution"
                        },
                        "updatedAttribution": {
                          "$ref": "#/components/schemas/Attribution"
                        },
                        "requestedAttribution": {
                          "$ref": "#/components/schemas/Attribution"
                        },
                        "privacy": {
                          "type": "string",
                          "enum": [
                            "readable",
                            "zero_access"
                          ]
                        },
                        "epoch": {
                          "type": "integer",
                          "minimum": 1
                        }
                      },
                      "required": [
                        "id",
                        "orgId",
                        "name",
                        "createdAt",
                        "modseq",
                        "version",
                        "deleting",
                        "purging"
                      ],
                      "additionalProperties": false
                    },
                    "members": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "access": {
                      "type": "array",
                      "description": "Each member's access: owner (\"Can edit\") or read (\"Can view\").",
                      "items": {
                        "type": "object",
                        "properties": {
                          "memberId": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "read"
                            ]
                          }
                        },
                        "required": [
                          "memberId",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "memberId": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "canShare": {
                      "type": "boolean"
                    },
                    "canDelete": {
                      "type": "boolean"
                    },
                    "canRename": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "book",
                    "members",
                    "access",
                    "memberId",
                    "enabled",
                    "canShare",
                    "canDelete",
                    "canRename"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Contacts"
        ],
        "operationId": "renameBookResource",
        "summary": "Rename a book with optimistic concurrency",
        "description": "Rename a book with optimistic concurrency. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bookId",
            "in": "path",
            "required": true,
            "description": "bookId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "version"
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Rename a book with optimistic concurrency.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bookId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "bookId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Contacts"
        ],
        "operationId": "deleteBookResource",
        "summary": "Schedule book removal with seven-day cancelable grace",
        "description": "Schedule book removal with seven-day cancelable grace. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `container.delete`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.\n\n**Personal agent contract (conditional).** Schedule removal of the exact book. The committed receipt is scheduling acceptance, not current pending state or purge completion. The system continues after app disconnection; the existing human cancellation path remains available during the grace period. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.deleteBookResource`. Permissions: `containers.delete`. Unattended-risk acknowledgment: required. Receipt: `book-removal-v1`. Status fields: `id`, `action`, `state`, `resources.bookId`. Agent input: [AgentConfirmationInput](#schema-AgentConfirmationInput). Agent result: [AgentRemovalReceipt](#schema-AgentRemovalReceipt).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bookId",
            "in": "path",
            "required": true,
            "description": "bookId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-k8hq-delete-confirm",
            "in": "header",
            "required": false,
            "description": "Exact typed confirmation, UTF-8 percent-encoded (encodeURIComponent), decoded once; maximum 4096 encoded bytes. Use a bodyless DELETE. Input metadata, not authorization. Do not combine deletion headers with any body. JSON bodies remain supported for direct requests.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionDeleteBookResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentConfirmationInput"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/AgentSessionBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "200": {
            "description": "Schedule book removal with seven-day cancelable grace.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionDeleteBookResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentRemovalReceipt"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          }
        },
        "x-k8hq-confirm": "container.delete",
        "x-k8hq-actions": [
          {
            "id": "setup.deleteBookResource",
            "permissions": [
              "containers.delete"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "book-removal-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.bookId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/books/{bookId}/members": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "addBookMemberResource",
        "summary": "Give a member book access",
        "description": "Give a member book access, or change the access of a member who has it. \"Can edit\" is the default; \"Can view\" lets them read and export contacts but not change, share or rename the book (deleting it still depends on containers.delete). A book keeps at least one member who can edit it. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `access.grant`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bookId",
            "in": "path",
            "required": true,
            "description": "bookId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "memberId": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "read"
                    ],
                    "description": "owner (\"Can edit\", the default) or read (\"Can view\")."
                  }
                },
                "required": [
                  "memberId"
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Give a member book access.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bookId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "bookId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "access.grant"
      }
    },
    "/v1/organizations/{orgId}/books/{bookId}/members/{memberId}": {
      "delete": {
        "tags": [
          "Contacts"
        ],
        "operationId": "removeBookMemberResource",
        "summary": "Revoke book access while protecting owners and the last holder",
        "description": "Revoke book access while protecting owners and the last holder. Reads and exports remain available while Contacts is disabled or removal is pending. Books are organization-owned. Shared creation, sharing changes and removal require a recent passkey.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bookId",
            "in": "path",
            "required": true,
            "description": "bookId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memberId",
            "in": "path",
            "required": true,
            "description": "memberId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "Revoke book access while protecting owners and the last holder.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bookId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "bookId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "412": {
            "description": "The book changed or its lifecycle prevents this action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}/boards/{boardId}/members/{memberId}": {
      "put": {
        "tags": [
          "Boards"
        ],
        "operationId": "addBoardMemberResource",
        "summary": "Give someone access to a board",
        "description": "Gives a member of the organization access to a task board. Needs `access.grant`, and the caller on the board.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `access.grant`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works. Optional role is owner (full access, the default) or comment (Can view and comment). An explicit role replaces existing access; omitting it does not widen limited access. Can view and comment members cannot change board access even with access.grant. Each change records access.board.granted with the role in the event and audit log.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "boardId",
            "in": "path",
            "required": true,
            "description": "boardId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memberId",
            "in": "path",
            "required": true,
            "description": "memberId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done (also when they had access already).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "A ticket board's members are its inbox's (`ticket_members`): give or remove access to the inbox instead.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "access.grant",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "comment"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Boards"
        ],
        "operationId": "removeBoardMemberResource",
        "summary": "Remove someone's access to a board",
        "description": "Removes someone's access to a task board and the board's key copies for them; what they already decrypted stays readable to them (the key isn't rotated). Removing someone else requires `access.grant` and permission to change the board. Members who can comment or make changes can leave on their own. A board must keep at least one member who can make changes.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "boardId",
            "in": "path",
            "required": true,
            "description": "boardId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memberId",
            "in": "path",
            "required": true,
            "description": "memberId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done (also when they had no access).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "Ticket boards use inbox access (`ticket_members`). Give or remove access to the inbox instead. The request also fails if access changed during the request (`conflict`) or if leaving would now remove the last member who can make changes (`last_holder`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}": {
      "delete": {
        "tags": [
          "Organizations"
        ],
        "operationId": "deleteOrgResource",
        "summary": "Delete an organization",
        "description": "Schedules the organization's deletion, in 7 days (owners only; `confirm` is its name exactly as shown, or its ID if it has none). Until then mail keeps flowing and any owner can cancel; every owner is told at once and daily. Then K8 HQ stops its mail and sign-in and deletes everything in it for good, releases its domains and gives each owner a receipt. Bound to the action by per-action confirmation (`org.delete`) once that exists; a recent passkey until then.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `org.delete`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.\n\n**Personal agent contract (conditional).** Schedule organization deletion with the exact confirmation. This is an accepted scheduling decision, not purge completion. The system continues deletion after app disconnection; Owners can still cancel during the pending period. A recent Owner departure conflicts. The response contains the original accepted status and RFC 3339 deleteAt time. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.deleteOrgResource`. Permissions: `org.delete`. Unattended-risk acknowledgment: required. Receipt: `organization-deletion-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `organization.status`, `organization.deleteAt`. Agent input: [AgentConfirmationInput](#schema-AgentConfirmationInput). Agent result: [AgentOrganizationDeletionResult](#schema-AgentOrganizationDeletionResult).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-k8hq-delete-confirm",
            "in": "header",
            "required": false,
            "description": "Exact typed confirmation, UTF-8 percent-encoded (encodeURIComponent), decoded once; maximum 4096 encoded bytes. Use a bodyless DELETE. Input metadata, not authorization. Do not combine deletion headers with any body. JSON bodies remain supported for direct requests.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionDeleteOrgResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentConfirmationInput"
                  }
                ]
              },
              "example": {
                "confirm": "Porter Design Studio"
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "The name doesn't match (`confirm_name`), or its deletion is already scheduled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 400
                            },
                            "code": {
                              "enum": [
                                "invalid"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Only an owner can (`owner_only`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 403
                            },
                            "code": {
                              "enum": [
                                "forbidden",
                                "approval_required"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "200": {
            "description": "Scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionDeleteOrgResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentOrganizationDeletionResult"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "An owner left, was removed or was demoted in the last 7 days (`owner_left_recently`): try again once 7 days have passed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          }
        },
        "x-k8hq-confirm-kind": "org.delete",
        "x-k8hq-confirm": "org.delete",
        "x-k8hq-actions": [
          {
            "id": "setup.deleteOrgResource",
            "permissions": [
              "org.delete"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "organization-deletion-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "organization.status",
              "organization.deleteAt"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/domains/{domain}": {
      "delete": {
        "tags": [
          "Domains"
        ],
        "operationId": "removeDomainResource",
        "summary": "Remove a domain",
        "description": "Removes a domain from the organization, for members with `domains.manage`, typing the domain to confirm. Refused while the organization has addresses there (`addresses_left`; [List a domain's addresses](https://api.k8hq.com/setup/docs/domains#domainAddressesResource) shows them) unless `removeAddresses` is true, which also needs `inbox.addresses.manage` across the organization: they're removed first. From the request on the domain takes no new addresses. Then a job, within minutes: the addresses stop receiving (mail to them is refused like mail to an unknown address), its sending setup goes (its SES identity is deleted, or only unlinked when another organization also lists the domain), its claim is released so another organization may add it, its fee stops, and the owners are told, with the DNS records they can delete. Removing its last proven or verified domain means the organization's invitations can't make accounts until it has one again. An organization removes at most 10 inboxes and domains a day (`removal_limit`). K8 HQ's own domains are never removed (`platform_domain`). Bound to the action by per-action confirmation (`domain.remove`) once that exists; a recent passkey until then.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `domain.remove`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-k8hq-delete-confirm",
            "in": "header",
            "required": false,
            "description": "Exact typed confirmation, UTF-8 percent-encoded (encodeURIComponent), decoded once; maximum 4096 encoded bytes. Use a bodyless DELETE. Input metadata, not authorization. Do not combine deletion headers with any body. JSON bodies remain supported for direct requests.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "x-k8hq-remove-addresses",
            "in": "header",
            "required": false,
            "description": "Domain only: strict true or false. Requires x-k8hq-delete-confirm and no body. Omitted means false.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "string",
                    "description": "The domain, typed."
                  },
                  "removeAddresses": {
                    "type": "boolean",
                    "description": "Remove the organization's addresses at the domain with it (default false: refused while there are any)."
                  }
                },
                "required": [
                  "confirm"
                ]
              },
              "example": {
                "confirm": "example.com",
                "removeAddresses": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Its removal started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string",
                      "description": "The domain, lowercase."
                    },
                    "jobId": {
                      "type": "string",
                      "description": "The job removing it (`job_...`); asking again while it runs returns the same one.",
                      "pattern": "^job_"
                    }
                  },
                  "required": [
                    "domain",
                    "jobId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The typed domain doesn't match (`confirm_name`), or invalid input (`invalid`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The organization doesn't list the domain (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "It still has addresses (`addresses_left`), it's one of K8 HQ's own domains (`platform_domain`), or it's being removed already (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "429": {
            "description": "The organization removed 10 inboxes and domains today (`removal_limit`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm-kind": "domain.remove",
        "x-k8hq-confirm": "domain.remove"
      },
      "patch": {
        "tags": [
          "Domains"
        ],
        "operationId": "setDomainPlanResource",
        "summary": "Change how a domain's fee is paid",
        "description": "Sets the domain's fee plan. The fee covers the domain's setup and monitoring and a share of running the service. `monthly`: $12 a year (about $1 a month), charged a day at a time at each day's report (about 00:00 UTC) for the domains verified and not being removed at that moment. `yearly`: $10 a year, charged from the organization's credit at verification and on each anniversary, and not refunded if the domain is removed or moves to another organization before the year ends; if the credit is under $10 then, the domain stays monthly until its next anniversary and the owners are told. A change takes effect at the next anniversary (moving to monthly: once no paid year covers the day). Needs domains.manage and billing.pay, and a passkey used in the last few minutes.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `domain.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly"
                    ],
                    "description": "How the domain's fee is paid."
                  }
                },
                "required": [
                  "plan"
                ]
              },
              "example": {
                "plan": "yearly"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain, with its plan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    }
                  },
                  "required": [
                    "domain"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "The domain is being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "domain.change"
      }
    },
    "/v1/organizations/{orgId}/domains/{domain}/addresses": {
      "get": {
        "tags": [
          "Domains"
        ],
        "operationId": "domainAddressesResource",
        "summary": "List a domain's addresses",
        "description": "The organization's addresses at a domain, in any of its inboxes, for members with `domains.manage`: removing the domain needs them gone first, or removed with it. Deleted addresses aren't listed.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Its addresses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string",
                      "description": "The domain, lowercase."
                    },
                    "addresses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "address": {
                            "type": "string",
                            "description": "The address as written (`*@domain` is its catch-all)."
                          },
                          "inboxId": {
                            "type": "string",
                            "description": "The inbox (`ibx_...`).",
                            "pattern": "^ibx_"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "disabled"
                            ],
                            "description": "`disabled`: it refuses mail already."
                          },
                          "removing": {
                            "type": "boolean",
                            "description": "Its inbox is being removed (it refuses mail already)."
                          }
                        },
                        "required": [
                          "address",
                          "inboxId",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "domain",
                    "addresses"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The organization doesn't list the domain (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/inboxes/{inboxId}": {
      "delete": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "deleteInboxResource",
        "summary": "Remove an inbox",
        "description": "Removes an inbox, for members with `containers.delete` (owners and admins), typing its name or one of its addresses (or the label you see it by) to confirm. It's closed at once: its addresses refuse mail exactly like addresses that don't exist, nothing is stored in it or sent from it, nobody can open it (mail apps' tokens for it stop working), and rules acting only on it are paused. Its content (mail, folders, forwards, settings, keys, everyone's access) is deleted for good at `purgeAt`, 7 days later, or within minutes if it holds no mail; until then any owner can keep it ([Keep an inbox](#cancelInboxDeletion)). Then its addresses stay reserved to the organization: for 7 days only an owner can put one on another inbox. The owners and its members are told. Copies of deleted mail in backups can't be read and are gone after about 6 weeks. Members' personal notice inboxes and the DMARC reports inbox aren't removed this way (`inbox_kept`). An organization removes at most 10 inboxes and domains a day (`removal_limit`). Bound to the action by per-action confirmation (`inbox.delete`) once that exists; a recent passkey until then.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `container.delete`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.\n\n**Personal agent contract (conditional).** Schedule removal of the exact inbox. The committed receipt is scheduling acceptance, not current pending state or purge completion. The system continues after app disconnection; the existing human cancellation path remains available during the grace period. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.deleteInboxResource`. Permissions: `containers.delete`. Unattended-risk acknowledgment: required. Receipt: `inbox-removal-v1`. Status fields: `id`, `action`, `state`, `resources.inboxId`. Agent input: [AgentConfirmationInput](#schema-AgentConfirmationInput). Agent result: [AgentRemovalReceipt](#schema-AgentRemovalReceipt).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inboxId",
            "in": "path",
            "required": true,
            "description": "inboxId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-k8hq-delete-confirm",
            "in": "header",
            "required": false,
            "description": "Exact typed confirmation, UTF-8 percent-encoded (encodeURIComponent), decoded once; maximum 4096 encoded bytes. Use a bodyless DELETE. Input metadata, not authorization. Do not combine deletion headers with any body. JSON bodies remain supported for direct requests.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionDeleteInboxResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentConfirmationInput"
                  }
                ]
              },
              "example": {
                "confirm": "hello@example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Closed; its purge is scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionDeleteInboxResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentRemovalReceipt"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "400": {
            "description": "The typed confirmation doesn't match (`confirm_name`), or invalid input (`invalid`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 400
                            },
                            "code": {
                              "enum": [
                                "invalid"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "404": {
            "description": "No such inbox in the organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 404
                            },
                            "code": {
                              "enum": [
                                "not_found"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "It's a member's personal notice inbox or the DMARC reports inbox, which aren't removed this way (`inbox_kept`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "429": {
            "description": "The organization removed 10 inboxes and domains today (`removal_limit`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm-kind": "inbox.delete",
        "x-k8hq-confirm": "container.delete",
        "x-k8hq-actions": [
          {
            "id": "setup.deleteInboxResource",
            "permissions": [
              "containers.delete"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "inbox-removal-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.inboxId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/inboxes/removals": {
      "get": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "inboxRemovalsResource",
        "summary": "List inbox removals",
        "description": "The organization's inboxes waiting for their purge, which an owner can still keep; for members with `containers.delete` (owners and admins).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Waiting removals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "inboxId": {
                            "type": "string",
                            "description": "The inbox (`ibx_...`).",
                            "pattern": "^ibx_"
                          },
                          "purgeAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When its content is deleted for good."
                          },
                          "label": {
                            "type": "string",
                            "description": "Its name, or its first address."
                          },
                          "addresses": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Its addresses (refusing mail meanwhile)."
                          },
                          "requestedBy": {
                            "type": "string",
                            "description": "Who asked (`mem_...`)."
                          }
                        },
                        "required": [
                          "inboxId",
                          "purgeAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "removals"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/boards/{boardId}": {
      "delete": {
        "tags": [
          "Boards"
        ],
        "operationId": "deleteBoardResource",
        "summary": "Remove a board",
        "description": "Removes a task board, for members with `containers.delete` (owners and admins), typing its name to confirm. It's closed at once: nobody can open it and no change lands in it. Its content (items, their versions, comments and history, its links, settings, keys and everyone's access) is deleted for good at `purgeAt`, 7 days later, or within minutes if it holds no item; until then any owner can keep it ([Keep a board](#cancelBoardDeletion)). Links to its items from other boards go with it. The owners and its members are told, and the owners are reminded daily until then. Copies of deleted content in backups can't be read and are gone after about 6 weeks. An organization removes at most 10 inboxes, boards and domains a day (`removal_limit`). Bound to the action by per-action confirmation (`board.delete`) once that exists; a recent passkey until then.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `container.delete`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.\n\n**Personal agent contract (conditional).** Schedule removal of the exact board. The committed receipt is scheduling acceptance, not current pending state or purge completion. The system continues after app disconnection; the existing human cancellation path remains available during the grace period. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.deleteBoardResource`. Permissions: `containers.delete`. Unattended-risk acknowledgment: required. Receipt: `task-board-removal-v1`. Status fields: `id`, `action`, `state`, `resources.boardId`. Agent input: [AgentConfirmationInput](#schema-AgentConfirmationInput). Agent result: [AgentRemovalReceipt](#schema-AgentRemovalReceipt).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "boardId",
            "in": "path",
            "required": true,
            "description": "boardId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-k8hq-delete-confirm",
            "in": "header",
            "required": false,
            "description": "Exact typed confirmation, UTF-8 percent-encoded (encodeURIComponent), decoded once; maximum 4096 encoded bytes. Use a bodyless DELETE. Input metadata, not authorization. Do not combine deletion headers with any body. JSON bodies remain supported for direct requests.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionDeleteBoardResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentConfirmationInput"
                  }
                ]
              },
              "example": {
                "confirm": "Development"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Closed; its purge is scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionDeleteBoardResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentRemovalReceipt"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "400": {
            "description": "The typed confirmation doesn't match (`confirm_name`), or invalid input (`invalid`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 400
                            },
                            "code": {
                              "enum": [
                                "invalid"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "404": {
            "description": "No such board in the organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 404
                            },
                            "code": {
                              "enum": [
                                "not_found"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "An item was added to the empty board meanwhile, so its removal needs the 7-day wait: ask again (`board_changed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "The organization removed 10 inboxes, boards and domains today (`removal_limit`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm-kind": "board.delete",
        "x-k8hq-confirm": "container.delete",
        "x-k8hq-actions": [
          {
            "id": "setup.deleteBoardResource",
            "permissions": [
              "containers.delete"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "task-board-removal-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.boardId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/boards/removals": {
      "get": {
        "tags": [
          "Boards"
        ],
        "operationId": "boardRemovalsResource",
        "summary": "List board removals",
        "description": "The organization's boards waiting for their purge, which an owner can still keep; for members with `containers.delete` (owners and admins).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Waiting removals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "boardId": {
                            "type": "string",
                            "description": "The board (`brd_...`).",
                            "pattern": "^brd_"
                          },
                          "purgeAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When its content is deleted for good."
                          },
                          "name": {
                            "type": "string",
                            "description": "Its name."
                          },
                          "requestedBy": {
                            "type": "string",
                            "description": "Who asked (`mem_...`)."
                          }
                        },
                        "required": [
                          "boardId",
                          "purgeAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "removals"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/forms/{formId}": {
      "delete": {
        "tags": [
          "Forms"
        ],
        "operationId": "deleteFormResource",
        "summary": "Remove a form",
        "description": "Removes a form (design note 0019 section 11), for members with `containers.delete` (owners and admins), typing its name to confirm. It stops taking responses at once and nobody can open it. Its responses, definitions, settings, keys and everyone's access are deleted for good at `purgeAt`, 7 days later, or within minutes if it has no response; until then any owner can keep it ([Keep a form](#cancelFormDeletion)). Its public address then answers that the form was removed (410, for 90 days). Copies of its responses already put in an inbox stay there. The owners and its members are told, and the owners are reminded daily until then. Copies of deleted content in backups can't be read and are gone after about 6 weeks. An organization removes at most 10 inboxes, boards, forms and domains a day (`removal_limit`). Bound to the action by per-action confirmation (`form.delete`) once that exists; a recent passkey until then.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `container.delete`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.\n\n**Personal agent contract (conditional).** Schedule removal of the exact form. The committed receipt is scheduling acceptance, not current pending state or purge completion. The system continues after app disconnection; the existing human cancellation path remains available during the grace period. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.deleteFormResource`. Permissions: `containers.delete`. Unattended-risk acknowledgment: required. Receipt: `form-removal-v1`. Status fields: `id`, `action`, `state`, `resources.formId`. Agent input: [AgentConfirmationInput](#schema-AgentConfirmationInput). Agent result: [AgentRemovalReceipt](#schema-AgentRemovalReceipt).",
        "security": [
          {
            "session": []
          },
          {
            "personalCredential": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "description": "formId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-k8hq-delete-confirm",
            "in": "header",
            "required": false,
            "description": "Exact typed confirmation, UTF-8 percent-encoded (encodeURIComponent), decoded once; maximum 4096 encoded bytes. Use a bodyless DELETE. Input metadata, not authorization. Do not combine deletion headers with any body. JSON bodies remain supported for direct requests.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "$ref": "#/components/parameters/AgentSessionIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionDeleteFormResourceInput"
                  },
                  {
                    "$ref": "#/components/schemas/AgentConfirmationInput"
                  }
                ]
              },
              "example": {
                "confirm": "Development"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Closed; its purge is scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionDeleteFormResourceResult"
                    },
                    {
                      "$ref": "#/components/schemas/AgentRemovalReceipt"
                    }
                  ]
                }
              }
            },
            "headers": {
              "operation-id": {
                "required": false,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Required for a successful personal agent change. Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            }
          },
          "400": {
            "description": "The typed confirmation doesn't match (`confirm_name`), or invalid input (`invalid`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 400
                            },
                            "code": {
                              "enum": [
                                "invalid"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/AgentSessionUnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/AgentSessionForbiddenCreateBoardResource"
          },
          "404": {
            "description": "No such board in the organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 404
                            },
                            "code": {
                              "enum": [
                                "not_found"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "An item was added to the empty board meanwhile, so its removal needs the 7-day wait: ask again (`board_changed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/AgentProblem"
                        },
                        {
                          "properties": {
                            "status": {
                              "const": 409
                            },
                            "code": {
                              "enum": [
                                "conflict"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "The organization removed 10 inboxes, boards and domains today (`removal_limit`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/AgentSessionUnavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm-kind": "form.delete",
        "x-k8hq-confirm": "container.delete",
        "x-k8hq-actions": [
          {
            "id": "setup.deleteFormResource",
            "permissions": [
              "containers.delete"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "form-removal-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.formId"
            ]
          }
        ],
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": false
      }
    },
    "/v1/organizations/{orgId}/forms/removals": {
      "get": {
        "tags": [
          "Forms"
        ],
        "operationId": "formRemovalsResource",
        "summary": "List form removals",
        "description": "The organization's forms waiting for their purge, which an owner can still keep; for members with `containers.delete` (owners and admins).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Waiting removals.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "formId": {
                            "type": "string",
                            "description": "The board (`frm_...`).",
                            "pattern": "^frm_"
                          },
                          "purgeAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When its content is deleted for good."
                          },
                          "name": {
                            "type": "string",
                            "description": "Its name."
                          },
                          "requestedBy": {
                            "type": "string",
                            "description": "Who asked (`mem_...`)."
                          },
                          "requestedAttribution": {
                            "$ref": "#/components/schemas/Attribution"
                          }
                        },
                        "required": [
                          "formId",
                          "purgeAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "removals"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/domains/{domain}/connect-info": {
      "get": {
        "tags": [
          "Domains"
        ],
        "operationId": "connectInfoResource",
        "summary": "One-click DNS setup: what the domain's DNS host offers",
        "description": "Looks up whether the domain's DNS host supports Domain Connect (its `_domainconnect` TXT record and settings) and has K8 HQ's templates, and which of them fit the domain now (`available`). Unsupported hosts answer `supported: false`: add the records yourself. Answers are kept for a few minutes. Needs `domains.manage`.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "What one-click setup the domain's DNS host offers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "supported": {
                      "type": "boolean"
                    },
                    "providerName": {
                      "type": "string",
                      "description": "The DNS host's name, e.g. GoDaddy."
                    },
                    "services": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "boolean"
                      },
                      "description": "Each step the DNS host has K8 HQ's template for."
                    },
                    "available": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "mail-verify",
                          "mail-setup",
                          "mail-dmarc",
                          "mail-from"
                        ],
                        "description": "`mail-verify`: the TXT record that proves the organization controls the domain (a pending domain). `mail-setup`: the three DKIM CNAMEs and K8 HQ's sender merged into the SPF record (a proven or verified domain). `mail-dmarc`: a DMARC record in monitoring mode (`p=none`) with reports to `dmarc@` the domain (a verified domain with no DMARC record). `mail-from`: the MX and SPF records of the domain's MAIL FROM name (a verified domain whose MAIL FROM name has no other records). Moving mail (MX) isn't offered yet."
                      },
                      "description": "The steps that fit the domain now."
                    },
                    "providerId": {
                      "type": "string",
                      "description": "The DNS host's Domain Connect provider ID. Links are made only for hosts K8 HQ has enabled; others list nothing in `available`."
                    }
                  },
                  "required": [
                    "supported",
                    "services",
                    "available"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The organization has no such domain, or one-click setup is off (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The domain is being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/billing/fallback": {
      "put": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "setFallbackResource",
        "summary": "Change the fallback",
        "description": "Turns the payer's fallback on or off and sets its chunk and monthly cap. Only the payer can: it's their own balance. Every owner is told.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `billing.fallback`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fallback": {
                    "$ref": "#/components/schemas/Fallback"
                  }
                },
                "required": [
                  "fallback"
                ]
              },
              "example": {
                "fallback": {
                  "on": true,
                  "chunk": 1,
                  "cap": 20
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "description": "They don't pay for it (`not_payer`), or aren't an owner.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "200": {
            "description": "The fallback as stored.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orgId": {
                      "type": "string",
                      "description": "The organization (`org_...`).",
                      "pattern": "^org_"
                    },
                    "fallback": {
                      "$ref": "#/components/schemas/Fallback"
                    }
                  },
                  "required": [
                    "orgId",
                    "fallback"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "410": {
            "description": "The organization is being deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Billing changed meanwhile: look again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "x-k8hq-confirm": "billing.fallback"
      }
    },
    "/v1/organizations/{orgId}/domains/{domain}/health-checks": {
      "post": {
        "tags": [
          "Health"
        ],
        "operationId": "domainHealthResource",
        "summary": "Check a domain's health",
        "description": "The domain's items for the organization's Health page (design note 0023), for members with `domains.manage`: whether it's proven and signs its mail, where its mail is delivered (MX), its list of allowed senders (SPF), its reports instruction (DMARC) and whether the reports reach K8 HQ, and an old provider's leftover records. Each item has a status (`ok`, `attention`, `action`, `not_yet`, `cant_check`), plain words, and the exact records to add, replace or delete.\n\nOnly the organization's own domains are looked up, and of a domain not yet proven only its nameservers. Lookups are DNS only, through K8 HQ's resolver; what they find is reused for 10 minutes (`cached`), and `fresh` (Check again) looks again once the last check is a minute old (`againAt`). Each call is billed to the organization as 8 `api.requests`.\n\nA check of a domain whose mail goes to another provider, and never came to K8 HQ, starts the moving checklist (`/v1/orgs/move`).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fresh": {
                    "type": "boolean",
                    "description": "Check again: look the domain up again if the last check is over a minute old."
                  }
                },
                "required": []
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain's items.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "health": {
                      "$ref": "#/components/schemas/DomainHealth"
                    }
                  },
                  "required": [
                    "health"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "404": {
            "description": "Not a domain of this organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "It's being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/mail-move": {
      "get": {
        "tags": [
          "Health"
        ],
        "operationId": "getMoveResource",
        "summary": "The moving checklist",
        "description": "The organization's move to K8 HQ, if one was started (design note 0023 section 3.7), for members with `domains.manage`: the domain, the old provider, the steps ticked and the old provider's mail delivery records (the way back). Steps K8 HQ can see for itself aren't stored; the app shows them as they are. `move` is null when no move was started (or one ended over 30 days ago).",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The move.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MoveInfo"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Health"
        ],
        "operationId": "changeMoveResource",
        "summary": "Change the moving checklist",
        "description": "Starts a move (`start`, with the `domain` and the old `provider`), changes its provider, ticks or unticks a step the person does themselves (`test`, `copy`, `ttl`, `catchup`, `devices`, `cancel`, `finish`), answers what else sends mail as the organization (`senders`, empty for nothing), or finishes or stops it. Each change is an `org.settings.changed` event (setting `move`). No passkey is needed: the checklist changes nothing about mail or access. A finished or stopped move is kept 30 days. Supply the displayed `version`; stale changes return `409 move_changed`. Later edits do not extend retained history, and a completed checklist cannot be reopened: start a new checklist.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "move": {
                    "$ref": "#/components/schemas/MoveChange"
                  }
                },
                "required": [
                  "move"
                ]
              },
              "example": {
                "move": {
                  "action": "tick",
                  "step": "copy"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The move now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MoveInfo"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "404": {
            "description": "Not a domain of this organization (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Someone else changed it meanwhile (`move_changed`): read it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/health/monitors": {
      "get": {
        "tags": [
          "Health"
        ],
        "operationId": "healthMonitorsResource",
        "summary": "The Health monitors",
        "description": "Read retained scheduled DNS drift, incoming-mail, outbound bounces and credit monitor observations, with at most 35 days of counts, statuses and public DNS changes. Domain findings require domains.manage; incoming mail and bounces require org.events.read. This read performs no DNS/provider checks. Missing observations mean not checked yet; failed checks are explicit. Each call counts as 4 api.requests, paid by K8 HQ while the organization is read-only. Bounces retains seven-day delivery-event counts, rates with known denominators, distinct tenant BOUNCE suppression counts and actual warning/pause state. Its daily check retries failures from 11 UTC, and sending incidents or known infrastructure problems hold it. Existing sending notices are its only immediate notices. DNS Health Action-needed notices are sent immediately after confirmation and copied to configured destinations; digest delivery is not available. Credit and its retained 35-day history require billing.view. availableNano and whole forecast days are exact integer strings; absent days mean no defensible forecast. Credit retries unsuccessful daily checks without completing that date, and adds no duplicate billing notice. Own mail-app observations are available to every current member, including ordinary members; owner role never grants another person’s activity. Only current live canonical IMAP/SMTP passwords are eligible. Daily sampled 14-day activity is anchored to last use, with a 24–48 hour grace period, confirmation on successive dates and retirement after 14 quiet days. Failed or incomplete checks remain retryable. App activity never produces organization events, notices or alarms. Spam and refused-mail counts require a current incoming-mail grant on a live organization inbox, including a zero-access inbox; ownership alone is insufficient. Counts distinguish committed inbox deliveries into Spam, spam or malware DATA refusals per organization, and unknown-address recipient attempts. Missing or partial dates never count as zero. The baseline uses at least 14 complete dates within the preceding 28 dates, excluding the judged date. A count must exceed both 20 and three times the exact median on successive complete dates to raise attention. Refused spam or malware is informational; unknown-address findings stay on the Health page. Volume never creates Action-needed notices or immediate alerts. Trends retain the last 35 completed UTC dates.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The monitors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MonitorItem"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/organizations/{orgId}/billing/agent-budget": {
      "get": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "getAgentBudget",
        "summary": "Read an explicit monthly agent spending cap",
        "description": "Only a current, unsuspended human organization Owner can use this control. Apps, administrators and billing.pay gain no financial authority. Caps are finite exact unsigned decimal USD strings with at most nine fractional digits and int64 nanodollar bounds. Zero permits no positive charge; absent caps deny chargeable agent work. A credential cap must fit within the current organization cap. Credential targets resolve to an immutable personal credential or refresh-family subject, shared across access-token rotation. Atomic board mutations are the first financial admission consumer; other chargeable workflows remain held. These human Owner controls remain separate from spending.limit.self, an explicitly declared, Owner-approved and personally acknowledged own-cap grant implemented only behind the external-agent feature gates. Legacy credentials and broad administration gain no financial authority. Publication and activation remain held. Holds stay assigned to their original UTC month until confirmed settlement. The response distinguishes an unset cap from explicit zero.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The exact orgId target."
          }
        ],
        "responses": {
          "200": {
            "description": "The explicit cap, or explicit=false and version=0 when unset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetCap"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed; Allow identifies supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "setAgentBudget",
        "summary": "Configure an explicit monthly agent spending cap",
        "description": "Only a current, unsuspended human organization Owner can use this control. Apps, administrators and billing.pay gain no financial authority. Caps are finite exact unsigned decimal USD strings with at most nine fractional digits and int64 nanodollar bounds. Zero permits no positive charge; absent caps deny chargeable agent work. A credential cap must fit within the current organization cap. Credential targets resolve to an immutable personal credential or refresh-family subject, shared across access-token rotation. Atomic board mutations are the first financial admission consumer; other chargeable workflows remain held. These human Owner controls remain separate from spending.limit.self, an explicitly declared, Owner-approved and personally acknowledged own-cap grant implemented only behind the external-agent feature gates. Legacy credentials and broad administration gain no financial authority. Publication and activation remain held. Holds stay assigned to their original UTC month until confirmed settlement.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `agent_budget.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The exact orgId target."
          },
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "responses": {
          "200": {
            "description": "The explicit cap, or explicit=false and version=0 when unset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetCap"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed; Allow identifies supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountUSD": {
                    "type": "string",
                    "pattern": "^[0-9]+(\\.[0-9]{1,9})?$"
                  }
                },
                "required": [
                  "amountUSD"
                ]
              }
            }
          }
        },
        "x-k8hq-confirm": "agent_budget.change"
      }
    },
    "/v1/organizations/{orgId}/billing/agent-budget/credentials/{credentialId}": {
      "get": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "getCredentialBudget",
        "summary": "Read an explicit monthly agent spending cap",
        "description": "Only a current, unsuspended human organization Owner can use this control. Apps, administrators and billing.pay gain no financial authority. Caps are finite exact unsigned decimal USD strings with at most nine fractional digits and int64 nanodollar bounds. Zero permits no positive charge; absent caps deny chargeable agent work. A credential cap must fit within the current organization cap. Credential targets resolve to an immutable personal credential or refresh-family subject, shared across access-token rotation. Atomic board mutations are the first financial admission consumer; other chargeable workflows remain held. These human Owner controls remain separate from spending.limit.self, an explicitly declared, Owner-approved and personally acknowledged own-cap grant implemented only behind the external-agent feature gates. Legacy credentials and broad administration gain no financial authority. Publication and activation remain held. Holds stay assigned to their original UTC month until confirmed settlement. The response distinguishes an unset cap from explicit zero.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The exact orgId target."
          },
          {
            "name": "credentialId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The exact credentialId target."
          }
        ],
        "responses": {
          "200": {
            "description": "The explicit cap, or explicit=false and version=0 when unset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetCap"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed; Allow identifies supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Organization billing"
        ],
        "operationId": "setCredentialBudget",
        "summary": "Configure an explicit monthly agent spending cap",
        "description": "Only a current, unsuspended human organization Owner can use this control. Apps, administrators and billing.pay gain no financial authority. Caps are finite exact unsigned decimal USD strings with at most nine fractional digits and int64 nanodollar bounds. Zero permits no positive charge; absent caps deny chargeable agent work. A credential cap must fit within the current organization cap. Credential targets resolve to an immutable personal credential or refresh-family subject, shared across access-token rotation. Atomic board mutations are the first financial admission consumer; other chargeable workflows remain held. These human Owner controls remain separate from spending.limit.self, an explicitly declared, Owner-approved and personally acknowledged own-cap grant implemented only behind the external-agent feature gates. Legacy credentials and broad administration gain no financial authority. Publication and activation remain held. Holds stay assigned to their original UTC month until confirmed settlement.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `agent_budget.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The exact orgId target."
          },
          {
            "name": "credentialId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The exact credentialId target."
          },
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "responses": {
          "200": {
            "description": "The explicit cap, or explicit=false and version=0 when unset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetCap"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Current Owner authority or organization lifecycle changed; recapture before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed; Allow identifies supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amountUSD": {
                    "type": "string",
                    "pattern": "^[0-9]+(\\.[0-9]{1,9})?$"
                  }
                },
                "required": [
                  "amountUSD"
                ]
              }
            }
          }
        },
        "x-k8hq-confirm": "agent_budget.change"
      }
    },
    "/v1/organizations/{orgId}/domains/{domain}/mail-from": {
      "get": {
        "tags": [
          "Domains"
        ],
        "operationId": "getDomainMailFrom",
        "summary": "Get a domain's MAIL FROM",
        "description": "The domain's custom MAIL FROM: the subdomain its mail is sent from in SMTP (where bounces return), the MX and SPF records it needs, Amazon SES's verdict, and the names that could be chosen instead, each checked in the domain's DNS now. A name is free when it has no CNAME, MX, TXT or address records, or only the ones MAIL FROM needs. Needs domains.manage.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "200": {
            "description": "The domain's MAIL FROM and the names it could use.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mailFrom": {
                      "$ref": "#/components/schemas/MailFrom"
                    }
                  },
                  "required": [
                    "mailFrom"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The domain is being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Domains"
        ],
        "operationId": "setDomainMailFrom",
        "summary": "Choose a domain's MAIL FROM",
        "description": "Chooses the name the domain's MAIL FROM uses. Another name than the current one must be free in the domain's DNS now (409 `mail_from_in_use` otherwise); it's checked again here. A verified domain sends with it once Amazon SES finds its records (see the domain's `mailFrom.records`); until then mail goes with SES's own MAIL FROM, as before. Needs domains.manage and a passkey used in the last few minutes.\n\nNeeds a passkey confirmation of this change (`x-k8hq-confirm`: `domain.change`). Until confirmations are enforced, a passkey sign-in in the last five minutes also works.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "orgId resource identifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "description": "domain resource identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mailFrom": {
                    "type": "string",
                    "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$",
                    "description": "The subdomain label, e.g. `bounce`."
                  }
                },
                "required": [
                  "mailFrom"
                ]
              },
              "example": {
                "mailFrom": "bounce"
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "200": {
            "description": "The domain, with its MAIL FROM.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "$ref": "#/components/schemas/Domain"
                    }
                  },
                  "required": [
                    "domain"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The name is in use in the domain's DNS (`mail_from_in_use`), or the domain is being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-confirm": "domain.change"
      }
    },
    "/v1/health/senders/confirm": {
      "post": {
        "tags": [
          "Health"
        ],
        "operationId": "confirmDmarcSender",
        "summary": "Confirm a sender sends the organization's mail",
        "description": "Marks a sender from a verified domain's DMARC reports (one of the domain's Health `senders`, seen in the last 90 days) as one that sends the organization's mail: \"This service sends our mail\". Only Health's judgments change: the sender's mail, where the reports attribute it with a passing SPF or DKIM check for the sender's own domain, counts in the domain's own-mail pass rate, for the days already kept too. 404 `sender_unknown` for a sender the domain's reports haven't named in 90 days. Needs domains.manage.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string",
                    "description": "The sender as Health names it: a known service (`Mailchimp`) or a domain (`example-hosting.net`)."
                  }
                },
                "required": [
                  "orgId",
                  "domain",
                  "name"
                ]
              },
              "example": {
                "orgId": "org_01JABCDEFGHJKMNPQRSTVWXYZ0",
                "domain": "example.com",
                "name": "Mailchimp"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The sender isn't in the domain's DMARC reports of the last 90 days (`sender_unknown`), or the organization doesn't list the domain (`not_found`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The name is in use in the domain's DNS (`mail_from_in_use`), or the domain is being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/health/senders/unconfirm": {
      "post": {
        "tags": [
          "Health"
        ],
        "operationId": "unconfirmDmarcSender",
        "summary": "Undo a sender's confirmation",
        "description": "Undoes a confirmation: the sender's mail no longer counts as the organization's own on Health. Nothing to undo is not an error. Needs domains.manage.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "description": "The organization (`org_...`).",
                    "pattern": "^org_"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string",
                    "description": "The sender as Health names it: a known service (`Mailchimp`) or a domain (`example-hosting.net`)."
                  }
                },
                "required": [
                  "orgId",
                  "domain",
                  "name"
                ]
              },
              "example": {
                "orgId": "org_01JABCDEFGHJKMNPQRSTVWXYZ0",
                "domain": "example.com",
                "name": "Mailchimp"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "The name is in use in the domain's DNS (`mail_from_in_use`), or the domain is being removed (`domain_removing`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-k8hq-step-up": true
      }
    },
    "/v1/organizations/{orgId}/shared-spam-reports": {
      "put": {
        "tags": [
          "Organizations"
        ],
        "operationId": "setSharedSpamReports",
        "summary": "Help improve spam filtering",
        "description": "Allows this organization's Spam reports to help other customers' filters. Off by default. Only an owner with a passkey used in the last five minutes can change it. Enabling is refused while unavailable (403 shared_spam_unavailable) or if any mail inbox is readable only with members' own keys (403 zero_access). Turning it off saves a withdrawal request in the same transaction, including when enabling is unavailable or the organization is read-only. Asking for the current value changes nothing. A later opt-in does not cancel an earlier withdrawal request or share old feedback. This changes contribution only; receiving shared scores does not require it.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Organization ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The saved setting and latest withdrawal request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharedSpamReportsSettings"
                },
                "example": {
                  "available": false,
                  "enabled": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedStepUp"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "402": {
            "description": "The organization is read-only (`read_only`, design note 0024): it has been out of credit for 60 days, so this can't be changed until an owner adds credit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. The Allow header lists supported methods.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The organization is being deleted or has been deleted (`org_closed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The setting changed meanwhile. Reload and try again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-k8hq-step-up": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "enabled"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "description": "Allow new shared Spam reports."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/health/dismissals": {
      "post": {
        "tags": [
          "Health"
        ],
        "operationId": "dismissHealthFinding",
        "summary": "Dismiss a Needs-attention finding",
        "description": "Saves the item key and current fingerprint after re-reading Health with the caller's current permissions. Action-needed and other statuses cannot be dismissed (400). An old fingerprint is refused (409 health_changed); a hidden or unknown monitor item is refused (403). Needs a person's own session, with no recent-passkey requirement. Domain items need domains.manage; each monitor needs the same access as its Health read, including billing.view, owner-only and current inbox-grant checks. Organization findings are dismissed for everyone who can see them. Own app passwords, sign-in and recovery findings remain personal. Each forwarding finding identifies one forward, and its dismissal is shared with everyone who can read that inbox. Owner and sending findings are visible only to organization owners. No access is granted by a dismissal.\n\nHealth reads retain the item with dismissed=true so the app can hide it without changing checklist facts. The flag is absent after its fingerprint changes, and always absent for Action-needed items. Fingerprints ignore poll times and history; monitor fingerprints also ignore daily count changes, but include finding reasons, changed entries and unfamiliar senders. Organization and domain replacement invalidate prior fingerprints. The permission-filtered re-read uses the existing Health check charge (8 api.requests for domain checks, 4 for monitors); saving the dismissal has no extra charge.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/contentSha256"
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "The organization.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "dismissal": {
                    "$ref": "#/components/schemas/HealthDismissal"
                  }
                },
                "required": [
                  "dismissal"
                ]
              },
              "example": {
                "dismissal": {
                  "source": "monitor",
                  "key": "dmarc_senders:example.com",
                  "fingerprint": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "404": {
            "description": "The organization does not list this domain.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The finding changed (health_changed), the domain is being removed, or the organization is closing.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "description": "The organization is read-only; add credit before making changes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "200": {
            "description": "Dismissed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/inboxes/zero-access/status": {
      "post": {
        "tags": [
          "Inboxes"
        ],
        "operationId": "zeroAccessStatus",
        "summary": "Read an inbox's encryption status",
        "description": "Read the inbox's zero-access switch, signed holder records and encryption progress. Requires a person's current organization membership and inbox access, with no passkey confirmation. This read stays available when new zero-access changes are turned off. Pending text names a removed person, an agent you disconnected, or both. K8 HQ keeps accepting new mail while encryption waits for an authorized device. Before switching, send or cancel stored outgoing mail. The switch preflight reports scheduled_messages with count and detail when any remain; this includes short Undo holds and retained failed or uncertain sends.",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "schemaVersion": {
                    "type": "integer",
                    "const": 1
                  },
                  "orgId": {
                    "type": "string",
                    "pattern": "^org_"
                  },
                  "inboxId": {
                    "type": "string",
                    "pattern": "^ibx_"
                  },
                  "afterHead": {
                    "type": "string",
                    "description": "Base64 holder-chain head already held by the client."
                  }
                },
                "required": [
                  "schemaVersion",
                  "orgId",
                  "inboxId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The inbox's current encryption status, with signed records for the client to verify.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "orgId": {
                      "type": "string"
                    },
                    "inboxId": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "compatible",
                        "marked",
                        "switching",
                        "zero-access"
                      ]
                    },
                    "encryption": {
                      "$ref": "#/components/schemas/ZeroAccessEncryption"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "orgId",
                    "inboxId",
                    "mode",
                    "encryption"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "description": "The status is too large to return (conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organizations/{orgId}/billing/agent-budget/own": {
      "put": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "setOwnAgentBudget",
        "summary": "Set only this personal app family’s explicit monthly cap.",
        "description": "**Personal agent contract (conditional).** Set only this personal app family’s explicit monthly cap. Requires the declared spending.limit.self grant, current Owner financial approval and per-organization financial acknowledgment. An explicit current organization cap must cover the exact amount. Requires the app’s declared financial grant and the person’s separate financial consent. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `billing.setOwnAgentBudget`. Permissions: the separate financial grant. Unattended-risk acknowledgment: not required. Receipt: `atomic-own-budget-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`. Agent input: [AgentOwnCapInput](#schema-AgentOwnCapInput). Agent result: [AgentOwnCapResult](#schema-AgentOwnCapResult).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "billing.setOwnAgentBudget",
            "permissions": [],
            "unattendedAcknowledgment": false,
            "receipt": {
              "profile": "atomic-own-budget-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentOwnCapInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOwnCapResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/inboxes/{inboxId}/settings": {
      "patch": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "setInboxSettings",
        "summary": "Disable inbox behavior only.",
        "description": "**Personal agent contract (conditional).** Disable inbox behavior only. Sending, forwarding and background work cannot be enabled by this action. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `content.setInboxSettings`. Permissions: `inbox.settings.change`. Unattended-risk acknowledgment: required. Receipt: `atomic-inbox-edit-v1`. Status fields: `id`, `action`, `state`, `resources.inboxId`. Agent input: [AgentInboxSettingsInput](#schema-AgentInboxSettingsInput). Agent result: [AgentOK](#schema-AgentOK).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "content.setInboxSettings",
            "permissions": [
              "inbox.settings.change"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-inbox-edit-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.inboxId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentinboxId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentInboxSettingsInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOK"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/changes/{changeId}/decline": {
      "post": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "cancelMemberChange",
        "summary": "Cancel only a pending role or removal request made by the authorizing person through this app.",
        "description": "**Personal agent contract (conditional).** Cancel only a pending role or removal request made by the authorizing person through this app. Requires the current permission for that request kind: members.roles.assign for role, members.remove for removal, with unattended acknowledgment. Recovery or another requester’s change cannot be canceled. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `org.member.change.cancel`. Permissions: `members.roles.assign` for a role request or `members.remove` for a removal request. Unattended-risk acknowledgment: required. Receipt: `atomic-member-change-cancel-v1`. Status fields: `id`, `action`, `state`, `resources.changeId`. Agent input: [AgentEmptyInput](#schema-AgentEmptyInput). Agent result: [AgentOK](#schema-AgentOK).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "org.member.change.cancel",
            "permissions": [],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-member-change-cancel-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.changeId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentchangeId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentEmptyInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOK"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/inboxes/{inboxId}/addresses": {
      "post": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "addInboxAddress",
        "summary": "Add one ordinary address to the exact inbox.",
        "description": "**Personal agent contract (conditional).** Add one ordinary address to the exact inbox. The domain must be verified in this organization; current inbox and domain authority still apply. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.addInboxAddress`. Permissions: `inbox.addresses.manage`. Unattended-risk acknowledgment: required. Receipt: `atomic-inbox-address-v1`. Status fields: `id`, `action`, `state`, `resources.inboxId`. Agent input: [AgentAddressInput](#schema-AgentAddressInput). Agent result: [AgentOK](#schema-AgentOK).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.addInboxAddress",
            "permissions": [
              "inbox.addresses.manage"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-inbox-address-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.inboxId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentinboxId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentAddressInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOK"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "description": "Current resource state prevents this change. Branch on the stable code.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 409
                        },
                        "code": {
                          "enum": [
                            "conflict",
                            "address_reserved"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/rules": {
      "post": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "createRule",
        "summary": "Create a rule under current consent, approval and access to every referenced inbox and event type.",
        "description": "**Personal agent contract (conditional).** Create a rule under current consent, approval and access to every referenced inbox and event type. The app remains its sponsor; loss of authority pauses the rule and notifies Owners. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.createRule`. Permissions: `rules.manage`. Unattended-risk acknowledgment: not required. Receipt: `atomic-rule-create-v1`. Status fields: `id`, `action`, `state`, `resources.organizationId`, `resources.ruleId`. Agent input: [AgentCreateRuleInput](#schema-AgentCreateRuleInput). Agent result: [AgentRuleResult](#schema-AgentRuleResult).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.createRule",
            "permissions": [
              "rules.manage"
            ],
            "unattendedAcknowledgment": false,
            "receipt": {
              "profile": "atomic-rule-create-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.organizationId",
              "resources.ruleId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreateRuleInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRuleResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "412": {
            "description": "The rule changed; read its current version before a new intent. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 412
                        },
                        "code": {
                          "enum": [
                            "version_mismatch",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/inboxes/{inboxId}/addresses/{address}/move": {
      "post": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "moveInboxAddress",
        "summary": "Move the path address to another inbox in this organization.",
        "description": "**Personal agent contract (conditional).** Move the path address to another inbox in this organization. Requires current authority over both inboxes and the address. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.moveInboxAddress`. Permissions: `inbox.addresses.manage`. Unattended-risk acknowledgment: required. Receipt: `atomic-inbox-address-move-v1`. Status fields: `id`, `action`, `state`, `resources.inboxId`, `resources.toInboxId`. Agent input: [AgentMoveAddressInput](#schema-AgentMoveAddressInput). Agent result: [AgentOK](#schema-AgentOK).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.moveInboxAddress",
            "permissions": [
              "inbox.addresses.manage"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-inbox-address-move-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.inboxId",
              "resources.toInboxId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentinboxId"
          },
          {
            "$ref": "#/components/parameters/Agentaddress"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentMoveAddressInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOK"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/rules/{ruleId}/pause": {
      "post": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "pauseRule",
        "summary": "Pause the exact rule.",
        "description": "**Personal agent contract (conditional).** Pause the exact rule. Only ifVersion is accepted; a positive value must match. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.pauseRule`. Permissions: `rules.manage`. Unattended-risk acknowledgment: not required. Receipt: `atomic-rule-pause-v1`. Status fields: `id`, `action`, `state`, `resources.ruleId`. Agent input: [AgentRuleVersionInput](#schema-AgentRuleVersionInput). Agent result: [AgentRuleResult](#schema-AgentRuleResult).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.pauseRule",
            "permissions": [
              "rules.manage"
            ],
            "unattendedAcknowledgment": false,
            "receipt": {
              "profile": "atomic-rule-pause-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.ruleId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentruleId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRuleVersionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRuleResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "412": {
            "description": "The rule changed; read its current version before a new intent. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 412
                        },
                        "code": {
                          "enum": [
                            "version_mismatch",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/inboxes/{inboxId}/addresses/{address}": {
      "delete": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "removeInboxAddress",
        "summary": "Remove the path address with no request body.",
        "description": "**Personal agent contract (conditional).** Remove the path address with no request body. Current inbox and domain authority still apply. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.removeInboxAddress`. Permissions: `inbox.addresses.manage`. Unattended-risk acknowledgment: required. Receipt: `atomic-inbox-address-v1`. Status fields: `id`, `action`, `state`, `resources.inboxId`. Agent result: [AgentOK](#schema-AgentOK).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.removeInboxAddress",
            "permissions": [
              "inbox.addresses.manage"
            ],
            "unattendedAcknowledgment": true,
            "receipt": {
              "profile": "atomic-inbox-address-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.inboxId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentinboxId"
          },
          {
            "$ref": "#/components/parameters/Agentaddress"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOK"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/rules/{ruleId}/resume": {
      "post": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "resumeRule",
        "summary": "Resume the exact rule after checking live consent and access again, retaining the sponsoring app.",
        "description": "**Personal agent contract (conditional).** Resume the exact rule after checking live consent and access again, retaining the sponsoring app. Only ifVersion is accepted; a positive value must match. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.resumeRule`. Permissions: `rules.manage`. Unattended-risk acknowledgment: not required. Receipt: `atomic-rule-resume-v1`. Status fields: `id`, `action`, `state`, `resources.ruleId`. Agent input: [AgentRuleVersionInput](#schema-AgentRuleVersionInput). Agent result: [AgentRuleResult](#schema-AgentRuleResult).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.resumeRule",
            "permissions": [
              "rules.manage"
            ],
            "unattendedAcknowledgment": false,
            "receipt": {
              "profile": "atomic-rule-resume-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.ruleId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentruleId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRuleVersionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRuleResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "412": {
            "description": "The rule changed; read its current version before a new intent. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 412
                        },
                        "code": {
                          "enum": [
                            "version_mismatch",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    },
    "/v1/organizations/{orgId}/rules/{ruleId}": {
      "patch": {
        "tags": [
          "Personal agent actions (conditional)"
        ],
        "operationId": "updateRule",
        "summary": "Change editable rule fields only.",
        "description": "**Personal agent contract (conditional).** Change editable rule fields only. A positive ifVersion must match. Current consent, approval and referenced resource access are checked. Required header: `Idempotency-Key` (16 to 128 visible ASCII characters). Success returns `operation-id`; keep the same key and input to retry. Current access is checked again on every retry. The service requires explicit operator activation. Action `setup.updateRule`. Permissions: `rules.manage`. Unattended-risk acknowledgment: not required. Receipt: `atomic-rule-update-v1`. Status fields: `id`, `action`, `state`, `resources.ruleId`. Agent input: [AgentUpdateRuleInput](#schema-AgentUpdateRuleInput). Agent result: [AgentRuleResult](#schema-AgentRuleResult).",
        "security": [
          {
            "personalCredential": []
          }
        ],
        "x-k8hq-actions": [
          {
            "id": "setup.updateRule",
            "permissions": [
              "rules.manage"
            ],
            "unattendedAcknowledgment": false,
            "receipt": {
              "profile": "atomic-rule-update-v1",
              "inputDigest": "k8hq-agent-input-v1"
            },
            "statusProjectionFields": [
              "id",
              "action",
              "state",
              "resources.ruleId"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentorgId"
          },
          {
            "$ref": "#/components/parameters/AgentruleId"
          },
          {
            "$ref": "#/components/parameters/AgentidempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUpdateRuleInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original accepted result. Replay under current authority returns the same operation ID without repeating the effect.",
            "headers": {
              "operation-id": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^aop_"
                },
                "description": "Durable operation ID from the committed receipt. Same-key recovery retains this ID. It is neither the input digest nor permission to act."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRuleResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Agentinvalid"
          },
          "401": {
            "$ref": "#/components/responses/Agentunauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Agentforbidden"
          },
          "404": {
            "$ref": "#/components/responses/Agentnot_found"
          },
          "409": {
            "$ref": "#/components/responses/Agentconflict"
          },
          "412": {
            "description": "The rule changed; read its current version before a new intent. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 412
                        },
                        "code": {
                          "enum": [
                            "version_mismatch",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The command does not meet the action limits or current requirements. The existing generic failure helper may return unavailable at this status; use the HTTP status as well.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 422
                        },
                        "code": {
                          "enum": [
                            "rejected",
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Agentunavailable"
          }
        },
        "x-k8hq-agent-feature-gates": [
          "K8HQ_AGENT_APPS=on",
          "K8HQ_AGENT_CONSENT=on",
          "K8HQ_AGENT_API=on"
        ],
        "x-k8hq-agent-only": true
      }
    }
  },
  "components": {
    "securitySchemes": {
      "session": {
        "type": "apiKey",
        "in": "header",
        "name": "x-k8hq-token",
        "description": "A person's own session (its access token from the Sign-in API)."
      },
      "personalCredential": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal access or copied credential (k8a1_ or k8m1_), transported by the bearer-preserving agent edge. Human sessions and service credentials do not establish this app financial grant."
      },
      "serviceCredential": {
        "type": "http",
        "scheme": "bearer",
        "description": "An independent program credential (k8s1_...), accepted only for the conditional organization services read with current org.view authority."
      }
    },
    "parameters": {
      "contentSha256": {
        "name": "x-amz-content-sha256",
        "in": "header",
        "required": true,
        "description": "The body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail).",
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "AgentidempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 16,
          "maxLength": 128,
          "pattern": "^[!-~]+$"
        },
        "description": "One visible-ASCII key per logical change. Keep the exact input and key after a lost reply and across access-token rotation. The namespace is organization, authorizing person and personal connection. Changed input with the same key conflicts; a new key is a new intent."
      },
      "AgentorgId": {
        "name": "orgId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "AgentinboxId": {
        "name": "inboxId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "AgentbookId": {
        "name": "bookId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "AgentboardId": {
        "name": "boardId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "AgentformId": {
        "name": "formId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "AgentruleId": {
        "name": "ruleId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "AgentchangeId": {
        "name": "changeId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact organization or resource in this personal connection."
      },
      "Agentaddress": {
        "name": "address",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Email address encoded as one URL path segment."
      },
      "AgentdeleteConfirm": {
        "name": "x-k8hq-delete-confirm",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 4096
        },
        "description": "Exact confirmation, UTF-8 percent-encoded and decoded once. Use a bodyless DELETE, or send the JSON confirmation body without this header. Combining header and body is invalid. This is input, not authorization."
      },
      "AgentSessionIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 16,
          "maxLength": 128,
          "pattern": "^[!-~]+$"
        },
        "description": "Required for personal agent credentials: 16 to 128 visible ASCII characters. A session does not need this header. Keep the exact key and input when retrying after an unknown reply."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed or invalid input (`invalid`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "No session, it expired, or it isn't a person's own session (`unauthenticated`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "UnauthorizedStepUp": {
        "description": "No session or it expired, or isn't a person's own (`unauthenticated`); or its passkey confirmation is more than 5 minutes old (`step_up_required`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Forbidden": {
        "description": "They may not do this in the organization, or a browser origin other than the web app's (`forbidden`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unavailable": {
        "description": "A temporary problem (`unavailable`); retry.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "UnauthorizedConfirm": {
        "description": "No session or it expired (`unauthenticated`), or confirm this change with your passkey (`confirmation_required`; until confirmations are enforced, `step_up_required` with `action`, which a passkey use in the last 5 minutes also satisfies): the answer carries the `action` to confirm (see the sign-in API's confirmations).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Agentinvalid": {
        "description": "Malformed input or a missing or malformed Idempotency-Key.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 400
                    },
                    "code": {
                      "enum": [
                        "invalid"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentunauthenticated": {
        "description": "Unknown, expired, revoked or incorrectly transported personal credential.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 401
                    },
                    "code": {
                      "enum": [
                        "unauthenticated"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentread_only": {
        "description": "The organization cannot add resources now.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 402
                    },
                    "code": {
                      "enum": [
                        "read_only"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentforbidden": {
        "description": "This connection needs approval, or current authority, resource access, consent or required acknowledgment is missing.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 403
                    },
                    "code": {
                      "enum": [
                        "forbidden",
                        "approval_required"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentnot_found": {
        "description": "The organization is outside this connection, or the target does not exist.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 404
                    },
                    "code": {
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentconflict": {
        "description": "The key names a different command, or current resource state prevents the change.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 409
                    },
                    "code": {
                      "enum": [
                        "conflict"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentversion_mismatch": {
        "description": "The rule changed; read its current version before a new intent.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 412
                    },
                    "code": {
                      "enum": [
                        "version_mismatch"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentrejected": {
        "description": "The command does not meet the action limits or current requirements.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 422
                    },
                    "code": {
                      "enum": [
                        "rejected"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentunavailable": {
        "description": "Authority changed, the attempt expired, a provider is unavailable or the outcome is uncertain. Retry the same input and key under fresh current authority.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 503
                    },
                    "code": {
                      "enum": [
                        "unavailable"
                      ]
                    }
                  }
                }
              ]
            }
          }
        },
        "headers": {
          "retry-after": {
            "schema": {
              "type": "string"
            },
            "description": "When present, seconds to wait before retrying the same key."
          }
        }
      },
      "Agentaddress_reserved": {
        "description": "This address was freed recently and cannot be added to another inbox yet.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 409
                    },
                    "code": {
                      "enum": [
                        "address_reserved"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentaddress_taken": {
        "description": "This address already routes to an inbox.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 409
                    },
                    "code": {
                      "enum": [
                        "address_taken"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentdomain_unverified": {
        "description": "An address domain is not ready in this organization.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 409
                    },
                    "code": {
                      "enum": [
                        "domain_unverified"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentmail_off": {
        "description": "Mail must be enabled before adding email addresses.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 409
                    },
                    "code": {
                      "enum": [
                        "mail_off"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentno_credit": {
        "description": "The organization needs credit before adding an inbox.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 402
                    },
                    "code": {
                      "enum": [
                        "no_credit"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentservice_disabled": {
        "description": "The required service is disabled.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 403
                    },
                    "code": {
                      "enum": [
                        "service_disabled"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Agentorg_closed": {
        "description": "The organization is being deleted.",
        "content": {
          "application/problem+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/AgentProblem"
                },
                {
                  "properties": {
                    "status": {
                      "const": 410
                    },
                    "code": {
                      "enum": [
                        "org_closed"
                      ]
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "AgentSessionBadRequest": {
        "description": "Malformed or invalid input (`invalid`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Problem"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 400
                        },
                        "code": {
                          "enum": [
                            "invalid"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          }
        }
      },
      "AgentSessionUnauthorizedConfirm": {
        "description": "No session or it expired (`unauthenticated`), or confirm this change with your passkey (`confirmation_required`; until confirmations are enforced, `step_up_required` with `action`, which a passkey use in the last 5 minutes also satisfies): the answer carries the `action` to confirm (see the sign-in API's confirmations).",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Problem"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 401
                        },
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          }
        }
      },
      "AgentSessionForbidden": {
        "description": "They may not do this in the organization, or a browser origin other than the web app's (`forbidden`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Problem"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 403
                        },
                        "code": {
                          "enum": [
                            "forbidden",
                            "approval_required",
                            "service_disabled"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          }
        }
      },
      "AgentSessionUnavailable": {
        "description": "A temporary problem (`unavailable`); retry.",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Problem"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 503
                        },
                        "code": {
                          "enum": [
                            "unavailable"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          }
        },
        "headers": {
          "retry-after": {
            "schema": {
              "type": "string"
            },
            "description": "Required for a successful personal agent change. When present, seconds to wait before retrying the same key.",
            "required": false
          }
        }
      },
      "AgentSessionUnauthorizedStepUp": {
        "description": "No session or it expired, or isn't a person's own (`unauthenticated`); or its passkey confirmation is more than 5 minutes old (`step_up_required`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Problem"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 401
                        },
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          }
        }
      },
      "AgentSessionForbiddenCreateBoardResource": {
        "description": "They may not do this in the organization, or a browser origin other than the web app's (`forbidden`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Problem"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentProblem"
                    },
                    {
                      "properties": {
                        "status": {
                          "const": 403
                        },
                        "code": {
                          "enum": [
                            "forbidden",
                            "approval_required"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "DnsRecord": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "TXT",
              "CNAME",
              "MX"
            ]
          },
          "name": {
            "type": "string",
            "description": "The record's full name, such as `_k8hq.example.com`, `abc._domainkey.example.com` or `bounce.example.com`."
          },
          "value": {
            "type": "string",
            "description": "Its value: `k8hq-verify=...` for the TXT, `....dkim.amazonses.com` for the DKIM CNAMEs, Amazon SES's feedback host and SPF for a MAIL FROM."
          },
          "found": {
            "type": "boolean",
            "description": "The last check saw it (for DKIM: Amazon SES's verdict on all three)."
          },
          "priority": {
            "type": "integer",
            "description": "An MX record's priority."
          }
        },
        "required": [
          "type",
          "name",
          "value",
          "found"
        ],
        "description": "A DNS record the domain needs.",
        "additionalProperties": false
      },
      "Domain": {
        "type": "object",
        "properties": {
          "mailMoved": {
            "type": "boolean",
            "description": "On the domains list, Health's current MX check says mail comes only to K8 HQ. False when it goes elsewhere, is split, or cannot be checked."
          },
          "mailMovedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When Health first saw mail come to K8 HQ, when known and mailMoved is true."
          },
          "domain": {
            "type": "string",
            "description": "The domain name, lowercase."
          },
          "domainId": {
            "type": "string",
            "description": "Its ID (`dom_...`).",
            "pattern": "^dom_"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "proven",
              "verified"
            ],
            "description": "`pending`: add the TXT record (proves the organization controls the domain); `proven`: add the three DKIM CNAMEs (lets K8 HQ sign its mail); `verified`: ready for addresses."
          },
          "expiresAt": {
            "type": "string",
            "description": "For `pending`: when the domain is released unless its TXT record is found.",
            "format": "date-time"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DnsRecord"
            },
            "description": "The records to add at the domain's DNS host: the TXT first, then the DKIM CNAMEs once it's proven."
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "txt",
                "dkim",
                "txt_other"
              ]
            },
            "description": "What the last check didn't find. `txt_other` (with `txt`): `_k8hq` has a K8 HQ proof record that isn't this organization's, so another K8 HQ organization asked for the domain; if the person approved a one-click setup request, it wasn't theirs."
          },
          "removing": {
            "type": "boolean",
            "description": "It's being removed (Remove a domain): it takes no new addresses, and its records aren't shown any more."
          },
          "plan": {
            "type": "string",
            "enum": [
              "monthly",
              "yearly"
            ],
            "description": "The fee covers the domain's setup and monitoring and a share of running the service. How it is paid: `monthly` ($12 a year, charged daily) or `yearly` ($10 a year at verification and each anniversary, not refunded). Change it with Change how a domain's fee is paid."
          },
          "disputed": {
            "type": "boolean",
            "description": "The domain's owner disputed this claim through a one-click proof notice's release link: nothing is sent from it until K8 HQ has looked into it (the owners are told what to do). Mail still arrives."
          },
          "mailFrom": {
            "$ref": "#/components/schemas/MailFrom",
            "description": "For a verified domain: its custom MAIL FROM and the records it needs. Apart from `records` and `missing`: mail is sent either way."
          }
        },
        "required": [
          "domain",
          "domainId",
          "status",
          "records",
          "plan"
        ],
        "description": "A domain of the organization's and its DNS setup.",
        "additionalProperties": false
      },
      "Org": {
        "type": "object",
        "properties": {
          "orgId": {
            "type": "string",
            "description": "The organization (`org_...`).",
            "pattern": "^org_"
          },
          "name": {
            "type": "string",
            "description": "Its display name; empty if it has none yet."
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "developer",
              "admin",
              "owner"
            ]
          },
          "manageDomains": {
            "type": "boolean",
            "description": "They may list, add and check its domains (`domains.manage`)."
          },
          "createInboxes": {
            "type": "boolean",
            "description": "They may create inboxes (`containers.create`, `inbox.addresses.manage` and `domains.manage`)."
          },
          "rename": {
            "type": "boolean",
            "description": "They may rename it (`org.settings.change`: owners, not admins)."
          },
          "mailHost": {
            "type": "string",
            "description": "The organization's mail hostname, for its domains' MX record (`10 <mailHost>`) and for mail apps' incoming (IMAP, port 993, SSL/TLS) and outgoing (SMTP, port 587 with STARTTLS or port 465 with SSL/TLS) server. Assigned once and never changed; it keeps working if the organization moves. Absent if it couldn't be assigned just now (the next listing retries): use `mx1.k8hq.net`, `imap.k8hq.net` and `smtp.k8hq.net` meanwhile.",
            "pattern": "^[a-z][a-z2-9]{5}\\.mx\\.k8hq\\.net$",
            "example": "k7m3qd.mx.k8hq.net"
          },
          "deleteAt": {
            "type": "string",
            "format": "date-time",
            "description": "Its deletion is scheduled for then; any owner can cancel it until then. Organizations being deleted aren't listed."
          },
          "removeInboxes": {
            "type": "boolean",
            "description": "May remove inboxes (`containers.delete`: owners and admins)."
          },
          "domainPlans": {
            "type": "boolean",
            "description": "Whether they may change how its domains' fees are paid (Change how a domain's fee is paid): domains.manage and billing.pay."
          },
          "createBoards": {
            "type": "boolean",
            "description": "They may create task boards (`boards.create`: owners by default)."
          },
          "createForms": {
            "type": "boolean",
            "description": "They may create forms (`forms.create`: owners by default)."
          },
          "services": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "manageServices": {
            "type": "boolean"
          },
          "createBooks": {
            "type": "boolean",
            "description": "Can create self-only contact books while Contacts is enabled."
          },
          "icon": {
            "type": "string",
            "description": "Optional organization icon as a normalized PNG data URL."
          },
          "createEmptyInboxes": {
            "type": "boolean",
            "description": "May create an inbox with no addresses (`containers.create`); `createInboxes` also needs the address and domain permissions."
          }
        },
        "required": [
          "orgId",
          "name",
          "role",
          "manageDomains",
          "createInboxes",
          "rename",
          "removeInboxes",
          "domainPlans"
        ],
        "description": "An organization the person is in, and what they may set up there.",
        "additionalProperties": false
      },
      "Problem": {
        "type": "object",
        "description": "An RFC 9457 problem detail.",
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "This page's explanation of the code."
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid",
              "unauthenticated",
              "step_up_required",
              "forbidden",
              "not_found",
              "org_limit",
              "new_payer_orgs",
              "unproven_domain",
              "domain_taken",
              "domain_limit",
              "domain_expired",
              "domain_unverified",
              "address_taken",
              "confirm_name",
              "owner_only",
              "not_payer",
              "conflict",
              "org_closed",
              "owner_left_recently",
              "nonpayment_deletion",
              "inbox_kept",
              "addresses_left",
              "platform_domain",
              "domain_removing",
              "removal_limit",
              "removal_started",
              "address_reserved",
              "address_not_moved",
              "connect_unsupported",
              "connect_not_now",
              "dmarc_exists",
              "rate_limited",
              "release_invalid",
              "release_expired",
              "no_credit",
              "read_only",
              "unavailable",
              "ticket_inbox",
              "ticket_members",
              "service_disabled",
              "service_unknown",
              "version_mismatch",
              "last_holder",
              "book_read_only",
              "move_changed",
              "mail_from_in_use",
              "mail_has_addresses",
              "mail_off",
              "sender_unknown",
              "confirmation_required",
              "confirmation_invalid",
              "confirmation_expired",
              "confirmation_mismatch",
              "confirmation_used",
              "needs_person",
              "health_changed",
              "shared_spam_unavailable",
              "zero_access",
              "client_outdated"
            ],
            "description": "Stable: branch on this.",
            "x-enumDescriptions": {
              "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](https://api.k8hq.com/auth/docs#stepUpBegin) 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](https://api.k8hq.com/setup/docs/domains#domainAddressesResource) 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).",
              "unavailable": "503 (also 405, a method other than POST): a temporary problem; retry with backoff.",
              "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.",
              "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.",
              "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.",
              "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.",
              "client_outdated": "426: K8 HQ has been updated. Reload this page."
            }
          },
          "detail": {
            "type": "string",
            "description": "For people; may change."
          },
          "inboxId": {
            "type": "string",
            "pattern": "^ibx_",
            "description": "With `address_not_moved`: the new inbox, which was made empty (and removed again if `discarded`)."
          },
          "discarded": {
            "type": "boolean",
            "description": "With `address_not_moved`: the person's access to the new inbox couldn't be given, so it was removed again; nothing is left to clean up."
          }
        }
      },
      "Fallback": {
        "type": "object",
        "description": "The payer's fallback (design note 0011): when the organization's credit runs low, K8 HQ moves `chunk` dollars at a time of purchased credit from the payer's own balance into it, at most `cap` dollars a calendar month (UTC), and tells the payer and owners as the cap nears.",
        "properties": {
          "on": {
            "type": "boolean"
          },
          "chunk": {
            "type": "integer",
            "description": "Whole US dollars per move: 1 to 10 (default 1).",
            "minimum": 1,
            "maximum": 10
          },
          "cap": {
            "type": "integer",
            "description": "Whole US dollars a month, at least the chunk: 1 to 200 (default 20).",
            "minimum": 1,
            "maximum": 200
          }
        },
        "required": [
          "on",
          "chunk",
          "cap"
        ],
        "additionalProperties": false
      },
      "Settings": {
        "type": "object",
        "description": "An organization's settings as one of its members sees them; owners also see who pays, the fallback and the sending probation.",
        "properties": {
          "orgId": {
            "type": "string",
            "description": "The organization (`org_...`).",
            "pattern": "^org_"
          },
          "name": {
            "type": "string",
            "description": "Its display name; empty if it has none."
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "developer",
              "admin",
              "owner"
            ]
          },
          "mayRename": {
            "type": "boolean",
            "description": "They may rename it (`org.settings.change`)."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "pending_deletion"
            ],
            "description": "`pending_deletion`: its deletion is scheduled for `deleteAt`, and mail keeps flowing until then. An owner's own deletion can be cancelled by any owner; one with `deleteReason` `nonpayment` only by adding credit."
          },
          "deleteAt": {
            "type": "string",
            "format": "date-time",
            "description": "When a pending deletion starts."
          },
          "deleteRequestedBy": {
            "type": "string",
            "description": "Who asked for the deletion: a member (`mem_...`), or `sys_billing` for a nonpayment deletion.",
            "pattern": "^(mem_|sys_)"
          },
          "deleteReason": {
            "type": "string",
            "enum": [
              "nonpayment"
            ],
            "description": "Set for a deletion K8 HQ scheduled because the organization stayed out of credit (design note 0024 step 5, day 180): owners can't cancel it; adding credit stops it, up to the moment it starts."
          },
          "you": {
            "type": "string",
            "description": "A member (`mem_...`).",
            "pattern": "^mem_"
          },
          "owners": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "A member (`mem_...`).",
              "pattern": "^mem_"
            },
            "description": "The owners (owners see them, to hand billing over)."
          },
          "billing": {
            "type": "object",
            "description": "Who pays (owners).",
            "properties": {
              "payer": {
                "type": "string",
                "description": "A member (`mem_...`).",
                "pattern": "^mem_"
              },
              "youPay": {
                "type": "boolean"
              },
              "payerSince": {
                "type": "string",
                "format": "date-time"
              },
              "fallback": {
                "$ref": "#/components/schemas/Fallback"
              },
              "offerTo": {
                "type": "string",
                "description": "A member (`mem_...`).",
                "pattern": "^mem_"
              },
              "offerExpires": {
                "type": "string",
                "format": "date-time"
              },
              "offeredToYou": {
                "type": "boolean",
                "description": "The payer offered billing to you: accept with `/v1/orgs/payer/take`."
              }
            },
            "required": [
              "youPay",
              "fallback",
              "offeredToYou"
            ],
            "additionalProperties": false
          },
          "probation": {
            "type": "object",
            "description": "Sending probation (owners): new senders send to a few recipients a day, more as mail is delivered without complaints. The limit and history belong to the person who pays for the organization, shared by every organization they pay for (organizations without a payer have their own).",
            "properties": {
              "payer": {
                "type": "boolean",
                "description": "The limit, today's count and the history are the payer's, across every organization they pay for."
              },
              "graduated": {
                "type": "boolean",
                "description": "No probation cap any more."
              },
              "throttled": {
                "type": "boolean",
                "description": "Its bounce or complaint rate was too high in the last 7 days: a reduced cap."
              },
              "dailyCap": {
                "type": "integer",
                "description": "Recipients a day (0: no cap)."
              },
              "sentToday": {
                "type": "integer"
              },
              "clean": {
                "type": "integer",
                "description": "Clean deliveries so far (deliveries less 50 per complaint and 5 per hard bounce)."
              },
              "nextStep": {
                "type": "integer",
                "description": "Clean deliveries at which the cap rises (0: none)."
              },
              "handoverCap": {
                "type": "integer",
                "description": "After billing moved to another owner: the previous payer's daily cap, shared with the organizations they pay for, which this organization's sends also count toward until handoverUntil (absent: none)."
              },
              "handoverUntil": {
                "type": "string",
                "format": "date-time"
              },
              "handoverSentToday": {
                "type": "integer",
                "description": "Recipients counted today toward handoverCap, across the previous payer's organizations and this one."
              },
              "orgSentToday": {
                "type": "integer",
                "description": "This organization's own recipients today, counted toward handoverCap or the reduced cap while throttled."
              }
            },
            "required": [
              "payer",
              "graduated",
              "throttled",
              "dailyCap",
              "sentToday",
              "clean",
              "nextStep"
            ],
            "additionalProperties": false
          },
          "icon": {
            "type": "string",
            "description": "Optional organization icon as a normalized PNG data URL."
          },
          "timeZone": {
            "type": "string",
            "description": "An IANA time zone, such as America/New_York or UTC. UTC when unset.",
            "minLength": 1,
            "example": "America/New_York"
          },
          "sharedSpamReports": {
            "$ref": "#/components/schemas/SharedSpamReportsSettings",
            "description": "Owners only."
          },
          "agentPermissionGrowth": {
            "$ref": "#/components/schemas/AgentPermissionGrowthSettings",
            "description": "Owners only, while organization permission growth is available."
          }
        },
        "required": [
          "orgId",
          "name",
          "role",
          "mayRename",
          "status",
          "you",
          "timeZone"
        ],
        "additionalProperties": false
      },
      "Services": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "catalog",
          "services",
          "manageServices"
        ],
        "properties": {
          "catalog": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "description",
                "status",
                "alwaysOn",
                "releaseVersion"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "available",
                    "beta"
                  ]
                },
                "alwaysOn": {
                  "type": "boolean"
                },
                "releaseVersion": {
                  "type": "string"
                }
              }
            }
          },
          "services": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "manageServices": {
            "type": "boolean"
          }
        }
      },
      "HealthRecord": {
        "type": "object",
        "description": "A record to change at the domain's DNS provider.",
        "additionalProperties": false,
        "properties": {
          "do": {
            "type": "string",
            "enum": [
              "add",
              "replace",
              "delete"
            ],
            "description": "Add it, replace the record of its type and name with it, or delete it."
          },
          "type": {
            "type": "string",
            "enum": [
              "MX",
              "TXT",
              "CNAME"
            ]
          },
          "name": {
            "type": "string",
            "description": "The full name (`example.com`, `_dmarc.example.com`)."
          },
          "value": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "description": "MX records' priority."
          }
        },
        "required": [
          "do",
          "type",
          "name",
          "value"
        ]
      },
      "HealthItem": {
        "type": "object",
        "description": "One item of the Health page.",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "proof",
              "dkim",
              "mx",
              "spf",
              "dmarc",
              "leftovers",
              "mail_from"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "attention",
              "action",
              "not_yet",
              "cant_check"
            ]
          },
          "title": {
            "type": "string"
          },
          "text": {
            "type": "string",
            "description": "What it means and what to do, in plain words."
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HealthRecord"
            },
            "description": "The fix: the exact records to change."
          },
          "seen": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The values found (technical details)."
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque finding fingerprint, present only for Needs attention. Send it unchanged when dismissing this item."
          },
          "dismissed": {
            "type": "boolean",
            "description": "Hide this Needs-attention item while true. A changed finding returns without this flag. Action-needed items never have this flag. Items remain in the response so setup checks can still use their status."
          }
        },
        "required": [
          "id",
          "status",
          "title",
          "text"
        ]
      },
      "DomainHealth": {
        "type": "object",
        "description": "A domain's Health items.",
        "additionalProperties": false,
        "properties": {
          "domain": {
            "type": "string"
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When its DNS was looked up."
          },
          "cached": {
            "type": "boolean",
            "description": "The lookups are from an earlier call (`checkedAt`)."
          },
          "againAt": {
            "type": "string",
            "format": "date-time",
            "description": "When `fresh` looks it up again."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "proven",
              "verified"
            ]
          },
          "dnsCompany": {
            "type": "string",
            "description": "Who keeps its DNS, from its nameservers (GoDaddy, Cloudflare...), when K8 HQ knows."
          },
          "mxOurs": {
            "type": "boolean",
            "description": "Its mail comes to K8 HQ, and only to K8 HQ."
          },
          "oldProvider": {
            "type": "string",
            "enum": [
              "microsoft365",
              "proofpoint",
              "godaddy",
              "google",
              "zoho",
              "other"
            ],
            "description": "The mail provider its MX names, when that isn't K8 HQ."
          },
          "mx": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Its MX records as seen (`10 host`)."
          },
          "reportsInbox": {
            "type": "boolean",
            "description": "`dmarc@<domain>` reaches the organization's DMARC reports inbox."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HealthItem"
            }
          }
        },
        "required": [
          "domain",
          "checkedAt",
          "cached",
          "againAt",
          "status",
          "mxOurs",
          "reportsInbox",
          "items"
        ]
      },
      "Move": {
        "type": "object",
        "description": "A move to K8 HQ (the moving checklist).",
        "additionalProperties": false,
        "properties": {
          "domain": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "microsoft365",
              "proofpoint",
              "godaddy",
              "google",
              "zoho",
              "other"
            ]
          },
          "auto": {
            "type": "boolean",
            "description": "Started by itself, by a check that saw the domain's mail going elsewhere."
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "oldMx": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The old provider's MX records as first seen (`0 host`): putting them back undoes the switch."
          },
          "ticked": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "date-time"
            },
            "description": "The steps ticked, and when."
          },
          "senders": {
            "type": "string",
            "description": "What else sends mail as the organization (empty: nothing); absent until answered."
          },
          "finishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "stoppedAt": {
            "type": "string",
            "format": "date-time"
          },
          "domainId": {
            "type": "string",
            "description": "The domain registration this move belongs to."
          }
        },
        "required": [
          "domain",
          "provider",
          "auto",
          "startedAt"
        ]
      },
      "MoveInfo": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "move": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Move"
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "integer",
            "description": "Opaque numeric revision; zero means no stored state. Send the displayed value with each change. A new record gets a fresh JavaScript-safe base after physical expiry."
          }
        },
        "required": [
          "move",
          "version"
        ]
      },
      "MoveChange": {
        "type": "object",
        "description": "One change to the move.",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "start",
              "provider",
              "tick",
              "untick",
              "senders",
              "finish",
              "stop"
            ]
          },
          "domain": {
            "type": "string",
            "description": "`start`: the domain moving."
          },
          "provider": {
            "type": "string",
            "enum": [
              "microsoft365",
              "proofpoint",
              "godaddy",
              "google",
              "zoho",
              "other"
            ],
            "description": "`start` and `provider`: the old provider."
          },
          "step": {
            "type": "string",
            "enum": [
              "test",
              "copy",
              "ttl",
              "catchup",
              "devices",
              "cancel",
              "finish"
            ],
            "description": "`tick` and `untick`. A completed checklist cannot be reopened by unticking finish; start a new checklist."
          },
          "senders": {
            "type": "string",
            "maxLength": 300,
            "description": "`senders`: what else sends mail as the organization (website forms, billing systems); empty for nothing."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The version from GET mail-move (including zero for no move). A stale version returns 409; reload before retrying."
          }
        },
        "required": [
          "action",
          "version"
        ]
      },
      "MonitorItem": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "description": "mail, bounces, credit, spam, refused, dns:<domain>, dmarc:<domain>, dmarc_senders:<domain>, apps:<own app-password ID>, lockouts (owners only) or signin (your own passkey lockouts only). Forwarding keys identify individual forwards; their dismissals are shared with everyone who can read that inbox. Owners and sending findings are visible to organization owners only; passkeys findings describe only the signed-in person and their dismissals are private. Forwarding and transfers are live checklist items limited to current readable inbox grants; transfers include only the caller's own imports and exports. Spam/refused current counts and history require current readable incoming-mail access in this organization."
          },
          "monitor": {
            "type": "string",
            "enum": [
              "dns",
              "dmarc",
              "dmarc_senders",
              "mail",
              "bounces",
              "credit",
              "apps",
              "lockouts",
              "signin",
              "spam",
              "refused",
              "forwarding",
              "transfers",
              "owners",
              "passkeys",
              "sending"
            ]
          },
          "domain": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "attention",
              "action",
              "not_yet",
              "cant_check"
            ]
          },
          "since": {
            "type": "string",
            "description": "The day the status began (YYYY-MM-DD)."
          },
          "finding": {
            "type": "string",
            "description": "DNS, incoming-mail or outbound finding; outbound values are approaching, threshold, warned or paused."
          },
          "text": {
            "type": "string",
            "description": "The status in plain words."
          },
          "held": {
            "type": "boolean",
            "description": "Probably K8 HQ's own problem: nobody is told."
          },
          "noLongerJudged": {
            "type": "boolean"
          },
          "checking": {
            "type": "boolean",
            "description": "A change waits for its second lookup; for dmarc, own mail under 98% on one report day, judged again with the next."
          },
          "fixedOn": {
            "type": "string",
            "description": "The day it last went back to OK. Never set by dmarc_senders, including when a sender stops appearing."
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MonitorDay"
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MonitorChange"
            }
          },
          "bounces": {
            "$ref": "#/components/schemas/BounceObservation"
          },
          "credit": {
            "$ref": "#/components/schemas/CreditObservation"
          },
          "app": {
            "$ref": "#/components/schemas/AppObservation"
          },
          "volume": {
            "$ref": "#/components/schemas/VolumeObservation"
          },
          "unfamiliarSenders": {
            "type": "array",
            "maxItems": 10,
            "description": "dmarc_senders: new, unconfirmed senders with failing mail in the last 7 days, ordered by most failing messages (ties by name).",
            "items": {
              "type": "string"
            }
          },
          "suggestion": {
            "type": "object",
            "additionalProperties": false,
            "description": "dmarc: optional quarantine suggestion when the item is OK, own mail had no failures on the last 14 report days within retained history, no current DNS or authentication problem prevents it, and the stored DNS record has p=none. Nothing changes automatically.",
            "properties": {
              "policy": {
                "type": "string",
                "enum": [
                  "quarantine"
                ]
              },
              "record": {
                "type": "string",
                "description": "Exact replacement TXT value for _dmarc.<domain>, preserving the other tags."
              }
            },
            "required": [
              "policy",
              "record"
            ]
          },
          "sendersUnavailable": {
            "type": "boolean",
            "description": "dmarc: the senders couldn't be read just now, so senders is empty without meaning none."
          },
          "senders": {
            "type": "array",
            "description": "dmarc: the other senders seen in the domain's DMARC reports in the last 90 days, newest first (at most 50).",
            "items": {
              "$ref": "#/components/schemas/SeenSender"
            }
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque finding fingerprint, present only for Needs attention. Send it unchanged when dismissing this item."
          },
          "dismissed": {
            "type": "boolean",
            "description": "Hide this Needs-attention item while true. A changed finding returns without this flag. Action-needed items never have this flag. Items remain in the response so setup checks can still use their status."
          }
        },
        "required": [
          "key",
          "monitor",
          "status",
          "text",
          "history"
        ]
      },
      "SeenSender": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "description": "A known service's name, or the organizational domain of the sending server's reverse DNS. Never an address."
          },
          "firstSeen": {
            "type": "string",
            "description": "When K8 HQ first counted a report naming it (RFC 3339). Empty for a confirmed sender no longer in the reports."
          },
          "lastSeen": {
            "type": "string",
            "description": "When K8 HQ last counted a report naming it (RFC 3339). Empty for a confirmed sender no longer in the reports."
          },
          "confirmed": {
            "type": "boolean",
            "description": "A domain manager confirmed it sends the organization's mail (POST /v1/health/senders/confirm)."
          },
          "service": {
            "type": "boolean",
            "description": "A known sending service: only these can be confirmed (a server's reverse-DNS name is a hint only)."
          }
        },
        "required": [
          "name",
          "firstSeen",
          "lastSeen"
        ]
      },
      "MonitorChange": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "what": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "firstSeen": {
            "type": "string",
            "description": "When first seen (RFC 3339)."
          }
        },
        "required": [
          "what",
          "firstSeen"
        ]
      },
      "MonitorDay": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "day": {
            "type": "string",
            "description": "The day (YYYY-MM-DD)."
          },
          "status": {
            "type": "string",
            "description": "The status that day."
          },
          "values": {
            "type": "object",
            "description": "Daily observed counts and rates; bounces retains seven-day sent, hardBounces, complaints, newSuppressions, optional bounceRate/complaintRate fractions and actual warned/paused flags. Missing dates were not observed. Credit contains CreditObservation fields, with exact string amounts/days; BillingView protects both current and historical observations. Spam/refused retain VolumeObservation fields, with nested counts.spam (committed inbox deliveries into Spam), counts.refused (spam or malware DATA refusals per organization) and counts.unknown (unknown/disabled/deleted RCPT attempts). These are distinct units and are never combined. Dmarc (domains.manage) retains the 7 days ending that day of the domain's own mail (sent from its K8 HQ MAIL FROM domain): messages, passed, reports that day, and rate (percent, rounded down) when the week was complete. Dmarc_senders (domains.manage) retains failingSenders: the number of new, unconfirmed senders failing in the seven days ending that day. Current readable incoming-mail access in the organization protects both volume counts and history; incomplete or missing dates are not zero."
          }
        },
        "required": [
          "day",
          "status"
        ]
      },
      "BounceObservation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Seven UTC dates of recipient delivery-event counts, distinct from the complete tenant list count of newly BOUNCE-suppressed unique addresses. Counts only; no addresses.",
        "properties": {
          "sent": {
            "type": "integer",
            "minimum": 0
          },
          "hardBounces": {
            "type": "integer",
            "minimum": 0
          },
          "complaints": {
            "type": "integer",
            "minimum": 0
          },
          "newSuppressions": {
            "type": "integer",
            "minimum": 0
          },
          "bounceRate": {
            "type": "number",
            "minimum": 0,
            "description": "Fraction of sent recipients; omitted when sent is zero or unknown."
          },
          "complaintRate": {
            "type": "number",
            "minimum": 0,
            "description": "Fraction of sent recipients; omitted when sent is zero or unknown."
          },
          "warned": {
            "type": "boolean"
          },
          "paused": {
            "type": "boolean"
          }
        },
        "required": [
          "sent",
          "hardBounces",
          "complaints",
          "newSuppressions",
          "warned",
          "paused"
        ]
      },
      "CreditObservation": {
        "type": "object",
        "additionalProperties": false,
        "description": "BillingView only. Last known exact server observation; unavailable refresh retains its original observedAt.",
        "properties": {
          "funded": {
            "type": "boolean"
          },
          "low": {
            "type": "boolean"
          },
          "comped": {
            "type": "boolean"
          },
          "topUp": {
            "type": "boolean"
          },
          "availableNano": {
            "type": "string",
            "pattern": "^-?(0|[1-9][0-9]*)$",
            "description": "Exact available credit in nano-dollars, including promo and minus pending."
          },
          "days": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "Whole forecast days; absent when no finite defensible forecast exists."
          },
          "baselineDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "enum": [
              "comped",
              "top_up",
              "never_funded",
              "out",
              "low",
              "no_history",
              "short_baseline",
              "zero_median",
              "short",
              "runway"
            ]
          }
        },
        "required": [
          "funded",
          "low",
          "comped",
          "topUp",
          "availableNano",
          "baselineDays",
          "observedAt",
          "reason"
        ]
      },
      "AppObservation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Private current-owner sampled mail-app activity. No labels, networks, syncing claims or manufactured daily history. The fourteen slots are the only personal history. observedAt is absent until a daily check completes.",
        "properties": {
          "tokenId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "daysUsed": {
            "type": "array",
            "maxItems": 14,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1
            }
          },
          "reason": {
            "type": "string",
            "enum": [
              "learning",
              "periodic",
              "fresh",
              "grace",
              "quiet",
              "retired"
            ]
          }
        },
        "required": [
          "tokenId",
          "createdAt",
          "daysUsed",
          "reason"
        ]
      },
      "VolumeObservation": {
        "type": "object",
        "required": [
          "day",
          "observedAt",
          "complete",
          "baselineDays",
          "spamSurge",
          "refusedSurge",
          "unknownSurge",
          "reason"
        ],
        "properties": {
          "day": {
            "type": "string",
            "format": "date"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "complete": {
            "type": "boolean"
          },
          "counts": {
            "type": "object",
            "required": [
              "spam",
              "refused",
              "unknown"
            ],
            "properties": {
              "spam": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "refused": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "unknown": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            }
          },
          "baselineDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 28
          },
          "spamNormal": {
            "type": "string"
          },
          "refusedNormal": {
            "type": "string"
          },
          "unknownNormal": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "description": "incomplete: the judged date lacks certified whole-date coverage; counts are absent or explicitly qualified partial counts, and no baseline judgment is made. learning: the judged date is complete but fewer than 14 complete preceding dates exist within 28 dates; counts are shown without a surge judgment. observed: the judged date and at least 14 baseline dates are complete, so exact medians and strict surge comparisons are available. baseline_unavailable: the judged date has complete counts, but a baseline read failed; retain dated counts without a new judgment or a Fixed transition."
          },
          "spamSurge": {
            "type": "boolean"
          },
          "refusedSurge": {
            "type": "boolean"
          },
          "unknownSurge": {
            "type": "boolean"
          }
        },
        "description": "Daily inbound counts in distinct units: committed inbox deliveries into Spam, spam or malware DATA refusals per organization, and unknown/disabled/deleted RCPT attempts. Missing or incomplete dates never count as zero. The baseline uses at least 14 complete preceding dates within 28 dates. Normal values are exact rational strings; for example, 15/2 means 7.5. Counts are available before the baseline is ready."
      },
      "Attribution": {
        "type": "object",
        "description": "What authorized a change (change attribution): the person, their token, an agent (an app, K8 or a rule) or K8 HQ. IDs and a token label snapshot only; names are looked up when shown. Board items, history rows, comments and connection records infer missing attribution on read, marked inferred; inference is never stored. Item creation uses createdBy and its creation source; item updates use only updatedBy, with token kind only when the updater identifies a token write. With hideTokenLabels enabled, other ordinary members receive attribution without tokenLabel; tokenId remains visible. The token's person and organization owners and admins retain the label.",
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "person, token, agent or system."
          },
          "memberId": {
            "type": "string",
            "description": "The accountable member (mem_): the person, the person whose token was used, or for whom K8 or an app acted."
          },
          "userId": {
            "type": "string",
            "description": "The accountable user (usr_), only in a person's own scope."
          },
          "tokenId": {
            "type": "string",
            "description": "The token used (tok_)."
          },
          "tokenLabel": {
            "type": "string",
            "description": "The token's label when it acted (a snapshot, cleaned, at most 100 bytes)."
          },
          "agent": {
            "type": "string",
            "description": "For kind agent: app (an external app), k8 (the K8 assistant) or rule (a rule's agent)."
          },
          "agentId": {
            "type": "string",
            "description": "The rule's agent (agt_)."
          },
          "ruleId": {
            "type": "string",
            "description": "The rule (rul_)."
          },
          "appId": {
            "type": "string",
            "description": "The external app's registration (app_)."
          },
          "appVersionId": {
            "type": "string",
            "description": "The app's configuration version (acv_)."
          },
          "connectionId": {
            "type": "string",
            "description": "The personal app connection (cnx_); absent for an organization's service identity."
          },
          "credentialId": {
            "type": "string",
            "description": "The app credential used (tok_)."
          },
          "system": {
            "type": "string",
            "description": "For kind system: the K8 HQ actor (sys_…)."
          },
          "onBehalfOf": {
            "type": "object",
            "description": "Whose standing authorization a system job or rule ran under.",
            "properties": {
              "memberId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              }
            }
          },
          "inferred": {
            "type": "boolean",
            "readOnly": true,
            "description": "True when inferred from a legacy record on read. Never stored or resolved from current token records."
          }
        },
        "additionalProperties": false
      },
      "AgentBudgetCap": {
        "type": "object",
        "properties": {
          "explicit": {
            "type": "boolean"
          },
          "amountUSD": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]{1,9})?$"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "explicit",
          "version"
        ],
        "additionalProperties": false
      },
      "MailFromOption": {
        "type": "object",
        "description": "A name a domain's MAIL FROM could use.",
        "properties": {
          "name": {
            "type": "string",
            "description": "The subdomain label, e.g. `bounce`."
          },
          "host": {
            "type": "string",
            "description": "The full name, e.g. `bounce.example.com`."
          },
          "free": {
            "type": "boolean",
            "description": "Nothing else uses it in the domain's DNS (it has no CNAME, MX, TXT or address records, or only the ones MAIL FROM needs), so it can be chosen."
          },
          "inUse": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "cname",
                "mx",
                "txt",
                "address",
                "unknown"
              ]
            },
            "description": "What the name has already; `unknown` when it couldn't be looked up."
          }
        },
        "required": [
          "name",
          "host",
          "free"
        ],
        "additionalProperties": false
      },
      "MailFrom": {
        "type": "object",
        "description": "A verified domain's custom MAIL FROM: the subdomain its mail is sent from in SMTP, where bounces return, so SPF aligns with the From domain as DKIM does. Until Amazon SES finds its records, mail is sent with SES's own MAIL FROM, as before.",
        "properties": {
          "name": {
            "type": "string",
            "description": "The subdomain label in use, e.g. `bounce`."
          },
          "host": {
            "type": "string",
            "description": "The full name, e.g. `bounce.example.com`."
          },
          "chosen": {
            "type": "boolean",
            "description": "Someone chose it; otherwise it's the default, `bounce`."
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DnsRecord"
            },
            "description": "The records to add at the domain's DNS host: an MX to Amazon SES's feedback host and an SPF TXT."
          },
          "status": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "success",
              "failed",
              "temporary_failure"
            ],
            "description": "Amazon SES's verdict on this name: `none` while it isn't set on the domain yet, `pending` until SES has looked, `success` once mail goes with it."
          },
          "wildcard": {
            "type": "boolean",
            "description": "The domain's DNS answers for any name (a wildcard record), so no name looks free: decide with whoever runs the domain's DNS."
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MailFromOption"
            },
            "description": "The names that could be chosen (`bounce`, `send`, `email`, `mail`, and the current one), each checked in the domain's DNS. Empty in a domain's listing; Get a domain's MAIL FROM checks them."
          },
          "reject": {
            "type": "boolean",
            "description": "Amazon SES refuses the domain's mail while this MAIL FROM isn't working (its MX failure behaviour is to reject), instead of sending it with its own MAIL FROM."
          }
        },
        "required": [
          "name",
          "host",
          "chosen",
          "records",
          "status",
          "options"
        ],
        "additionalProperties": false
      },
      "SharedSpamReportsSettings": {
        "type": "object",
        "description": "Help improve spam filtering: owner consent to share Spam reports. Off by default.",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "Whether enabling shared reports is available. The app hides the setting while false."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the organization allows new shared Spam reports."
          },
          "withdrawalRequestedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the last request to withdraw shared reports was saved. A later opt-in does not cancel that request."
          }
        },
        "required": [
          "available",
          "enabled"
        ]
      },
      "HealthDismissal": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "domain",
              "monitor"
            ]
          },
          "domain": {
            "type": "string",
            "description": "Required for a domain item; its domain name."
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "The domain item id or monitor item key."
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "source",
          "key",
          "fingerprint"
        ]
      },
      "AgentPermissionGrowthSettings": {
        "type": "object",
        "description": "Owner setting for whether apps may add access automatically. Off by default. It overrides personal opt-ins.",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Advances with each change. Queued additions must check this revision and that the setting is on in their commit transaction."
          }
        },
        "required": [
          "enabled",
          "revision"
        ],
        "additionalProperties": false
      },
      "ZeroAccessEncryption": {
        "type": "object",
        "properties": {
          "activeEpoch": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "requiredGeneration": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "securedGeneration": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pendingRequests": {
            "type": "array",
            "description": "People whose removal or suspension still needs an encryption update request to be processed.",
            "items": {
              "type": "object",
              "properties": {
                "cause": {
                  "type": "string"
                },
                "memberId": {
                  "type": "string"
                },
                "requestedAt": {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                }
              },
              "required": [
                "cause",
                "memberId",
                "requestedAt"
              ]
            }
          },
          "agentCauses": {
            "type": "integer",
            "minimum": 0,
            "description": "Agent causes still waiting for an encryption update. A cause counts until its request has a receipt and the generation it requested has been secured. A skipped receipt is already secured. Reads check up to four requests per participating app connection; more requests count as one extra cause until they can be checked."
          },
          "agentsWaiting": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8,
            "description": "Connected apps waiting for a member's device to share a new key after publication. This count never makes encryption pending and never clears an agent cause."
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "pending"
            ],
            "description": "Pending while a requested generation is not secured, a person has an unprocessed request or is no longer authorized to hold the key, or an agent cause is unsecured."
          },
          "progress": {
            "type": "string",
            "enum": [
              "none",
              "waiting_for_device",
              "in_progress"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain status text naming a removed person, a disconnected agent, or both when encryption is pending. Mail keeps arriving during the update."
          }
        },
        "required": [
          "activeEpoch",
          "requiredGeneration",
          "securedGeneration",
          "pendingRequests",
          "agentCauses",
          "agentsWaiting",
          "status",
          "progress",
          "message"
        ],
        "additionalProperties": false
      },
      "AgentOwnCapInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "amountUSD"
        ],
        "properties": {
          "amountUSD": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]{1,9})?$",
            "maxLength": 30,
            "description": "Exact unsigned decimal USD string, at most nine fractional digits and int64 nanodollar bounds; no sign, exponent, floating point, rounding or absent-means-unlimited. Zero allows no positive new charge."
          }
        }
      },
      "AgentOwnCapResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "explicit",
          "amountUSD"
        ],
        "properties": {
          "explicit": {
            "type": "boolean",
            "const": true
          },
          "amountUSD": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]{1,9})?$",
            "maxLength": 30,
            "description": "Exact unsigned decimal USD string, at most nine fractional digits and int64 nanodollar bounds; no sign, exponent, floating point, rounding or absent-means-unlimited. Zero allows no positive new charge."
          }
        }
      },
      "AgentOK": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ]
      },
      "AgentInboxSettingsInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "rulesMaySend": {
            "type": "boolean",
            "const": false
          },
          "forwardingOff": {
            "type": "boolean",
            "const": true
          },
          "memberRulesOff": {
            "type": "boolean",
            "const": true
          },
          "trashAutoDelete": {
            "type": "boolean",
            "const": false
          },
          "spamAutoDelete": {
            "type": "boolean",
            "const": false
          }
        },
        "minProperties": 1
      },
      "AgentAddressInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "address": {
            "type": "string",
            "description": "One ordinary email address."
          }
        },
        "required": [
          "address"
        ]
      },
      "AgentMoveAddressInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "inbox": {
            "type": "string",
            "pattern": "^ibx_",
            "description": "A different inbox in the same organization."
          }
        },
        "required": [
          "inbox"
        ]
      },
      "AgentInboxInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "addresses": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            },
            "description": "Ordinary email addresses, normalized and deduplicated; at most 10 distinct addresses."
          }
        },
        "required": [
          "addresses"
        ]
      },
      "AgentBookInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "members": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "pattern": "^mem_"
            },
            "description": "Omitted or empty means the authorizing member alone (self). Exactly that member after deduplication selects self; every other member set selects shared. All initial members must currently belong to this organization."
          }
        },
        "required": [
          "name"
        ]
      },
      "AgentTaskBoardInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "statuses": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^st_[0-9A-Za-z]{1,26}$"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "todo",
                    "active",
                    "waiting",
                    "done",
                    "closed"
                  ]
                }
              },
              "required": [
                "id",
                "category"
              ]
            },
            "description": "Omitted or empty uses the task board defaults."
          }
        },
        "required": [
          "name"
        ]
      },
      "AgentFormInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "retentionDays": {
            "type": "integer",
            "const": 0,
            "default": 0
          }
        },
        "required": [
          "name"
        ]
      },
      "AgentConfirmationInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "confirm": {
            "type": "string",
            "description": "Exact resource name, address or ID as accepted for this resource. Organization deletion requires its exact name, or its ID if unnamed; book deletion requires its exact name."
          }
        },
        "required": [
          "confirm"
        ]
      },
      "AgentEmptyInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {}
      },
      "AgentRuleVersionInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ifVersion": {
            "type": "integer",
            "minimum": 0,
            "description": "Positive values must match the current rule version; zero or absent does not assert a version."
          }
        }
      },
      "AgentRuleResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ruleId": {
            "type": "string",
            "pattern": "^rul_"
          }
        },
        "required": [
          "ruleId"
        ]
      },
      "AgentInboxResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "inboxId": {
            "type": "string",
            "pattern": "^ibx_"
          }
        },
        "required": [
          "inboxId"
        ]
      },
      "AgentBookResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "bookId": {
            "type": "string",
            "pattern": "^book_"
          }
        },
        "required": [
          "bookId"
        ]
      },
      "AgentBoardResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "boardId": {
            "type": "string",
            "pattern": "^brd_"
          }
        },
        "required": [
          "boardId"
        ]
      },
      "AgentFormResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "formId": {
            "type": "string",
            "pattern": "^frm_"
          }
        },
        "required": [
          "formId"
        ]
      },
      "AgentRemovalReceipt": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^aop_"
          },
          "action": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "const": "committed"
          },
          "resources": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "action",
          "state",
          "resources"
        ]
      },
      "AgentOrganizationDeletionResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string"
          },
          "deleteAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "status",
          "deleteAt"
        ]
      },
      "AgentTemplate": {
        "type": "object",
        "description": "A rule template. App rules may only use actions that stay inside K8 HQ; reply and parse_dmarc_report are refused. Current access to every referenced inbox and event type is checked.",
        "required": [
          "templateVersion",
          "name",
          "triggers",
          "actions"
        ],
        "additionalProperties": false,
        "properties": {
          "templateVersion": {
            "const": 1
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "parameters": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "name",
                "kind"
              ],
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "inbox",
                    "destination",
                    "label",
                    "string",
                    "address",
                    "integer",
                    "endpoint",
                    "boolean"
                  ],
                  "description": "`inbox`: an inbox the rule watches (its events trigger it). `destination`: an inbox that only receives its notices. `address`: one email address, stored lower-cased (as `message.from` has it). `integer`: a whole number from 0 to 1,000,000 (filters read it as `int(params.<name>)`). `endpoint`: an address endpoint ID belonging to the inbox parameter named by `inbox`. `boolean`: the string true or false."
                },
                "description": {
                  "type": "string"
                },
                "default": {
                  "type": "string",
                  "description": "The value used when an install gives none."
                },
                "inbox": {
                  "type": "string",
                  "description": "For endpoint parameters, the name of an inbox parameter whose addresses may be chosen."
                }
              }
            }
          },
          "triggers": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "additionalProperties": false,
              "properties": {
                "type": {
                  "type": "string",
                  "description": "An event type (`GET /event-types`); never an audit-only one."
                },
                "version": {
                  "type": "integer",
                  "description": "The version the filter was written for."
                }
              }
            }
          },
          "filter": {
            "type": "string",
            "maxLength": 4000,
            "description": "A CEL expression that must be true for the rule to act, over `event` (type, subject, container, time, actor, data), `message` for message.* triggers (channel, direction, subject, participants, from, labels, flags, size, endpoints, spam, spamScore) and `params`. Checked when saved: every field it names must exist. Empty matches every triggering event."
          },
          "actions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/AgentRuleAction"
            }
          }
        }
      },
      "AgentWebFlag": {
        "type": "string",
        "enum": [
          "seen",
          "flagged",
          "answered"
        ],
        "description": "The flags the API can change."
      },
      "AgentRuleAction": {
        "type": "object",
        "required": [
          "kind"
        ],
        "additionalProperties": false,
        "description": "One thing a rule does. String fields may name a parameter as `$name`. notifyMembers sends each current inbox member who can open the triggering message a notice, unless the message is spam. Subjects are quoted and shortened, and left out for zero-access inboxes. Copies follow each member's notification routes and leave out the subject; outside copies use the subject New mail in K8 HQ. At most 100 members; above that, no notices are sent and rule.action.failed records member_limit. If a member no longer meets the notice conditions at delivery, their notice is skipped and rule.action.failed records member_condition once per member and triggering event. If the sponsoring app loses authority, the rule pauses with reason authority. Each stored notice counts as one rules.actions unit and against the rule daily limit.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "label",
              "move",
              "flag",
              "emit",
              "notify",
              "notifyMembers"
            ],
            "description": "See `GET /rule-actions`. `parse_dmarc_report` is K8 HQ's own: only its starter template may use it."
          },
          "label": {
            "type": "string",
            "description": "label, move: a label ID, a role (inbox, archive, spam, trash, sent, drafts) or a label parameter. Move takes the message out of the label the trigger put it in."
          },
          "add": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentWebFlag"
            },
            "description": "flag: flags to set."
          },
          "remove": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentWebFlag"
            },
            "description": "flag: flags to clear."
          },
          "type": {
            "type": "string",
            "description": "emit: a registered `ext.*` type (up to 1000 a day per rule)."
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "emit: the type's fields, each a CEL expression."
          },
          "inbox": {
            "type": "string",
            "description": "notify: the inbox (or inbox parameter) a notice is delivered to (up to 100 a day per rule)."
          },
          "text": {
            "type": "string",
            "description": "notify: a CEL expression for the notice's text."
          },
          "body": {
            "type": "string",
            "maxLength": 4000,
            "description": "reply: the reply's plain text, or a string parameter (\"$name\")."
          },
          "subject": {
            "type": "string",
            "description": "notify, K8 HQ's starter templates only: a CEL expression for the notice's subject. Other rules' notices are \"Rule: <name>\"."
          },
          "when": {
            "type": "string",
            "maxLength": 4000,
            "description": "A CEL filter set only by K8 HQ's unchanged starter templates. Other customer rules cannot set it. Empty runs the action for every matched event."
          }
        }
      },
      "AgentCreateRuleInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "template": {
            "$ref": "#/components/schemas/AgentTemplate"
          },
          "params": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "dailyCap": {
            "type": "integer",
            "minimum": -1,
            "maximum": 10000000
          },
          "activeFrom": {
            "type": "string",
            "format": "date-time"
          },
          "activeUntil": {
            "type": "string",
            "format": "date-time"
          },
          "ifVersion": {
            "type": "integer",
            "minimum": 0,
            "const": 0
          }
        },
        "required": [
          "template"
        ]
      },
      "AgentUpdateRuleInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "template": {
            "$ref": "#/components/schemas/AgentTemplate"
          },
          "params": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "dailyCap": {
            "type": "integer",
            "minimum": -1,
            "maximum": 10000000
          },
          "activeFrom": {
            "type": "string",
            "format": "date-time"
          },
          "activeUntil": {
            "type": "string",
            "format": "date-time"
          },
          "ifVersion": {
            "type": "integer",
            "minimum": 0
          }
        },
        "minProperties": 1
      },
      "AgentProblem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid",
              "unauthenticated",
              "read_only",
              "forbidden",
              "approval_required",
              "not_found",
              "conflict",
              "version_mismatch",
              "rejected",
              "unavailable",
              "address_reserved",
              "address_taken",
              "domain_unverified",
              "mail_off",
              "no_credit",
              "service_disabled",
              "org_closed"
            ],
            "description": "Stable code for clients; detail is for people and may change.",
            "x-enumDescriptions": {
              "invalid": "400: Malformed input or a missing or malformed Idempotency-Key.",
              "unauthenticated": "401: Unknown, expired, revoked or incorrectly transported personal credential.",
              "read_only": "402: The organization cannot add resources now.",
              "forbidden": "403: Current authority, resource access, consent or required acknowledgment is missing.",
              "approval_required": "403: This connection needs approval for that, and approval isn't available yet.",
              "not_found": "404: The organization is outside this connection, or the target does not exist.",
              "conflict": "409: The key names a different command, or current resource state prevents the change.",
              "version_mismatch": "412: The rule changed; read its current version before a new intent.",
              "rejected": "422: The command does not meet the action limits or current requirements.",
              "unavailable": "503: Authority changed, the attempt expired, a provider is unavailable or the outcome is uncertain. Retry the same input and key under fresh current authority.",
              "address_reserved": "409: This address was freed recently and cannot be added to another inbox yet.",
              "address_taken": "409: This address already routes to an inbox.",
              "domain_unverified": "409: An address domain is not ready in this organization.",
              "mail_off": "409: Mail must be enabled before adding email addresses.",
              "no_credit": "402: The organization needs credit before adding an inbox.",
              "service_disabled": "403: The required service is disabled.",
              "org_closed": "410: The organization is being deleted."
            }
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code"
        ]
      },
      "AgentServiceView": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "catalog",
          "services"
        ],
        "properties": {
          "catalog": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "description",
                "status",
                "alwaysOn",
                "releaseVersion"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "available",
                    "beta"
                  ]
                },
                "alwaysOn": {
                  "type": "boolean"
                },
                "releaseVersion": {
                  "type": "string"
                }
              }
            }
          },
          "services": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          }
        }
      },
      "SessionCreateInboxResourceInput": {
        "type": "object",
        "properties": {
          "addresses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "0 to 10 addresses; lowercased, duplicates dropped. Leave out (or empty) for an inbox without addresses, which then needs a name."
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "description": "The inbox's display name (1 to 100 characters). Required without addresses; optional with them."
          }
        },
        "required": []
      },
      "SessionCreateInboxResourceResult": {
        "type": "object",
        "properties": {
          "inboxId": {
            "type": "string",
            "description": "The inbox (`ibx_...`).",
            "pattern": "^ibx_"
          }
        },
        "required": [
          "inboxId"
        ],
        "additionalProperties": false
      },
      "SessionCreateBoardResourceInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "1 to 100 characters."
          },
          "statuses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^st_[0-9A-Za-z]{1,26}$"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "todo",
                    "active",
                    "waiting",
                    "done",
                    "closed"
                  ]
                }
              },
              "required": [
                "id",
                "category"
              ]
            }
          },
          "inboxId": {
            "type": "string",
            "pattern": "^ibx_",
            "description": "Make a ticket board for this inbox (`ibx_...`)."
          }
        },
        "required": [
          "name"
        ]
      },
      "SessionCreateBoardResourceResult": {
        "type": "object",
        "properties": {
          "boardId": {
            "type": "string",
            "description": "The board (`brd_...`).",
            "pattern": "^brd_"
          }
        },
        "required": [
          "boardId"
        ],
        "additionalProperties": false
      },
      "SessionCreateFormResourceInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "1 to 100 characters on one line: what members see the form called (its public title is in its definition)."
          },
          "retentionDays": {
            "type": "integer",
            "description": "How long its responses are kept, in days from when each was received: 0 (the default) keeps them until someone deletes them; 30, 90 or 365 deletes older ones daily (design note 0019 section 11). Any other number is refused."
          }
        },
        "required": [
          "name"
        ]
      },
      "SessionCreateFormResourceResult": {
        "type": "object",
        "properties": {
          "formId": {
            "type": "string",
            "description": "The form (`frm_...`).",
            "pattern": "^frm_"
          }
        },
        "required": [
          "formId"
        ],
        "additionalProperties": false
      },
      "SessionCreateBookResourceInput": {
        "type": "object",
        "properties": {
          "bookId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "members": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name"
        ]
      },
      "SessionCreateBookResourceResult": {
        "type": "object",
        "properties": {
          "book": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "orgId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "modseq": {
                "type": "integer"
              },
              "version": {
                "type": "integer"
              },
              "deleting": {
                "type": "boolean"
              },
              "purging": {
                "type": "boolean"
              },
              "purgeAt": {
                "type": "string"
              },
              "createdAttribution": {
                "$ref": "#/components/schemas/Attribution"
              },
              "updatedAttribution": {
                "$ref": "#/components/schemas/Attribution"
              },
              "requestedAttribution": {
                "$ref": "#/components/schemas/Attribution"
              },
              "privacy": {
                "type": "string",
                "enum": [
                  "readable",
                  "zero_access"
                ]
              },
              "epoch": {
                "type": "integer",
                "minimum": 1
              }
            },
            "required": [
              "id",
              "orgId",
              "name",
              "createdAt",
              "modseq",
              "version",
              "deleting",
              "purging"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "book"
        ],
        "additionalProperties": false
      },
      "SessionDeleteBookResourceInput": {
        "type": "object",
        "properties": {
          "confirm": {
            "type": "string"
          }
        },
        "required": [
          "confirm"
        ]
      },
      "SessionDeleteBookResourceResult": {
        "type": "object",
        "properties": {
          "bookId": {
            "type": "string"
          },
          "purgeAt": {
            "type": "string"
          }
        },
        "required": [
          "bookId",
          "purgeAt"
        ],
        "additionalProperties": false
      },
      "SessionDeleteOrgResourceInput": {
        "type": "object",
        "properties": {
          "confirm": {
            "type": "string",
            "description": "The organization's name, typed."
          }
        },
        "required": [
          "confirm"
        ]
      },
      "SessionDeleteOrgResourceResult": {
        "type": "object",
        "properties": {
          "orgId": {
            "type": "string",
            "description": "The organization (`org_...`).",
            "pattern": "^org_"
          },
          "deleteAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "orgId",
          "deleteAt"
        ],
        "additionalProperties": false
      },
      "SessionDeleteInboxResourceInput": {
        "type": "object",
        "properties": {
          "confirm": {
            "type": "string",
            "description": "The inbox's name or one of its addresses, typed."
          }
        },
        "required": [
          "confirm"
        ]
      },
      "SessionDeleteInboxResourceResult": {
        "type": "object",
        "properties": {
          "inboxId": {
            "type": "string",
            "description": "The inbox (`ibx_...`).",
            "pattern": "^ibx_"
          },
          "purgeAt": {
            "type": "string",
            "format": "date-time",
            "description": "When its content is deleted for good (now, for an inbox with no mail)."
          }
        },
        "required": [
          "inboxId",
          "purgeAt"
        ],
        "additionalProperties": false
      },
      "SessionDeleteBoardResourceInput": {
        "type": "object",
        "properties": {
          "confirm": {
            "type": "string",
            "description": "The board's name, typed."
          }
        },
        "required": [
          "confirm"
        ]
      },
      "SessionDeleteBoardResourceResult": {
        "type": "object",
        "properties": {
          "boardId": {
            "type": "string",
            "description": "The board (`brd_...`).",
            "pattern": "^brd_"
          },
          "purgeAt": {
            "type": "string",
            "format": "date-time",
            "description": "When its content is deleted for good (now, for a board with no items)."
          }
        },
        "required": [
          "boardId",
          "purgeAt"
        ],
        "additionalProperties": false
      },
      "SessionDeleteFormResourceInput": {
        "type": "object",
        "properties": {
          "confirm": {
            "type": "string",
            "description": "The form's name, typed."
          }
        },
        "required": [
          "confirm"
        ]
      },
      "SessionDeleteFormResourceResult": {
        "type": "object",
        "properties": {
          "formId": {
            "type": "string",
            "description": "The form (`frm_...`).",
            "pattern": "^frm_"
          },
          "purgeAt": {
            "type": "string",
            "format": "date-time",
            "description": "When its content is deleted for good (now, for a board with no items)."
          }
        },
        "required": [
          "formId",
          "purgeAt"
        ],
        "additionalProperties": false
      },
      "ZeroAccessOutboxBlocker": {
        "type": "object",
        "description": "The zero-access switch preflight, when available, refuses to continue while the inbox has stored outgoing mail. Send or cancel it first. Failed and uncertain items must also be removed so their keys remain available until they are handled.",
        "required": [
          "code",
          "count",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "scheduled_messages"
            ]
          },
          "count": {
            "type": "integer",
            "minimum": 1
          },
          "detail": {
            "type": "string",
            "description": "For example: 2 scheduled messages: send or cancel them first."
          }
        },
        "additionalProperties": false
      }
    }
  },
  "x-k8hq-agent-feature-gates": [
    "K8HQ_AGENT_APPS=on",
    "K8HQ_AGENT_CONSENT=on",
    "K8HQ_AGENT_API=on"
  ],
  "x-k8hq-agent-policy": "organization-permissions-v20 requires explicit operator activation; all publication/deployment/activation holds remain"
}
