Organization billing — K8 HQ Setup API
Organization billing operations for K8 HQ Setup API. Requests, permissions and responses.
Version 1OpenAPI description (JSON)
Before making requests, read the authentication and request requirements.
Who pays for an organization, the fallback payer, and caps on what agents may spend each month.
Base URL
| Base URL | For |
https://api.k8hq.com/setup | The K8 HQ web app, and programs acting with a person's session |
Endpoints
Organization billing
Read an explicit monthly agent spending cap
GET/v1/organizations/{orgId}/billing/agent-budget
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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
orgId (path) required | string | The exact orgId target. |
Response body (JSON)
| Field | Type | Description |
explicit required | boolean | |
version required | integer | |
amountUSD | string | Pattern: ^[0-9]+(\.[0-9]{1,9})?$. |
Responses
| Status | Body | Meaning |
| 200 | AgentBudgetCap | The explicit cap, or explicit=false and version=0 when unset. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | No session, it expired, or it isn't a person's own session (unauthenticated). |
| 403 | application/problem+json | They may not do this in the organization, or a browser origin other than the web app's (forbidden). |
| 405 | application/problem+json | Method not allowed; Allow identifies supported methods. |
| 409 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 410 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |
Configure an explicit monthly agent spending cap
PUT/v1/organizations/{orgId}/billing/agent-budget
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.
Needs 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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused. The session needs a recent passkey: if its last passkey confirmation is more than 5 minutes old, the answer is 401 step_up_required.
Parameters
| Name | Type | Description |
orgId (path) required | string | The exact orgId target. |
x-amz-content-sha256 (header) required | string | The body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). |
Request body (JSON)
| Field | Type | Description |
amountUSD required | string | Pattern: ^[0-9]+(\.[0-9]{1,9})?$. |
Response body (JSON)
| Field | Type | Description |
explicit required | boolean | |
version required | integer | |
amountUSD | string | Pattern: ^[0-9]+(\.[0-9]{1,9})?$. |
Responses
| Status | Body | Meaning |
| 200 | AgentBudgetCap | The explicit cap, or explicit=false and version=0 when unset. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | 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). |
| 403 | application/problem+json | They may not do this in the organization, or a browser origin other than the web app's (forbidden). |
| 405 | application/problem+json | Method not allowed; Allow identifies supported methods. |
| 409 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 410 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |
Read an explicit monthly agent spending cap
GET/v1/organizations/{orgId}/billing/agent-budget/credentials/{credentialId}
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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
orgId (path) required | string | The exact orgId target. |
credentialId (path) required | string | The exact credentialId target. |
Response body (JSON)
| Field | Type | Description |
explicit required | boolean | |
version required | integer | |
amountUSD | string | Pattern: ^[0-9]+(\.[0-9]{1,9})?$. |
Responses
| Status | Body | Meaning |
| 200 | AgentBudgetCap | The explicit cap, or explicit=false and version=0 when unset. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | No session, it expired, or it isn't a person's own session (unauthenticated). |
| 403 | application/problem+json | They may not do this in the organization, or a browser origin other than the web app's (forbidden). |
| 405 | application/problem+json | Method not allowed; Allow identifies supported methods. |
| 409 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 410 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |
Configure an explicit monthly agent spending cap
PUT/v1/organizations/{orgId}/billing/agent-budget/credentials/{credentialId}
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.
Needs 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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused. The session needs a recent passkey: if its last passkey confirmation is more than 5 minutes old, the answer is 401 step_up_required.
Parameters
| Name | Type | Description |
orgId (path) required | string | The exact orgId target. |
credentialId (path) required | string | The exact credentialId target. |
x-amz-content-sha256 (header) required | string | The body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). |
Request body (JSON)
| Field | Type | Description |
amountUSD required | string | Pattern: ^[0-9]+(\.[0-9]{1,9})?$. |
Response body (JSON)
| Field | Type | Description |
explicit required | boolean | |
version required | integer | |
amountUSD | string | Pattern: ^[0-9]+(\.[0-9]{1,9})?$. |
Responses
| Status | Body | Meaning |
| 200 | AgentBudgetCap | The explicit cap, or explicit=false and version=0 when unset. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | 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). |
| 403 | application/problem+json | They may not do this in the organization, or a browser origin other than the web app's (forbidden). |
| 405 | application/problem+json | Method not allowed; Allow identifies supported methods. |
| 409 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 410 | application/problem+json | Current Owner authority or organization lifecycle changed; recapture before retrying. |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |
Change the fallback
PUT/v1/organizations/{orgId}/billing/fallback
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.
Needs 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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused. The session needs a recent passkey: if its last passkey confirmation is more than 5 minutes old, the answer is 401 step_up_required.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). |
orgId (path) required | string | orgId resource identifier. |
Request body (JSON)
| Field | Type | Description |
fallback required | Fallback | |
{"fallback":{"cap":20,"chunk":1,"on":true}}
Response body (JSON)
| Field | Type | Description |
fallback required | Fallback | |
orgId required | string | The organization (org_...). Pattern: ^org_. |
Responses
| Status | Body | Meaning |
| 200 | JSON | The fallback as stored. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | 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). |
| 403 | application/problem+json | They don't pay for it (not_payer), or aren't an owner. |
| 405 | application/problem+json | Method not allowed. The Allow header lists supported methods. |
| 409 | application/problem+json | Billing changed meanwhile: look again. |
| 410 | application/problem+json | The organization is being deleted (org_closed). |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |
Offer billing to another owner
POST/v1/orgs/payer/offer
The payer offers to hand billing to another owner, who accepts within 7 days with /v1/orgs/payer/take. They're told.
Needs 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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). |
Request body (JSON)
| Field | Type | Description |
memberId required | string | A member (mem_...). Pattern: ^mem_. |
orgId required | string | The organization (org_...). Pattern: ^org_. |
{"memberId":"mem_01J...","orgId":"org_01J..."}
Response body (JSON)
| Field | Type | Description |
offerTo required | string | A member (mem_...). Pattern: ^mem_. |
orgId required | string | The organization (org_...). Pattern: ^org_. |
Responses
| Status | Body | Meaning |
| 200 | JSON | Offered. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | 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). |
| 403 | application/problem+json | They don't pay for it (not_payer), or the member isn't an owner (owner_only). |
| 409 | application/problem+json | Billing changed meanwhile: look again. |
| 410 | application/problem+json | The organization is being deleted (org_closed). |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |
Take over billing
POST/v1/orgs/payer/take
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.
Needs 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.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). |
Request body (JSON)
| Field | Type | Description |
orgId required | string | The organization (org_...). Pattern: ^org_. |
{"orgId":"org_01J..."}
Response body (JSON)
| Field | Type | Description |
orgId required | string | The organization (org_...). Pattern: ^org_. |
Responses
| Status | Body | Meaning |
| 200 | JSON | They pay for it now. |
| 400 | application/problem+json | Malformed or invalid input (invalid). |
| 401 | application/problem+json | 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). |
| 403 | application/problem+json | Only an owner can pay for an organization (owner_only). |
| 409 | application/problem+json | Billing changed meanwhile: look again (conflict); or a new payer pays for 3 organizations already, the most while they're new (new_payer_orgs). |
| 410 | application/problem+json | The organization is being deleted (org_closed). |
| 503 | application/problem+json | A temporary problem (unavailable); retry. |