Keyring
ReferenceControl-plane API

Tenants

One row per customer organisation; the unit the invoice counts.

Generated from packages/api/src/resources/tenants.controller.ts by packages/docs/tools/generate-reference.mjs. Do not edit by hand: src/reference.spec.ts regenerates it and fails on a difference.

POST /v1/tenants

Answers 201 on success.

Authentication.

  • A krsk_ secret key or a krses_ dashboard session, as Authorization: Bearer.

Body. Validated by this schema, from the control plane's own source:

const CreateTenant = z.object({
  external_id: z.string().min(1).max(200),
  name: Name.optional(),
  meta: Meta.optional(),
});

GET /v1/tenants

Answers 200 on success.

Authentication.

  • A krsk_ secret key or a krses_ dashboard session, as Authorization: Bearer.

GET /v1/tenants/:id

Answers 200 on success.

Authentication.

  • A krsk_ secret key or a krses_ dashboard session, as Authorization: Bearer.

Path parameters. id.

PATCH /v1/tenants/:id

Answers 200 on success.

Authentication.

  • A krsk_ secret key or a krses_ dashboard session, as Authorization: Bearer.

Path parameters. id.

Body. Validated by this schema, from the control plane's own source:

const UpdateTenant = z.object({
  name: Name.nullable().optional(),
  meta: Meta.optional(),
});

POST /v1/tenants/:id/embed_tokens/revoke

Report section 7.2's real revocation lever, and the reason a five-minute TTL is defensible: bumping the tenant's epoch kills every outstanding embed token for that tenant on its next request, however long it had left.

The bump commits first and the cache is written after. The other order would let a reader see the new epoch before the transaction that produced it committed, and a rollback would then leave the cache ahead of the database -- refusing tokens that are still valid, with nothing to correct it but the entry's expiry.

This one is audited, unlike the mints (see embed-tokens.controller.ts): it is a revocation, it is human-paced, and it is the event an auditor asks about.

Answers 200 on success.

Authentication.

  • A krsk_ secret key or a krses_ dashboard session, as Authorization: Bearer.

Path parameters. id.

DELETE /v1/tenants/:id

Deleting a customer organisation revokes the keys it holds. This is the call a vendor makes when a customer churns or is cut off for abuse, so a version of it that leaves those keys verifying is the wrong one; cascadeRevoke carries the reasoning and the policy-version bump.

Answers 200 on success.

Authentication.

  • A krsk_ secret key or a krses_ dashboard session, as Authorization: Bearer.

Path parameters. id.

Shared validators

Defined once in packages/api/src/validation.ts and used by the schemas above.

const Meta = z.record(z.string(), z.unknown());
const Name = z.string().min(1).max(200);

On this page