The portal's 30-day views folded at most 1000 events from the usage list, so busy tenants saw figures that were too low. The summary aggregates every matching event in the store (GROUP BY in Postgres, the same fold in Memory): counts, quantity sums and the latest occurred_at per product and metric, and counts and sums per UTC day and metric. Same filters, tenant pinning for user tokens and route group (usage.read) as GET /v1/usage/events, so the portal's service client needs no new AUTHZ grant. Both stores share the filter (usageWhere / matches). Refs: t80 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3205 lines
138 KiB
YAML
3205 lines
138 KiB
YAML
openapi: 3.1.0
|
||
info:
|
||
title: Tenant Registry
|
||
version: 0.1.0
|
||
description: |
|
||
Internal platform API. Owns the multi-tenant glue: tenants, projects,
|
||
product entitlements, API keys, audit log. See
|
||
`PLATFORM_ARCHITECTURE.md §5c` for the schema, and
|
||
`PRODUCT_INTEGRATION_SPEC.md §8.4` for the audit shape.
|
||
|
||
Auth (RBAC Phase 1): with AUTH_ENABLED=true every route except
|
||
/healthz, /readyz and /version requires a Keycloak-issued bearer token whose
|
||
audience contains AUTH_EXPECTED_AUDIENCE (INTERNAL_SERVICE_ONLY
|
||
posture). With AUTH_ENABLED=false (dev default) the API is open.
|
||
Per-client authorization (M-MIG-5): AUTHZ_RULES maps each client
|
||
(JWT azp) to route groups — tenants(.read|.write), catalog,
|
||
entitlements, api-keys(.verify), audit(.read|.write), users,
|
||
keycloak, erp, usage, licences. Unlisted clients get 403.
|
||
|
||
Tenant status ladder (ERP/02): demo, trial, active (Betriebsbereit),
|
||
warning (Warnung), restricted (Eingeschränkt, read-only), halted
|
||
(Angehalten), archived. 'frozen' is legacy = restricted.
|
||
contact:
|
||
email: oncall@breakpilot.com
|
||
license:
|
||
name: Proprietary
|
||
servers:
|
||
- url: http://localhost:8090
|
||
description: Local dev
|
||
- url: https://registry-stage.breakpilot.com
|
||
description: Stage
|
||
- url: https://registry.breakpilot.com
|
||
description: Production
|
||
|
||
paths:
|
||
/healthz:
|
||
get:
|
||
summary: Liveness probe
|
||
responses:
|
||
"200":
|
||
description: Always returns ok.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties: { status: { type: string, example: ok } }
|
||
|
||
/version:
|
||
get:
|
||
summary: Build version and commit (public, no auth).
|
||
responses:
|
||
"200":
|
||
description: The build the registry runs; "dev" and "" for a local build.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [version, commit]
|
||
properties:
|
||
version: { type: string, example: v0.1.4 }
|
||
commit: { type: string, description: full git commit hash }
|
||
|
||
/readyz:
|
||
get:
|
||
summary: Readiness probe — pings the store.
|
||
responses:
|
||
"200":
|
||
description: Store reachable.
|
||
"503":
|
||
description: Store unreachable.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
|
||
/v1/tenants:
|
||
get:
|
||
summary: List tenants (service-only; keyset paginated).
|
||
parameters:
|
||
- in: query
|
||
name: status
|
||
schema: { $ref: "#/components/schemas/TenantStatus" }
|
||
- in: query
|
||
name: kind
|
||
schema: { type: string, enum: [customer, demo] }
|
||
- in: query
|
||
name: limit
|
||
schema: { type: integer, minimum: 1, maximum: 500, default: 100 }
|
||
- in: query
|
||
name: cursor
|
||
schema: { type: string, description: "next_cursor from the previous page" }
|
||
responses:
|
||
"200":
|
||
description: Page of tenants; next_cursor omitted on the last page.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/Tenant" }
|
||
next_cursor: { type: string }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
post:
|
||
summary: Create a tenant.
|
||
description: |
|
||
Creates the tenant row, and if `admin_email` is provided, also
|
||
creates a Keycloak organization + invites the user as IT_ADMIN.
|
||
Keycloak failures DO NOT roll the tenant back — they emit a
|
||
`keycloak.provision_failed` audit event so the operator can resend
|
||
the invite from the KC admin UI.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/TenantCreate" } }
|
||
responses:
|
||
"201":
|
||
description: Created. `invite_url` is non-empty when an
|
||
`admin_email` was passed and Keycloak provisioning succeeded.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/TenantCreated" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/tenants/{id}:
|
||
get:
|
||
summary: Get tenant by id.
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"200":
|
||
description: Found.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Tenant" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/by-slug/{slug}:
|
||
get:
|
||
summary: Get tenant by slug.
|
||
parameters:
|
||
- in: path
|
||
name: slug
|
||
required: true
|
||
schema: { type: string, pattern: '^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$' }
|
||
responses:
|
||
"200":
|
||
description: Found.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Tenant" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/activate:
|
||
post:
|
||
summary: Move tenant to status=active.
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
requestBody:
|
||
required: false
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/TenantActivate" } }
|
||
responses:
|
||
"200":
|
||
description: Updated.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Tenant" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/status:
|
||
post:
|
||
summary: Move a tenant along the status ladder (ERP link, Backstage).
|
||
description: |
|
||
The one transition endpoint outside activate/cancel. Syncs the coarse
|
||
`tenant_status` claim to every Keycloak member of the tenant's
|
||
organization and writes a `tenant.status_changed` audit event.
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [status]
|
||
properties:
|
||
status: { $ref: "#/components/schemas/TenantStatus" }
|
||
reason: { type: string }
|
||
source: { type: string, enum: [erp, backstage, system, test] }
|
||
responses:
|
||
"200":
|
||
description: Updated.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Tenant" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/cancel:
|
||
post:
|
||
summary: Move tenant to status=halted (Angehalten).
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
requestBody:
|
||
required: false
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/TenantCancel" } }
|
||
responses:
|
||
"200":
|
||
description: Updated.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Tenant" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/documents:
|
||
get:
|
||
summary: A tenant's published documents.
|
||
description: Served by the same `{id}/{sub}` route as members; user tokens reach their own tenant only.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: Published documents, newest first.
|
||
content:
|
||
application/json:
|
||
schema: { type: object, properties: { items: { type: array, items: { $ref: "#/components/schemas/Document" } } } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/projects:
|
||
get:
|
||
summary: A tenant's projects (Projekte), by name.
|
||
description: |
|
||
Served by the `{id}/{sub}` route; user tokens reach their own tenant
|
||
only. Products read it with their service token (tenants.read) to
|
||
validate project ids on their own objects.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The projects.
|
||
content:
|
||
application/json:
|
||
schema: { type: object, properties: { items: { type: array, items: { $ref: "#/components/schemas/Project" } } } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
post:
|
||
summary: Create a project.
|
||
description: |
|
||
The portal calls this for staff (X-Staff-* headers) and for tenant
|
||
admins (it checks their org role and names them in
|
||
X-Portal-User-Email). Names are unique per tenant, ignoring case.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ProjectWrite" } }
|
||
responses:
|
||
"201":
|
||
description: Created.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Project" } }
|
||
"400": { description: "invalid_name, invalid_kind, invalid_level, invalid_parent or too_deep." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: A project with this name exists (name_taken). }
|
||
|
||
/v1/tenants/{id}/projects/{pid}:
|
||
patch:
|
||
summary: Rename or change a project (fields given are changed).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: pid, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ProjectWrite" } }
|
||
responses:
|
||
"200":
|
||
description: The project.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Project" } }
|
||
"400": { description: "invalid_name, invalid_kind, invalid_level (also when its children would no longer fit), invalid_parent (incl. cycles) or too_deep." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: "name_taken, or has_children when a project with children would become a topic." }
|
||
delete:
|
||
summary: Delete a project. Its documents stay; they lose the assignment.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: pid, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"204": { description: Deleted. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: "has_children: move or delete the products and components below it first." }
|
||
|
||
/v1/tenants/{id}/projects/{pid}/targets:
|
||
get:
|
||
summary: The project's Prüfwerk objects (read from Prüfwerk).
|
||
description: |
|
||
The registry asks Prüfwerk's platform API with its service token.
|
||
When Prüfwerk cannot answer, `items` is empty and `available` false.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: pid, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The objects.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
available: { type: boolean }
|
||
items:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id: { type: string }
|
||
name: { type: string }
|
||
target_type: { type: string }
|
||
last_scan_at: { type: string, format: date-time }
|
||
open_findings: { type: integer }
|
||
open_vulnerabilities: { type: integer, description: Known vulnerabilities in its components that are still open (CVE alerts not resolved and not assessed not_affected or fixed). }
|
||
project_ids: { type: array, items: { type: string } }
|
||
url: { type: string, description: The object in the Prüfwerk dashboard. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/store:
|
||
get:
|
||
summary: The tenant's document store (Dokumentenablage), by area and legal folder.
|
||
description: |
|
||
Published documents only; BreakPilot's deliveries (no area) come last.
|
||
Served by the `{id}/{sub}` route; user tokens reach their own tenant
|
||
only. Each item carries its processing status and, once delivered,
|
||
a summary of its prepared version.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The store.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items: { type: array, items: { $ref: "#/components/schemas/StoreDocument" } }
|
||
legal_kinds: { type: array, items: { type: string }, description: The legal folders in display order. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/store/documents:
|
||
post:
|
||
summary: Upload a document into an area of the store.
|
||
description: |
|
||
multipart/form-data: `area` (legal_web, product_public, internal),
|
||
`legal_kind` (legal_web only), `product_id` (product_public or internal, a
|
||
product project of the tenant), `title`, `process` ("on": an internal document
|
||
goes to the Factory too), then `file` (pdf, docx, txt, html). Legal
|
||
and product documents wait for the Factory (`pending`). The portal
|
||
checks the user's org role and names them in X-Portal-User-Email.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
required: [area, file]
|
||
properties:
|
||
area: { type: string, enum: [legal_web, product_public, internal] }
|
||
legal_kind: { type: string }
|
||
product_id: { type: string }
|
||
title: { type: string, maxLength: 200 }
|
||
process: { type: string }
|
||
file: { type: string, format: binary }
|
||
responses:
|
||
"201":
|
||
description: Stored.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/StoreDocument" } }
|
||
"400": { description: "invalid_area, invalid_legal_kind, invalid_product, invalid_title, missing_file or invalid_body." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"413": { description: Larger than the upload limit (too_large). }
|
||
"415": { description: "Not pdf, docx, txt or html (unsupported_type)." }
|
||
|
||
/v1/tenants/{id}/store/documents/{doc}/original:
|
||
get:
|
||
summary: The original, inline, after its SHA-256 matched.
|
||
description: A mismatch is refused with 502 digest_mismatch and nothing is served. HTML is sent with a sandboxing CSP.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200": { description: The file; X-Content-SHA256 carries its digest. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"502": { description: digest_mismatch or storage_failed. }
|
||
|
||
/v1/tenants/{id}/store/documents/{doc}/prepared:
|
||
get:
|
||
summary: The prepared version (LANE_B_UNIFIED_V5 chunk file), digest-checked.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200": { description: The chunk file as delivered. }
|
||
"404": { description: "Unknown document, or nothing delivered yet (not_prepared)." }
|
||
"502": { description: digest_mismatch or storage_failed. }
|
||
|
||
/v1/tenants/{id}/store/documents/{doc}/consent-banner:
|
||
get:
|
||
summary: The cookie-banner capture (CONSENT_BANNER_CAPTURE_V1), digest-checked.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200": { description: The capture as delivered. }
|
||
"404": { description: "Unknown document, or no capture (not_prepared)." }
|
||
"502": { description: digest_mismatch or storage_failed. }
|
||
|
||
/v1/tenants/{id}/store/assets/{sha}:
|
||
get:
|
||
summary: An image of a prepared document the tenant holds, digest-checked.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: sha, required: true, schema: { type: string, pattern: "^[0-9a-f]{64}$" } }
|
||
responses:
|
||
"200": { description: The image. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"502": { description: digest_mismatch or storage_failed. }
|
||
|
||
/v1/tenants/{id}/company-profile:
|
||
get:
|
||
summary: The tenant's company profile (Unternehmensprofil), current revision.
|
||
description: |
|
||
Served by the `{id}/{sub}` route; user tokens reach their own tenant
|
||
only. The answers are the portal form's document, unchanged.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The profile.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfile" } }
|
||
"404": { description: The tenant does not exist or has no profile yet. }
|
||
put:
|
||
summary: Save the company profile (a new revision).
|
||
description: |
|
||
The portal calls this for users it allowed to edit (IT_ADMIN, CXO,
|
||
LEGAL; named in X-Portal-User-Email). expected_revision is the
|
||
revision the writer last read (0 for none); anything else is refused
|
||
with 409 and the current revision. A save that changes nothing
|
||
returns the profile without a new revision. The status is kept.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfileWrite" } }
|
||
responses:
|
||
"200":
|
||
description: Saved (or unchanged).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfile" } }
|
||
"400": { description: "expected_revision_required, invalid_schema_version or invalid_profile." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/ProfileRevisionConflict" }
|
||
"413": { description: The document exceeds 256 KiB (too_large). }
|
||
|
||
/v1/tenants/{id}/company-profile/submit:
|
||
post:
|
||
summary: Submit the company profile (status submitted, a new revision).
|
||
description: The portal offers it once every required answer is given.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema: { type: object, required: [expected_revision], properties: { expected_revision: { type: integer, minimum: 0 } } }
|
||
responses:
|
||
"200":
|
||
description: Submitted.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfile" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/ProfileRevisionConflict" }
|
||
|
||
/v1/tenants/{id}/role-dataset:
|
||
get:
|
||
summary: The company's role and authority dataset (Rollen- und Befugnisdatensatz), current revision.
|
||
description: |
|
||
Served by the `{id}/{sub}` route. User tokens reach their own tenant
|
||
only (route group `role-dataset.user`); services read with
|
||
`tenants.read`. A company without a dataset gets revision 0 and an
|
||
empty dataset. The answer carries the derived state of every
|
||
deputyship (`wirksam` or `hinterlegt` with reasons, computed now)
|
||
and the catalogue of functions and decision types.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The dataset.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/RoleDatasetState" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
put:
|
||
summary: Save the role dataset (a new revision).
|
||
description: |
|
||
Only with the user token of the person saving (`user_token_required`
|
||
otherwise); `X-Portal-User-*` headers are ignored. The writer must
|
||
hold management or a document owner function; while no management
|
||
holder is recorded, the CXO sign-in role may record management and
|
||
nothing else (`bootstrap_only`). `recorded_*` and `authorized_*` are
|
||
set by the registry, never taken from the body; `authorize` lists
|
||
deputies and standard releases management authorizes with this save.
|
||
expected_revision is the revision the writer last read (0 for none).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/RoleDatasetWrite" } }
|
||
responses:
|
||
"200":
|
||
description: Saved (or unchanged).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/RoleDatasetState" } }
|
||
"400": { description: "invalid_role_dataset (with path), d02_reference_required, expected_revision_required." }
|
||
"403": { description: "user_token_required, not_permitted, bootstrap_only, not_authorizer, self_authorization." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: "revision_conflict (with current_revision) or catalogue_outdated (with catalogue_version)." }
|
||
"413": { description: The document exceeds 256 KiB (too_large). }
|
||
|
||
/v1/tenants/{id}/intake/reports:
|
||
post:
|
||
summary: Report a security notice (R1 intake, Originalerfassung).
|
||
description: |
|
||
Only with the token of the reporting person (`user_token_required`
|
||
otherwise; route group `intake.user`). The report is kept unchanged
|
||
with the time it arrived and gets one stable reference, which is also
|
||
the Meldereferenz of the confirmation. Only `what` and `danger` are
|
||
required; nothing asks for an assessment.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/IntakeReportWrite" } }
|
||
responses:
|
||
"201":
|
||
description: Recorded.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/IntakeReport" } }
|
||
"400": { description: "invalid_danger, invalid_about, invalid_what, invalid_when, invalid_where or invalid_contact." }
|
||
"403": { description: user_token_required. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
get:
|
||
summary: The caller's own reports, newest first, with their handover state.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The reports.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items: { type: array, items: { $ref: "#/components/schemas/IntakeReport" } }
|
||
"403": { description: user_token_required. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/intake/reports/{ref}:
|
||
get:
|
||
summary: One of the caller's reports, with every entry and its receipts; never the text.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: ref, required: true, schema: { type: string } }
|
||
responses:
|
||
"200":
|
||
description: The report.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/IntakeReport" } }
|
||
"403": { description: user_token_required. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/intake/reports/{ref}/supplements:
|
||
post:
|
||
summary: Add later information to one of the caller's reports (Nachtrag, same reference).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: ref, required: true, schema: { type: string } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [what]
|
||
properties:
|
||
what: { type: string, maxLength: 20000 }
|
||
responses:
|
||
"201":
|
||
description: Recorded.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
reference: { type: string }
|
||
entry: { $ref: "#/components/schemas/IntakeEntry" }
|
||
"400": { description: invalid_what. }
|
||
"403": { description: user_token_required. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/internal/intake/pending:
|
||
get:
|
||
summary: Intake entries not settled yet, oldest first, across workspaces (route group intake).
|
||
description: |
|
||
For the receiving service (Werkmeister). Each item carries the
|
||
reference and the reporter's own answers routing reads, never the
|
||
text. A person's token is refused (`service_token_required`).
|
||
parameters:
|
||
- { in: query, name: after, schema: { type: integer, minimum: 0, default: 0 }, description: "Only entries with a higher id: the last id of the previous page." }
|
||
- { in: query, name: limit, schema: { type: integer, minimum: 1, maximum: 200, default: 50 } }
|
||
responses:
|
||
"200":
|
||
description: The entries.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items: { type: array, items: { $ref: "#/components/schemas/PendingIntake" } }
|
||
"400": { description: invalid_limit or invalid_after. }
|
||
"403": { description: service_token_required or FORBIDDEN_CLIENT. }
|
||
|
||
/v1/internal/intake/entries/{entry}/receipts:
|
||
post:
|
||
summary: What became of an intake entry downstream (route group intake).
|
||
description: |
|
||
waiting (no receiving process yet), delivered, processed or refused.
|
||
A receipt that repeats the newest one adds nothing (200). Processed
|
||
and refused settle the entry; a further receipt is 409 `settled`.
|
||
parameters:
|
||
- { in: path, name: entry, required: true, schema: { type: integer, minimum: 1 } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [status]
|
||
properties:
|
||
status: { type: string, enum: [waiting, delivered, processed, refused] }
|
||
reason: { type: string, maxLength: 80 }
|
||
handoff_id: { type: string, maxLength: 80 }
|
||
run_id: { type: string, maxLength: 80 }
|
||
responses:
|
||
"200": { description: Repeats the newest receipt; nothing added. }
|
||
"201": { description: Added. }
|
||
"400": { description: invalid_receipt. }
|
||
"403": { description: service_token_required or FORBIDDEN_CLIENT. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: settled. }
|
||
|
||
/v1/tenants/{id}/role-dataset/revisions/{rev}:
|
||
get:
|
||
summary: One stored revision of the role dataset, as a decision was made under it.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: rev, required: true, schema: { type: integer, minimum: 1 } }
|
||
responses:
|
||
"200":
|
||
description: The revision.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/RoleDatasetRevision" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/role-dataset/resolve:
|
||
get:
|
||
summary: Who may decide a decision type now.
|
||
description: |
|
||
The deciding function (the company's entry, else the catalogue
|
||
default), its holders in the given scope and the effective deputies
|
||
covering the decision type. `rolle_offen` when no function is set or
|
||
nobody holds it.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: query, name: decision_type, required: true, schema: { type: string } }
|
||
- { in: query, name: document, schema: { type: string } }
|
||
- { in: query, name: product, schema: { type: string } }
|
||
- { in: query, name: area, schema: { type: string } }
|
||
responses:
|
||
"200":
|
||
description: The answer.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/RoleDatasetResolution" } }
|
||
"400": { description: "unknown_decision_type or scope_required." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/role-dataset/holders:
|
||
get:
|
||
summary: Who holds a function now.
|
||
description: |
|
||
The holders of the function in the given scope and its effective
|
||
deputies, whatever decision types they cover (RBAC plan step 5: a
|
||
Werkmeister step that names a function counts the holders; deputies
|
||
stand in for decisions). `rolle_offen` when nobody holds it. A
|
||
function per document, product or area needs that scope.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: query, name: function, required: true, schema: { type: string } }
|
||
- { in: query, name: document, schema: { type: string } }
|
||
- { in: query, name: product, schema: { type: string } }
|
||
- { in: query, name: area, schema: { type: string } }
|
||
responses:
|
||
"200":
|
||
description: The answer.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/RoleDatasetHolders" } }
|
||
"400": { description: "unknown_function or scope_required." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/products/pruefwerk/settings:
|
||
get:
|
||
summary: The workspace's Prüfwerk settings (the monthly Prüftag cap).
|
||
description: |
|
||
User tokens reach their own tenant only and need a bundle granting
|
||
registry:pruefwerk.settings (IT_ADMIN, OWNER, FINANCE; else 403
|
||
FORBIDDEN_ROLE); service
|
||
clients read with tenants.read. Nothing saved yet is
|
||
`prueftag_cap: null`. Kept apart from the ERP-derived entitlement
|
||
config, so a recompute never resets it.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The settings.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/PruefwerkSettings" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
put:
|
||
summary: Set or clear the monthly Prüftag cap.
|
||
description: |
|
||
Same roles as the GET; service clients write with tenants.write (the
|
||
portal for the users it allows, staff through the admin client).
|
||
A change is audited as `product_settings.changed` with the old and
|
||
new value; a save that changes nothing writes nothing. On the
|
||
Enterprise plan the cap is stored but not applied: the entitlement
|
||
check sends `prueftag_cap: null` (`cap_applies: false`).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [prueftag_cap]
|
||
additionalProperties: false
|
||
properties:
|
||
prueftag_cap: { type: integer, minimum: 0, maximum: 10000, nullable: true, description: "null: no cap" }
|
||
responses:
|
||
"200":
|
||
description: Saved (or unchanged).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/PruefwerkSettings" } }
|
||
"400": { description: "invalid_body, unknown_setting, prueftag_cap_required or invalid_prueftag_cap." }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/contracts:
|
||
get:
|
||
summary: The tenant's Vertragsunterlagen (trial, AVV, TOM, SaaS, contract documents).
|
||
description: |
|
||
Served by the `{id}/{sub}` route (tenants.read). `documents` lists the
|
||
released contract documents for this tenant: AGB, AVV, TOM, then the
|
||
Leistungsbeschreibungen that apply (the platform's always; a product's
|
||
while the tenant holds it booked, on trial or as a preview grant; a
|
||
managed service's while the tenant has one). A filled AVV of the
|
||
tenant replaces the master (tenant_specific). Empty while the release
|
||
gate CONTRACT_DOCUMENTS is off.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The overview.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [trial, avv, toms, saas, documents]
|
||
properties:
|
||
trial: { type: object, nullable: true }
|
||
avv: { type: object, properties: { status: { type: string } } }
|
||
toms: { type: object, properties: { status: { type: string } } }
|
||
saas: { type: object, properties: { status: { type: string } } }
|
||
documents: { type: array, items: { $ref: "#/components/schemas/ContractDocument" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/contracts/documents/{file}:
|
||
get:
|
||
summary: One contract document of the tenant as PDF ("<doc>.pdf").
|
||
description: |
|
||
Only a document the overview lists for this tenant; the bytes are
|
||
checked against their SHA-256 (pinned for released documents, stored
|
||
for a filled AVV) before anything is sent. 404 while the release gate
|
||
CONTRACT_DOCUMENTS is off.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: file, required: true, schema: { type: string, example: lb-pruefwerk.pdf } }
|
||
responses:
|
||
"200":
|
||
description: The PDF, inline.
|
||
content:
|
||
application/pdf: { schema: { type: string, format: binary } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"502": { description: The stored file does not match its digest (digest_mismatch) or could not be read. }
|
||
"503": { description: Document storage is not configured. }
|
||
|
||
/v1/tenants/{id}/managed-services:
|
||
get:
|
||
summary: A tenant's managed services (Verwaltete Infrastruktur), oldest first.
|
||
description: |
|
||
Served by the `{id}/{sub}` route; user tokens reach their own tenant
|
||
only and need a bundle granting registry:services.read (IT_ADMIN,
|
||
OWNER, CXO, AUDITOR; else 403 FORBIDDEN_ROLE). Service clients read with tenants.read. Never
|
||
carries instance_id or notes.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The services, by created_at.
|
||
content:
|
||
application/json:
|
||
schema: { type: object, required: [items], properties: { items: { type: array, items: { $ref: "#/components/schemas/ManagedService" } } } }
|
||
"403": { description: The user's org role may not see managed services (FORBIDDEN_ROLE). }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/members:
|
||
get:
|
||
summary: List the tenant's Keycloak organization members.
|
||
description: |
|
||
The portal's Settings/Users page. A user token may only read its own
|
||
tenant — another tenant's id answers 404, never a hint that it exists.
|
||
Service clients are gated on the `tenants.read` route group. A tenant
|
||
whose organization was never created (sales-led) answers with an empty
|
||
list rather than an error.
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"200":
|
||
description: Members of the organization.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [members]
|
||
properties:
|
||
members:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/OrgMember" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/invites:
|
||
post:
|
||
summary: Invite a user into the tenant's organization.
|
||
description: |
|
||
Creates the Keycloak user if needed, adds it to the tenant's
|
||
organization, writes the tenant-context user attributes and sends the
|
||
same execute-actions email the first admin receives. Idempotent: an
|
||
existing member answers `200 {status: member}` and sends no mail.
|
||
User tokens need the `IT_ADMIN` or `OWNER` org role; service clients
|
||
need the `tenants.write` route group.
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [email]
|
||
properties:
|
||
email: { type: string, format: email }
|
||
first_name: { type: string, maxLength: 100 }
|
||
last_name: { type: string, maxLength: 100 }
|
||
role:
|
||
type: string
|
||
enum: [IT_ADMIN, OWNER, CXO, FINANCE, LEGAL, USER, PSIRT, DEVELOPMENT, QUALITY, PRIVACY, PURCHASING, AUDITOR, EXTERNAL]
|
||
default: USER
|
||
description: "an assignable bundle of GET /v1/authz/catalogue, written as the org_roles attribute; case-insensitive"
|
||
responses:
|
||
"202":
|
||
description: Invited; the mail is on its way.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Invite" } }
|
||
"200":
|
||
description: Already a member; nothing sent.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Invite" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/members/{uid}:
|
||
patch:
|
||
summary: Change a member's role, or block / unblock the member in this workspace.
|
||
description: |
|
||
User tokens need IT_ADMIN or OWNER in their own tenant; service clients the `tenants.write` route group. The portal names the acting person in `X-Portal-User-Subject` / `X-Portal-User-Email`.
|
||
Send exactly one of `role` or `blocked`. A role change rewrites the
|
||
member's `org_roles` attribute and takes effect at the member's next
|
||
login or token refresh. A block is per workspace: the tenant id is
|
||
added to the member's `org_blocked` user attribute (never
|
||
`enabled=false`), the member's Keycloak sessions are ended (realm
|
||
wide) and their active API keys are listed for revocation, not
|
||
revoked. Guards (409): `self` — nobody changes their own membership;
|
||
`last_admin` — the last active IT_ADMIN/OWNER cannot be demoted or
|
||
blocked. Audit: `user.role_changed` (from → to), `user.blocked`,
|
||
`user.unblocked`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
role: { type: string, enum: [IT_ADMIN, OWNER, CXO, FINANCE, LEGAL, USER, PSIRT, DEVELOPMENT, QUALITY, PRIVACY, PURCHASING, AUDITOR, EXTERNAL] }
|
||
blocked: { type: boolean }
|
||
responses:
|
||
"200":
|
||
description: Done (or `unchanged`).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/MemberAction" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
delete:
|
||
summary: Remove a member, or revoke a pending invitation.
|
||
description: |
|
||
User tokens need IT_ADMIN or OWNER in their own tenant; service clients the `tenants.write` route group. The portal names the acting person in `X-Portal-User-Subject` / `X-Portal-User-Email`.
|
||
An accepted member loses the organization membership and the
|
||
workspace attributes; their sessions are ended and their active API
|
||
keys are listed for revocation (`user.removed`). A pending invitation
|
||
(no password set yet) is revoked: the membership goes, and the
|
||
Keycloak account is deleted only when this tenant's invitation created
|
||
it and it belongs to no other organization — which also voids the
|
||
link in the invitation mail (`user.invite_revoked`). Guards as for
|
||
PATCH.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
responses:
|
||
"200":
|
||
description: Removed or revoked.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/MemberAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/tenants/{id}/members/{uid}/resend:
|
||
post:
|
||
summary: Send a pending member's invitation mail again.
|
||
description: |
|
||
User tokens need IT_ADMIN or OWNER in their own tenant; service clients the `tenants.write` route group. The portal names the acting person in `X-Portal-User-Subject` / `X-Portal-User-Email`.
|
||
409 `not_pending` when the member has already accepted. Audit:
|
||
`user.invite_resent`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
responses:
|
||
"202":
|
||
description: Sent.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/MemberAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/tenants/{id}/members/{uid}/capabilities:
|
||
post:
|
||
summary: Give a member an individual capability on top of their bundle (RBAC step 3).
|
||
description: |
|
||
User tokens need IT_ADMIN or OWNER in their own tenant; service clients the `tenants.write` route group. The portal names the acting person in `X-Portal-User-Subject` / `X-Portal-User-Email`.
|
||
The acting person must be an active member of the workspace who holds
|
||
`registry:members.manage` (bundle or individual), and must hold the
|
||
capability themselves (403 `not_held`). Staff and plain service
|
||
clients cannot grant. The capability lands in the member's
|
||
`extra_capabilities` user attribute, which the tenant-context mapper
|
||
puts into the token, so it takes effect at the member's next token
|
||
refresh. An administration capability (`admin` in the catalogue) is
|
||
not applied: it becomes a request a second person approves (202,
|
||
four-eyes). 400 `unknown_capability`; 409 `self`, `in_bundle` (the
|
||
member's bundle grants it already). Audit:
|
||
`user.capability_granted`, `user.capability_requested`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [capability]
|
||
properties:
|
||
capability: { type: string, example: "werkmeister:process.publish" }
|
||
responses:
|
||
"200":
|
||
description: Granted (or `unchanged`).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CapabilityAction" } }
|
||
"202":
|
||
description: An administration capability; waits for a second person.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CapabilityAction" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/tenants/{id}/members/{uid}/capabilities/{cap}:
|
||
delete:
|
||
summary: Take an individual capability back, or withdraw its open request.
|
||
description: |
|
||
Same caller rules as the grant, except that the actor need not hold
|
||
the capability. Takes effect at the member's next token refresh.
|
||
Audit: `user.capability_revoked`, `user.capability_request_withdrawn`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
- { in: path, name: cap, required: true, schema: { type: string }, description: the capability code }
|
||
responses:
|
||
"200":
|
||
description: Revoked, withdrawn or `unchanged`.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CapabilityAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/tenants/{id}/capability-requests:
|
||
get:
|
||
summary: Open requests for administration capabilities (four-eyes), oldest first.
|
||
description: |
|
||
User tokens need IT_ADMIN or OWNER in their own tenant; service clients the `tenants.read` route group.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The open requests.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [requests]
|
||
properties:
|
||
requests:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/CapabilityRequest" }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/capability-requests/{rid}/approve:
|
||
post:
|
||
summary: The second person approves a request; the capability is granted.
|
||
description: |
|
||
Same caller rules as the grant. 409 `four_eyes` when the requester
|
||
approves, `self` when the member approves their own. 404
|
||
`not_a_member` when the member has left (the request is dropped).
|
||
Audit: `user.capability_granted` with `requested_by`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: rid, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: Granted.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CapabilityAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/tenants/{id}/capability-requests/{rid}:
|
||
delete:
|
||
summary: Reject a request, or withdraw it (the requester).
|
||
description: |
|
||
Same caller rules as the grant. Audit:
|
||
`user.capability_request_rejected`, `user.capability_request_withdrawn`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: rid, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: Rejected or withdrawn.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CapabilityAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/admin/tenants:
|
||
get:
|
||
summary: Staff tenant list with search and 30-day activity.
|
||
description: |
|
||
Route group `admin` (the portal's service client). `q` matches slug,
|
||
name or admin email, case-insensitively. Each item is a Tenant plus
|
||
`activity`: usage totals per metric over the last 30 days and the time
|
||
of the latest audit entry. Changes made through the admin routes are
|
||
audited under the staff member named in `X-Staff-Subject` /
|
||
`X-Staff-Email`.
|
||
parameters:
|
||
- { in: query, name: q, schema: { type: string, maxLength: 100 } }
|
||
- { in: query, name: status, schema: { type: string } }
|
||
- { in: query, name: kind, schema: { type: string } }
|
||
- { in: query, name: cursor, schema: { type: string } }
|
||
- { in: query, name: limit, schema: { type: integer, minimum: 1, maximum: 500 } }
|
||
responses:
|
||
"200":
|
||
description: One page of tenants.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items:
|
||
allOf:
|
||
- { $ref: "#/components/schemas/Tenant" }
|
||
- type: object
|
||
properties:
|
||
activity: { $ref: "#/components/schemas/TenantActivity" }
|
||
next_cursor: { type: string }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
|
||
/v1/admin/tenants/{id}:
|
||
get:
|
||
summary: Everything staff need about one tenant.
|
||
description: |
|
||
Tenant, 30-day activity, entitlements, subscriptions, licences, the
|
||
latest 25 audit entries and the Keycloak organization members (best
|
||
effort: on failure `members` is empty and `members_error` says why).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The tenant detail.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
tenant: { $ref: "#/components/schemas/Tenant" }
|
||
activity: { $ref: "#/components/schemas/TenantActivity" }
|
||
entitlements: { type: array, items: { type: object } }
|
||
subscriptions: { type: array, items: { type: object } }
|
||
licences: { type: array, items: { type: object } }
|
||
members: { type: array, items: { type: object } }
|
||
members_error: { type: string }
|
||
audit: { type: array, items: { type: object } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
delete:
|
||
summary: Delete an archived tenant for good.
|
||
description: |
|
||
Removes the document files, the Keycloak organization and the accounts that belong to the tenant,
|
||
then the tenant with everything attached. The ERP customer and the audit trail stay; a
|
||
tenant.purged event records who did it. Frees the tenant's name.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: query, name: confirm, required: true, schema: { type: string }, description: The tenant's slug. }
|
||
responses:
|
||
"200": { description: Deleted. }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
/v1/admin/tenants/{id}/trial:
|
||
post:
|
||
summary: Extend a trial.
|
||
description: |
|
||
Moves the trial end `days` after the later of now and the current end,
|
||
moves trial entitlements with it, and returns a tenant that an
|
||
expired trial made read-only (and that never had a subscription) to
|
||
`trial`. Audited as `tenant.trial_extended`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [days]
|
||
properties:
|
||
days: { type: integer, minimum: 1, maximum: 90 }
|
||
responses:
|
||
"200":
|
||
description: The updated tenant.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Tenant" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/admin/tenants/{id}/invites/resend:
|
||
post:
|
||
summary: Send a member's invitation mail again.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [email]
|
||
properties:
|
||
email: { type: string, format: email }
|
||
responses:
|
||
"202": { description: Sent. }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/admin/tenants/{id}/members/{uid}:
|
||
patch:
|
||
summary: Change a member's role, or block / unblock the member in this workspace.
|
||
description: |
|
||
Staff (route group `admin`); attributed to `X-Staff-Subject` / `X-Staff-Email`.
|
||
Send exactly one of `role` or `blocked`. A role change rewrites the
|
||
member's `org_roles` attribute and takes effect at the member's next
|
||
login or token refresh. A block is per workspace: the tenant id is
|
||
added to the member's `org_blocked` user attribute (never
|
||
`enabled=false`), the member's Keycloak sessions are ended (realm
|
||
wide) and their active API keys are listed for revocation, not
|
||
revoked. Guards (409): `self` — nobody changes their own membership;
|
||
`last_admin` — the last active IT_ADMIN/OWNER cannot be demoted or
|
||
blocked. Audit: `user.role_changed` (from → to), `user.blocked`,
|
||
`user.unblocked`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
role: { type: string, enum: [IT_ADMIN, OWNER, CXO, FINANCE, LEGAL, USER, PSIRT, DEVELOPMENT, QUALITY, PRIVACY, PURCHASING, AUDITOR, EXTERNAL] }
|
||
blocked: { type: boolean }
|
||
responses:
|
||
"200":
|
||
description: Done (or `unchanged`).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/MemberAction" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
delete:
|
||
summary: Remove a member, or revoke a pending invitation.
|
||
description: |
|
||
Staff (route group `admin`); attributed to `X-Staff-Subject` / `X-Staff-Email`.
|
||
An accepted member loses the organization membership and the
|
||
workspace attributes; their sessions are ended and their active API
|
||
keys are listed for revocation (`user.removed`). A pending invitation
|
||
(no password set yet) is revoked: the membership goes, and the
|
||
Keycloak account is deleted only when this tenant's invitation created
|
||
it and it belongs to no other organization — which also voids the
|
||
link in the invitation mail (`user.invite_revoked`). Guards as for
|
||
PATCH.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
responses:
|
||
"200":
|
||
description: Removed or revoked.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/MemberAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/admin/tenants/{id}/members/{uid}/resend:
|
||
post:
|
||
summary: Send a pending member's invitation mail again.
|
||
description: |
|
||
Staff (route group `admin`); attributed to `X-Staff-Subject` / `X-Staff-Email`.
|
||
409 `not_pending` when the member has already accepted. Audit:
|
||
`user.invite_resent`.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: uid, required: true, schema: { type: string }, description: Keycloak user id of the member }
|
||
responses:
|
||
"202":
|
||
description: Sent.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/MemberAction" } }
|
||
"403": { $ref: "#/components/responses/Forbidden" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/admin/tenants/{id}/reprovision:
|
||
post:
|
||
summary: Repair a tenant's sign-in when its Keycloak organization or admin account is missing.
|
||
description: |
|
||
Creates the organization with the admin invited when it is missing, invites the admin into an
|
||
existing one, or sends the invitation again when the admin is already a member. The admin is
|
||
the one given, else the tenant's first admin on record.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: false
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
email: { type: string, format: email }
|
||
responses:
|
||
"200": { description: "Done: status is invited, resent or created_mail_failed." }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
|
||
/v1/admin/audit:
|
||
get:
|
||
summary: The audit log across all tenants (same filters as /v1/audit).
|
||
parameters:
|
||
- { in: query, name: tenant_id, schema: { type: string } }
|
||
- { in: query, name: action, schema: { type: string } }
|
||
- { in: query, name: cursor, schema: { type: integer } }
|
||
- { in: query, name: limit, schema: { type: integer, minimum: 1, maximum: 500 } }
|
||
responses:
|
||
"200": { description: One page of audit entries. }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
|
||
/v1/admin/tenants/{id}/documents:
|
||
get:
|
||
summary: A tenant's documents, drafts included (staff).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The documents, newest first.
|
||
content:
|
||
application/json:
|
||
schema: { type: object, properties: { items: { type: array, items: { $ref: "#/components/schemas/Document" } } } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
post:
|
||
summary: Upload a document as a draft (staff).
|
||
description: |
|
||
multipart/form-data with optional `title` and `description` fields
|
||
before the `file` part. The file is streamed to object storage (limit
|
||
DOCUMENTS_MAX_MB, default 200). Allowed: pdf, zip, docx, xlsx, pptx,
|
||
png, jpg, txt, csv, json, xml. The title defaults to the file name.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
required: [file]
|
||
properties:
|
||
title: { type: string, maxLength: 200 }
|
||
description: { type: string, maxLength: 2000 }
|
||
own_document: { type: string, enum: ["on", "true", "1"], description: "The tenant's own document: publishing it sends no mail." }
|
||
project_ids: { type: string, description: "Project ids of the tenant; repeat the field or separate with commas." }
|
||
file: { type: string, format: binary }
|
||
responses:
|
||
"201":
|
||
description: Stored as a draft.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Document" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"413": { description: Larger than the upload limit. }
|
||
"415": { description: File type not allowed. }
|
||
"503": { description: Document storage not configured. }
|
||
|
||
/v1/admin/documents/{doc}/publish:
|
||
post:
|
||
summary: Publish a draft so the tenant sees it (staff). Idempotent.
|
||
parameters:
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The published document.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Document" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/admin/documents/{doc}:
|
||
patch:
|
||
summary: Assign a document to projects and mark it as the tenant's own (staff).
|
||
description: |
|
||
`project_ids` replaces the set (an empty list removes all); every
|
||
project must belong to the document's tenant. `own_document` marks
|
||
the tenant's own files: shown like any other, but publishing them
|
||
sends no notification. Works on drafts and published documents.
|
||
parameters:
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
project_ids: { type: array, items: { type: string, format: uuid } }
|
||
own_document: { type: boolean }
|
||
responses:
|
||
"200":
|
||
description: The updated document.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Document" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
delete:
|
||
summary: Delete a document and its file (staff).
|
||
parameters:
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"204": { description: Deleted. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/admin/tenants/{id}/store/import:
|
||
post:
|
||
summary: Import a document-store bundle (staff only).
|
||
description: |
|
||
The body is a .tar.gz in the Factory's layout: LANE_B_INDEX_V1.json,
|
||
objects/<sha256>.(pdf|html|txt), presentation/CONSENT_BANNER_CAPTURES_V1.json
|
||
with presentation/consent_banner/<sha256>.json, chunks/<tenant_document_id>.json,
|
||
figure_assets/sources/sha256/<sha256>.<ext>, optionally the
|
||
LANE_B_UNIFIED_V5_RETURN_MANIFEST_V1.json (pin = its digest). Every file is
|
||
checked against its digest; keyed on tenant_document_id, so it can run
|
||
again. The answer lists each document's outcome, never its content.
|
||
Needs a named staff member (X-Staff-Subject).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/gzip: { schema: { type: string, format: binary } }
|
||
responses:
|
||
"200":
|
||
description: The outcome per document.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
documents:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
external_id: { type: string }
|
||
title: { type: string }
|
||
area: { type: string }
|
||
legal_kind: { type: string }
|
||
document_id: { type: string }
|
||
original: { type: string, enum: [imported, exists, rejected] }
|
||
prepared: { type: string, enum: [imported, unchanged, absent, rejected] }
|
||
consent: { type: string, enum: [imported, unchanged, absent, rejected] }
|
||
assets: { type: integer }
|
||
reason: { type: string }
|
||
counts: { type: object, additionalProperties: { type: integer } }
|
||
pin: { type: string }
|
||
revision: { type: integer }
|
||
"400": { description: "invalid_bundle: not a .tar.gz, an unsafe path or link, or no index." }
|
||
"403": { description: No named staff member (staff_only). }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"413": { description: Larger than STORE_IMPORT_MAX_MB. }
|
||
|
||
/v1/admin/tenants/{id}/company-profile:
|
||
get:
|
||
summary: A tenant's company profile (staff).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The profile.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfile" } }
|
||
"404": { description: The tenant does not exist or has no profile yet. }
|
||
put:
|
||
summary: Import a company profile (staff only).
|
||
description: |
|
||
Staff bring in a profile the customer filled in elsewhere. Needs a
|
||
named staff member (X-Staff-Subject); recorded as source "import"
|
||
in the history and as company_profile.imported in the audit log.
|
||
Same rules as the tenant PUT.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfileWrite" } }
|
||
responses:
|
||
"200":
|
||
description: Imported (or unchanged).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CompanyProfile" } }
|
||
"400": { description: "expected_revision_required, invalid_schema_version or invalid_profile." }
|
||
"403": { description: No named staff member (staff_only). }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/ProfileRevisionConflict" }
|
||
|
||
/v1/admin/tenants/{id}/avv-values:
|
||
get:
|
||
summary: The customer's details for the AVV (staff only).
|
||
description: |
|
||
From the company profile (company name as entered; street, ZIP and
|
||
city, the country unless Germany; the legal contact e-mail) and the
|
||
role dataset (the holders of r1.geschaeftsleitung by name). Missing
|
||
data is an empty string. values_sha256 is the SHA-256 of the JSON
|
||
object of the four ag_* fields in this order, for X-Values-SHA256.
|
||
The values are never logged or audited.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The values.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
ag_name: { type: string }
|
||
ag_anschrift: { type: string }
|
||
ag_vertreten: { type: string }
|
||
ag_weisung: { type: string }
|
||
values_sha256: { type: string }
|
||
"403": { description: No named staff member (staff_only). }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"503": { description: Keycloak's member list is not available. }
|
||
|
||
/v1/admin/tenants/{id}/contract-documents/avv:
|
||
put:
|
||
summary: Upload the AVV filled in for this tenant (staff only, audited).
|
||
description: |
|
||
The body is the PDF (at most 5 MB, starting with %PDF). It is stored
|
||
in the document bucket and becomes the tenant's current AVV; earlier
|
||
uploads stay. Audited as contract_document.uploaded (version and
|
||
digests only).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: header, name: X-Document-Version, required: true, schema: { type: string, example: 1.0.0 } }
|
||
- { in: header, name: X-Values-SHA256, required: true, schema: { type: string } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/pdf: { schema: { type: string, format: binary } }
|
||
responses:
|
||
"201": { description: Stored. }
|
||
"400": { description: "invalid_version or invalid_values_sha256." }
|
||
"403": { description: No named staff member (staff_only). }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"413": { description: Larger than 5 MB. }
|
||
"415": { description: Not a PDF (not_a_pdf). }
|
||
"503": { description: Document storage is not configured. }
|
||
|
||
/v1/admin/tenants/{id}/preview-grants:
|
||
post:
|
||
summary: Grant a preview of a product not for sale yet (staff only, audited).
|
||
description: |
|
||
Lets the tenant use the product (catalogue enabled=false allowed) until
|
||
expires_at, at most 180 days ahead. No catalogue or trial visibility,
|
||
no subscription, no ERP; usage under a preview is tagged preview=true
|
||
and never invoiced. A real booking replaces the grant. Needs a named
|
||
staff member (X-Staff-Subject) from a client with the admin group.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [product, expires_at]
|
||
properties:
|
||
product: { type: string }
|
||
expires_at: { type: string, format: date-time }
|
||
responses:
|
||
"201":
|
||
description: Granted (or extended).
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/TenantProduct" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"403": { description: "No named staff member." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: "The tenant has booked the product." }
|
||
|
||
/v1/admin/tenants/{id}/preview-grants/{product}:
|
||
delete:
|
||
summary: Revoke a preview grant (staff only, audited). A booking is never removed this way.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: product, required: true, schema: { type: string } }
|
||
responses:
|
||
"204": { description: Revoked. }
|
||
"403": { description: "No named staff member." }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/admin/tenants/{id}/managed-services:
|
||
get:
|
||
summary: A tenant's managed services with instance id and notes (staff).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The services, by created_at.
|
||
content:
|
||
application/json:
|
||
schema: { type: object, required: [items], properties: { items: { type: array, items: { $ref: "#/components/schemas/ManagedServiceAdmin" } } } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
post:
|
||
summary: Record a managed service of the tenant (staff).
|
||
description: |
|
||
Error codes (400): invalid_kind, invalid_name, invalid_url,
|
||
invalid_sku, invalid_status, invalid_instance_id, invalid_notes.
|
||
The staff member (X-Staff-Subject / X-Staff-Email) is the audit
|
||
actor of managed_service.created.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ManagedServiceCreate" } }
|
||
responses:
|
||
"201":
|
||
description: Created.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ManagedServiceAdmin" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: The tenant has a Git instance at this url (duplicate; several runners may share one). }
|
||
|
||
/v1/admin/tenants/{id}/managed-services/{sid}:
|
||
patch:
|
||
summary: Change a managed service (staff); the fields given are changed.
|
||
description: |
|
||
The kind is fixed. Same validation as create. Audited as
|
||
managed_service.updated with the changed fields and, when the
|
||
status moves, old_status and new_status.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: sid, required: true, schema: { type: string, format: uuid } }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ManagedServiceUpdate" } }
|
||
responses:
|
||
"200":
|
||
description: The service.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ManagedServiceAdmin" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { description: The tenant has a Git instance at this url (duplicate; several runners may share one). }
|
||
delete:
|
||
summary: Delete the record of a managed service (staff).
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: sid, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"204": { description: Deleted. }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/tenants/{id}/documents/{doc}/download:
|
||
get:
|
||
summary: A five-minute download link for a published document.
|
||
description: |
|
||
User tokens only reach their own tenant. A service client may name the
|
||
downloading person in `X-Portal-User-Email` for the audit log.
|
||
parameters:
|
||
- { in: path, name: id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: path, name: doc, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: The link.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
url: { type: string }
|
||
filename: { type: string }
|
||
content_type: { type: string }
|
||
expires_at: { type: string, format: date-time }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/notifications:
|
||
post:
|
||
summary: Ask the platform to tell a workspace something (route group notify).
|
||
description: |
|
||
Products report news for a workspace; the platform mails the members
|
||
whose bundle grants the kind's capability (findings.new:
|
||
registry:notify.findings), in the BreakPilot layout, through an outbox. Demo tenants and
|
||
tenants without an organization get nothing. Idempotent per
|
||
idempotency_key.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [tenant_id, kind, idempotency_key, data]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
kind: { type: string, enum: [findings.new] }
|
||
idempotency_key: { type: string, maxLength: 200 }
|
||
data:
|
||
type: object
|
||
required: [target_name, new_count]
|
||
properties:
|
||
target_name: { type: string, maxLength: 200 }
|
||
new_count: { type: integer, minimum: 1 }
|
||
critical: { type: integer }
|
||
high: { type: integer }
|
||
medium: { type: integer }
|
||
low: { type: integer }
|
||
url: { type: string, description: "https link into the product; defaults to the portal dashboard" }
|
||
responses:
|
||
"202":
|
||
description: Queued (queued = number of recipients, 0 for a repeat).
|
||
content:
|
||
application/json: { schema: { type: object, properties: { queued: { type: integer } } } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/entitlements:
|
||
get:
|
||
summary: List product entitlements for a tenant.
|
||
parameters:
|
||
- in: query
|
||
name: tenant_id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"200":
|
||
description: List response.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/TenantProduct" }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/internal/entitlements/check:
|
||
post:
|
||
summary: Is this tenant entitled to this product (and add-on) right now?
|
||
description: |
|
||
The authoritative entitlement answer (PRODUCT_INTEGRATION_SPEC 2.0
|
||
§4.4). Products cache it for ≤ 60 s and fail closed when the
|
||
registry is unreachable. `read_only` reflects the ladder
|
||
(restricted); `halted` and `archived` are never allowed.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [tenant_id, product]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
addon: { type: string, description: "add-on id from the catalog, e.g. werkbank" }
|
||
user_id: { type: string, description: "optional Keycloak user id; a member blocked in the tenant gets reason member_blocked (portal#74)" }
|
||
responses:
|
||
"200":
|
||
description: Decision.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/EntitlementCheck" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
|
||
/v1/catalog:
|
||
get:
|
||
summary: List the products available for any tenant to request.
|
||
responses:
|
||
"200":
|
||
description: Catalog.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/CatalogEntry" }
|
||
|
||
/v1/catalog/request:
|
||
post:
|
||
summary: Request a product (creates an audit event; sales follows up).
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CatalogRequest" } }
|
||
responses:
|
||
"202":
|
||
description: Accepted.
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/catalog/trial-request:
|
||
post:
|
||
summary: Self-serve a 14-day trial.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/CatalogRequest" } }
|
||
responses:
|
||
"201":
|
||
description: Trial entitlement created.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/TenantProduct" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/api-keys:
|
||
get:
|
||
summary: List API keys for a tenant.
|
||
parameters:
|
||
- in: query
|
||
name: tenant_id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"200":
|
||
description: List response. The plaintext key is NOT returned;
|
||
use the create endpoint and store the value immediately.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/APIKey" }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
post:
|
||
summary: Create an API key. The plaintext is returned ONCE.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/APIKeyCreate" } }
|
||
responses:
|
||
"201":
|
||
description: Created. The plaintext field is shown only here.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/APIKeyCreated" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"409": { $ref: "#/components/responses/Conflict" }
|
||
"422":
|
||
description: A scope needs a product the tenant is not entitled to.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
|
||
/v1/api-keys/scopes:
|
||
get:
|
||
summary: The API key scope catalogue (for the portal's scope picker).
|
||
responses:
|
||
"200":
|
||
description: Every grantable scope.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/APIKeyScope" }
|
||
|
||
/v1/api-keys/{id}:
|
||
delete:
|
||
summary: Revoke an API key (sets revoked_at).
|
||
description: With tenant_id the key must belong to that tenant, else 404.
|
||
Products cache verify results for up to 60 s, so a revocation takes
|
||
up to a minute to reach them.
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
- in: query
|
||
name: tenant_id
|
||
required: false
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"204":
|
||
description: Revoked.
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/users/{id}/memberships:
|
||
get:
|
||
summary: Resolve which tenants a user belongs to (membership authority).
|
||
description: |
|
||
The B2 membership-authority endpoint (ratified compliance auth
|
||
design). Product backends call this with the JWT `sub` instead of
|
||
trusting token claims or client-supplied headers. Keycloak supplies
|
||
the user→tenant links and org_roles; where the tenant is registered
|
||
here, tenant_status / plan / products are overridden from registry
|
||
tables (source: "registry"), otherwise the Keycloak attribute
|
||
projection is returned as-is (source: "keycloak").
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
description: Keycloak user id (the JWT `sub`).
|
||
schema: { type: string }
|
||
responses:
|
||
"200":
|
||
description: Memberships (possibly empty) for the user.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [user_id, memberships]
|
||
properties:
|
||
user_id: { type: string }
|
||
memberships:
|
||
type: array
|
||
items:
|
||
allOf:
|
||
- $ref: "#/components/schemas/Claims"
|
||
- type: object
|
||
required: [source]
|
||
properties:
|
||
source: { type: string, enum: [registry, keycloak] }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
"503":
|
||
description: Keycloak unreachable — membership cannot be resolved.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
|
||
/v1/internal/keycloak/claims:
|
||
post:
|
||
summary: Resolve the up-to-date claim bundle for a user/tenant.
|
||
description: |
|
||
Called by Keycloak's protocol mapper at token issuance (or by
|
||
any operator on demand) to fetch the current tenant_id /
|
||
tenant_slug / org_roles / products / plan / tenant_status
|
||
claims. Lookup tries tenant_id, then tenant_slug, then
|
||
user_attrs.tenant_id, then user_attrs.tenant_slug.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
tenant_slug: { type: string }
|
||
user_attrs:
|
||
type: object
|
||
additionalProperties: { type: string }
|
||
responses:
|
||
"200":
|
||
description: Resolved claim bundle.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Claims" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/internal/api-keys/verify:
|
||
post:
|
||
summary: Verify an API key. Used by headless products. Returns
|
||
200 with valid=false on any failure (never 401).
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [key]
|
||
properties:
|
||
key: { type: string }
|
||
responses:
|
||
"200":
|
||
description: Verification result.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/APIKeyVerify" } }
|
||
|
||
/v1/audit:
|
||
post:
|
||
summary: Append an audit event.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/AuditAppend" } }
|
||
responses:
|
||
"201":
|
||
description: Created.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/AuditEvent" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
get:
|
||
summary: List audit events (paginated, cursor-based).
|
||
parameters:
|
||
- in: query
|
||
name: tenant_id
|
||
schema: { type: string, format: uuid }
|
||
- in: query
|
||
name: product
|
||
schema: { type: string }
|
||
- in: query
|
||
name: actor_id
|
||
schema: { type: string }
|
||
- in: query
|
||
name: action
|
||
schema: { type: string }
|
||
- in: query
|
||
name: since
|
||
schema: { type: string, format: date-time }
|
||
- in: query
|
||
name: until
|
||
schema: { type: string, format: date-time }
|
||
- in: query
|
||
name: limit
|
||
schema: { type: integer, minimum: 1, maximum: 500 }
|
||
- in: query
|
||
name: cursor
|
||
schema: { type: integer, format: int64 }
|
||
responses:
|
||
"200":
|
||
description: Paginated response. next_cursor is omitted when
|
||
there are no more pages.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/AuditEvent" }
|
||
next_cursor:
|
||
type: integer
|
||
format: int64
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
|
||
/v1/internal/erp/webhook:
|
||
post:
|
||
summary: ERPNext webhook receiver (HMAC-signed, no bearer token).
|
||
description: |
|
||
PUBLIC_EXPLICIT. Body is signed with ERP_WEBHOOK_SECRET
|
||
(X-Frappe-Webhook-Signature = base64 HMAC-SHA256, or
|
||
X-Hub-Signature-256 = sha256=hex). Idempotent by X-Frappe-Event-Id
|
||
(fallback: hash of event+name+modified+body). Events:
|
||
sales_order.submit → subscriptions + entitlements + active;
|
||
sales_invoice.overdue → warning / restricted (days_overdue ≥
|
||
ERP_RESTRICT_AFTER_DAYS) / halted; payment_entry.submit → active;
|
||
subscription.cancel → halted. Unknown customers are acknowledged (202).
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ErpWebhookEvent" } }
|
||
responses:
|
||
"200": { description: "Applied, unchanged or duplicate." }
|
||
"202": { description: "Ignored (tenant not found)." }
|
||
"401": { description: Bad signature. }
|
||
"503": { description: ERP_WEBHOOK_SECRET not configured. }
|
||
|
||
/v1/internal/erp/status:
|
||
get:
|
||
summary: ERP link status (outbox backlog, webhook/licence configuration).
|
||
responses:
|
||
"200":
|
||
description: Status.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
erp_configured: { type: boolean }
|
||
webhook_enabled: { type: boolean }
|
||
outbox_pending: { type: integer }
|
||
licences_enabled: { type: boolean }
|
||
llm_keys_enabled: { type: boolean }
|
||
|
||
/v1/internal/erp/reconcile:
|
||
post:
|
||
summary: Run one reconcile pass now (ops / tests).
|
||
description: |
|
||
Mirrors ERP subscriptions for every tenant with an ERP customer and
|
||
applies the time-based ladder steps (trial expiry, warning →
|
||
restricted, restricted → halted, halted → archived). Runs every
|
||
ERP_RECONCILE_INTERVAL in the background as well.
|
||
responses:
|
||
"200":
|
||
description: Report.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/ReconcileReport" } }
|
||
|
||
/v1/subscriptions:
|
||
get:
|
||
summary: Subscriptions mirrored from ERPNext for one tenant.
|
||
parameters:
|
||
- in: query
|
||
name: tenant_id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"200":
|
||
description: List.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/Subscription" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/usage/events:
|
||
post:
|
||
summary: Push usage events (PRODUCT_INTEGRATION_SPEC 2.0 §9.2).
|
||
description: |
|
||
One event, an array, or {"events": [...]} (≤ 500). Idempotent by
|
||
idempotency_key; each new event is forwarded to ERPNext as a Usage
|
||
Record through the outbox. User tokens may only report for their
|
||
own tenant.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
oneOf:
|
||
- $ref: "#/components/schemas/UsageEventIn"
|
||
- type: array
|
||
items: { $ref: "#/components/schemas/UsageEventIn" }
|
||
- type: object
|
||
properties:
|
||
events:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/UsageEventIn" }
|
||
responses:
|
||
"202":
|
||
description: "Accepted (partial rejections listed)."
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
accepted: { type: integer }
|
||
duplicates: { type: integer }
|
||
rejected: { type: array, items: { type: object } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
get:
|
||
summary: Query usage events.
|
||
parameters:
|
||
- { in: query, name: tenant_id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: query, name: product, schema: { type: string } }
|
||
- { in: query, name: metric, schema: { type: string } }
|
||
- { in: query, name: since, schema: { type: string, format: date-time } }
|
||
- { in: query, name: until, schema: { type: string, format: date-time } }
|
||
- { in: query, name: limit, schema: { type: integer, minimum: 1, maximum: 1000 } }
|
||
responses:
|
||
"200":
|
||
description: Newest first.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/UsageEvent" }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
|
||
/v1/usage/summary:
|
||
get:
|
||
summary: Aggregate usage events (counts and quantity sums).
|
||
description: |
|
||
Aggregates every matching event, with no row cap (the list route
|
||
stops at 1000): totals per product × metric, and per UTC day ×
|
||
metric summed across products. The portal's 30-day views read this.
|
||
Same filters and scoping as GET /v1/usage/events (bounds
|
||
inclusive; user tokens see only their own tenant); route group
|
||
usage.read. Totals are ordered by product, metric; daily by day,
|
||
metric. An unknown tenant yields an empty summary.
|
||
parameters:
|
||
- { in: query, name: tenant_id, required: true, schema: { type: string, format: uuid } }
|
||
- { in: query, name: product, schema: { type: string } }
|
||
- { in: query, name: metric, schema: { type: string } }
|
||
- { in: query, name: since, schema: { type: string, format: date-time } }
|
||
- { in: query, name: until, schema: { type: string, format: date-time } }
|
||
responses:
|
||
"200":
|
||
description: The aggregate.
|
||
content:
|
||
application/json:
|
||
schema: { $ref: "#/components/schemas/UsageSummary" }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
|
||
/v1/licences:
|
||
post:
|
||
summary: Issue a CLI licence JWT (Werkpilot, Firmwerk).
|
||
description: |
|
||
Requires an active entitlement for the product. User tokens (device
|
||
flow, tenant-context claims) get a licence for their own tenant;
|
||
service tokens pass tenant_id. Ed25519-signed (EdDSA), verifiable
|
||
offline against /.well-known/licence-keys.json; expiry = min(ttl,
|
||
entitlement expiry). Grace ladder inside the token. For
|
||
product=werkpilot the registry also provisions a per-tenant LiteLLM
|
||
virtual key (budget by plan) and returns it once as llm_api_key; a
|
||
LiteLLM failure does not fail the licence (warnings:
|
||
["llm_key_unavailable"]). Revoking the licence deletes the key.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [product]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
device: { type: string }
|
||
ttl_days: { type: integer }
|
||
responses:
|
||
"201":
|
||
description: Issued.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/LicenceIssued" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"403": { description: Not entitled. }
|
||
"503": { description: Licence signer not configured. }
|
||
get:
|
||
summary: List licences of a tenant.
|
||
parameters:
|
||
- { in: query, name: tenant_id, required: true, schema: { type: string, format: uuid } }
|
||
responses:
|
||
"200":
|
||
description: List.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
items:
|
||
type: array
|
||
items: { $ref: "#/components/schemas/Licence" }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/licences/{id}/revoke:
|
||
post:
|
||
summary: Revoke a licence (next heartbeat reports `revoked`).
|
||
parameters:
|
||
- in: path
|
||
name: id
|
||
required: true
|
||
schema: { type: string, format: uuid }
|
||
responses:
|
||
"200":
|
||
description: Revoked.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Licence" } }
|
||
"404": { $ref: "#/components/responses/NotFound" }
|
||
|
||
/v1/licences/heartbeat:
|
||
post:
|
||
summary: CLI phone-home (PUBLIC_EXPLICIT — the licence JWT is the credential).
|
||
description: |
|
||
Reports ok | warning | degraded | hard_stop | revoked from the tenant
|
||
ladder and the token's grace policy, records last_seen, and returns a
|
||
renewed licence once the current one is past half-life while the
|
||
tenant is still entitled.
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [licence]
|
||
properties:
|
||
licence: { type: string }
|
||
responses:
|
||
"200":
|
||
description: State.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/LicenceHeartbeat" } }
|
||
"401": { description: "Signature invalid or licence unknown." }
|
||
"503": { description: Licence signer not configured. }
|
||
|
||
/v1/licences/ci:
|
||
post:
|
||
summary: CI licence (PUBLIC_EXPLICIT — a tenant API key is the credential).
|
||
description: |
|
||
For CI jobs without a browser (ADR 0001 §5). The bearer is a registry
|
||
API key with scope `<product>:licence`; the tenant comes from the key.
|
||
The licence lives 24 h, carries `kind: ci`, has no heartbeat and is
|
||
not a seat. A repeat for the same key, device and UTC day returns the
|
||
existing licence (200) — except Werkpilot, whose licence carries a
|
||
LiteLLM key (expiring after 1 day) and is issued fresh each call.
|
||
At most 60 calls per key and hour.
|
||
security: []
|
||
parameters:
|
||
- in: header
|
||
name: Authorization
|
||
required: true
|
||
schema: { type: string, example: "Bearer bp_…" }
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
required: [product, device]
|
||
properties:
|
||
product: { type: string }
|
||
device: { type: string, maxLength: 200, description: "runner name; stored as ci:<device>" }
|
||
responses:
|
||
"200":
|
||
description: The licence already issued today for this key and device.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/LicenceIssued" } }
|
||
"201":
|
||
description: Issued.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/LicenceIssued" } }
|
||
"400": { $ref: "#/components/responses/BadRequest" }
|
||
"401": { description: "API key missing, unknown, revoked or expired." }
|
||
"403": { description: "Scope <product>:licence missing or product not booked." }
|
||
"429": { description: "More than 60 calls for this key in the last hour." }
|
||
"503": { description: Licence signer not configured. }
|
||
|
||
/.well-known/licence-keys.json:
|
||
get:
|
||
summary: Licence verification keys (JWKS, OKP/Ed25519). PUBLIC_EXPLICIT.
|
||
responses:
|
||
"200":
|
||
description: JWKS.
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
keys: { type: array, items: { type: object } }
|
||
|
||
components:
|
||
securitySchemes:
|
||
bearerAuth:
|
||
type: http
|
||
scheme: bearer
|
||
bearerFormat: JWT
|
||
description: |
|
||
Keycloak-issued token (client_credentials for services). Enforced
|
||
on all non-health routes when AUTH_ENABLED=true.
|
||
|
||
responses:
|
||
BadRequest:
|
||
description: Input failed validation.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
NotFound:
|
||
description: Resource does not exist.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
Conflict:
|
||
description: Resource already exists / unique violation.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
Forbidden:
|
||
description: The caller may not perform this operation.
|
||
content:
|
||
application/json: { schema: { $ref: "#/components/schemas/Error" } }
|
||
|
||
ProfileRevisionConflict:
|
||
description: The profile was changed since the writer read it (revision_conflict).
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
error: { type: string, example: revision_conflict }
|
||
message: { type: string }
|
||
current_revision: { type: integer, description: "The revision to reload; 0 when there is no profile." }
|
||
schemas:
|
||
ErpWebhookEvent:
|
||
type: object
|
||
required: [event, name]
|
||
properties:
|
||
event: { type: string, enum: [sales_order.submit, sales_invoice.overdue, payment_entry.submit, subscription.cancel] }
|
||
doctype: { type: string }
|
||
name: { type: string }
|
||
modified: { type: string }
|
||
customer: { type: string, description: "ERP customer name (tenants.erp_customer_id)" }
|
||
tenant_id: { type: string, format: uuid, description: "Custom field on the Customer; preferred over customer" }
|
||
items:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
item_code: { type: string, description: "Platform SKU" }
|
||
qty: { type: number }
|
||
days_overdue: { type: integer }
|
||
subscription: { type: string }
|
||
invoice: { type: string }
|
||
amount: { type: number }
|
||
ReconcileReport:
|
||
type: object
|
||
properties:
|
||
tenants: { type: integer }
|
||
erp_checked: { type: integer }
|
||
changed: { type: array, items: { type: string } }
|
||
escalated: { type: array, items: { type: string } }
|
||
errors: { type: array, items: { type: string } }
|
||
erp_available: { type: boolean }
|
||
Subscription:
|
||
type: object
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
sku: { type: string }
|
||
plan: { type: string }
|
||
seats: { type: integer }
|
||
status: { type: string, enum: [active, cancelled] }
|
||
erp_sales_order: { type: string }
|
||
erp_subscription: { type: string }
|
||
period_start: { type: string, format: date-time }
|
||
period_end: { type: string, format: date-time }
|
||
created_at: { type: string, format: date-time }
|
||
updated_at: { type: string, format: date-time }
|
||
UsageEventIn:
|
||
type: object
|
||
required: [idempotency_key, tenant_id, product, metric]
|
||
properties:
|
||
idempotency_key: { type: string }
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
metric: { type: string, description: "e.g. scan.completed, target.added, seat.login" }
|
||
quantity: { type: number, default: 1 }
|
||
occurred_at: { type: string, format: date-time }
|
||
properties: { type: object, additionalProperties: true }
|
||
UsageEvent:
|
||
allOf:
|
||
- $ref: "#/components/schemas/UsageEventIn"
|
||
- type: object
|
||
properties:
|
||
id: { type: integer }
|
||
received_at: { type: string, format: date-time }
|
||
erp_synced_at: { type: string, format: date-time }
|
||
UsageSummary:
|
||
type: object
|
||
required: [tenant_id, events, totals, daily]
|
||
properties:
|
||
tenant_id: { type: string }
|
||
since: { type: string, format: date-time }
|
||
until: { type: string, format: date-time }
|
||
events: { type: integer, description: "Matching events in the window." }
|
||
totals:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required: [product, metric, events, quantity, last_at]
|
||
properties:
|
||
product: { type: string }
|
||
metric: { type: string }
|
||
events: { type: integer }
|
||
quantity: { type: number, description: "Sum of the events' quantity." }
|
||
last_at: { type: string, format: date-time, description: "Latest occurred_at (UTC)." }
|
||
daily:
|
||
type: array
|
||
items:
|
||
type: object
|
||
required: [day, metric, events, quantity]
|
||
properties:
|
||
day: { type: string, format: date, description: "UTC day, YYYY-MM-DD." }
|
||
metric: { type: string }
|
||
events: { type: integer }
|
||
quantity: { type: number }
|
||
Licence:
|
||
type: object
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
kid: { type: string }
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
subject: { type: string }
|
||
device: { type: string }
|
||
expires_at: { type: string, format: date-time }
|
||
revoked_at: { type: string, format: date-time }
|
||
last_seen_at: { type: string, format: date-time }
|
||
created_at: { type: string, format: date-time }
|
||
llm_key_id: { type: string, description: "LiteLLM hashed token id of the key issued with a Werkpilot licence (handle for revoke; never the secret)." }
|
||
LicenceIssued:
|
||
type: object
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
licence: { type: string, description: "EdDSA JWT" }
|
||
kid: { type: string }
|
||
expires_at: { type: string, format: date-time }
|
||
grace:
|
||
type: object
|
||
properties:
|
||
warning_days: { type: integer }
|
||
degraded_days: { type: integer }
|
||
hard_stop_days: { type: integer }
|
||
status: { type: string }
|
||
llm_api_key:
|
||
type: string
|
||
description: |
|
||
Werkpilot only: per-tenant LiteLLM virtual key (sk-…). Returned in
|
||
THIS response only — never persisted, never returned again. Absent
|
||
on heartbeat renewals (the CLI keeps the key it stored) and when
|
||
LiteLLM is unavailable (see warnings).
|
||
llm_base_url: { type: string, description: "OpenAI-compatible proxy root the key is valid for." }
|
||
warnings:
|
||
type: array
|
||
items: { type: string, enum: [llm_key_unavailable] }
|
||
description: Non-fatal issue notes; the licence itself is valid.
|
||
LicenceHeartbeat:
|
||
type: object
|
||
properties:
|
||
status: { type: string, enum: [ok, warning, degraded, hard_stop, revoked] }
|
||
tenant_status: { $ref: "#/components/schemas/TenantStatus" }
|
||
expires_at: { type: string, format: date-time }
|
||
reason: { type: string }
|
||
renewed: { $ref: "#/components/schemas/LicenceIssued" }
|
||
TenantStatus:
|
||
type: string
|
||
enum: [demo, trial, active, warning, restricted, frozen, halted, archived]
|
||
|
||
EntitlementCheck:
|
||
type: object
|
||
required: [allowed, read_only]
|
||
properties:
|
||
allowed: { type: boolean }
|
||
read_only: { type: boolean }
|
||
status: { $ref: "#/components/schemas/TenantStatus" }
|
||
limits:
|
||
type: object
|
||
additionalProperties: true
|
||
description: |
|
||
tenant_products.config — purchased limits. For pruefwerk always
|
||
also `included_targets`, `monthly_pruefungen` (Standard 5/100,
|
||
Business 25/500, Enterprise null; no plan SKU counts as Standard)
|
||
and `prueftag_cap` (the workspace's monthly cap on Prüftage,
|
||
null when none is set and always null on Enterprise). null means
|
||
unlimited.
|
||
expires_at: { type: string, format: date-time, nullable: true }
|
||
reason: { type: string, enum: [unknown_product, unknown_addon, tenant_not_found, tenant_archived, tenant_halted, entitlement_disabled, entitlement_expired, preview_expired, addon_not_purchased, not_entitled, member_blocked, user_unknown] }
|
||
preview: { type: boolean, description: "allowed through a staff preview grant; usage under it is not invoiced" }
|
||
|
||
ProductAddon:
|
||
type: object
|
||
required: [id, name]
|
||
properties:
|
||
id: { type: string }
|
||
name: { type: string }
|
||
limit_key: { type: string }
|
||
skus: { type: array, items: { type: string } }
|
||
|
||
Claims:
|
||
type: object
|
||
required: [tenant_id, tenant_slug, plan, tenant_status]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
tenant_slug: { type: string }
|
||
org_roles: { type: array, items: { type: string } }
|
||
products: { type: array, items: { type: string } }
|
||
plan: { type: string }
|
||
tenant_status: { $ref: "#/components/schemas/TenantStatus" }
|
||
|
||
ContractDocument:
|
||
type: object
|
||
required: [id, kind, title, version, date, sha256, tenant_specific]
|
||
properties:
|
||
id: { type: string, example: lb-pruefwerk }
|
||
kind: { type: string, enum: [agb, avv, tom, lb] }
|
||
title: { type: string }
|
||
version: { type: string, example: 1.0.3 }
|
||
date: { type: string, description: "Stand, DD.MM.YYYY", example: 09.11.2026 }
|
||
sha256: { type: string }
|
||
product: { type: string, description: The product a Leistungsbeschreibung belongs to. }
|
||
managed_service: { type: string, description: The managed service kind a Leistungsbeschreibung belongs to. }
|
||
tenant_specific: { type: boolean, description: The tenant's own filled copy (AVV). }
|
||
|
||
Error:
|
||
type: object
|
||
required: [error]
|
||
properties:
|
||
error: { type: string, example: invalid_input }
|
||
message: { type: string }
|
||
|
||
Document:
|
||
type: object
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
title: { type: string }
|
||
description: { type: string }
|
||
filename: { type: string }
|
||
content_type: { type: string }
|
||
size_bytes: { type: integer }
|
||
sha256: { type: string }
|
||
status: { type: string, enum: [draft, published] }
|
||
uploaded_by: { type: string }
|
||
published_by: { type: string }
|
||
published_at: { type: string, format: date-time }
|
||
created_at: { type: string, format: date-time }
|
||
own_document: { type: boolean, description: "The tenant's own file; publishing sends no mail." }
|
||
project_ids: { type: array, items: { type: string, format: uuid } }
|
||
Project:
|
||
type: object
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
name: { type: string }
|
||
kind: { type: string, enum: [product, topic] }
|
||
level: { type: string, enum: [family, product, component], description: "Products only (0020): where it sits in family -> product -> component. Absent for topics." }
|
||
parent_id: { type: string, format: uuid, description: "The project above it (family for a product; product or component for a component). Absent at the top." }
|
||
description: { type: string }
|
||
created_by: { type: string }
|
||
created_at: { type: string, format: date-time }
|
||
updated_at: { type: string, format: date-time }
|
||
ProjectWrite:
|
||
type: object
|
||
properties:
|
||
name: { type: string, minLength: 1, maxLength: 120 }
|
||
kind: { type: string, enum: [product, topic], description: "product: one of the customer's products or machines; topic: e.g. CRA, Data Act" }
|
||
description: { type: string, maxLength: 1000 }
|
||
level: { type: string, enum: [family, product, component], description: "Products only; defaults to product. A family has no parent, a product sits below a family or nothing, a component below a product or component; at most 4 levels." }
|
||
parent_id: { type: string, description: "uuid of the project above, \"\" to detach. Must be a product project of the same tenant that fits the level." }
|
||
StoreDocument:
|
||
type: object
|
||
required: [id, tenant_id, title, filename, sha256, area, processing_status]
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
title: { type: string }
|
||
filename: { type: string }
|
||
content_type: { type: string }
|
||
size_bytes: { type: integer }
|
||
sha256: { type: string }
|
||
area: { type: string, enum: [legal_web, product_public, internal] }
|
||
legal_kind: { type: string, enum: [impressum, dse, cookie, agb, widerruf, barrierefreiheit, entsorgung, vsbg] }
|
||
processing_status: { type: string, enum: [none, pending, ready, failed] }
|
||
processing_error: { type: string }
|
||
external_id: { type: string, description: "The Factory's tenant_document_id, for imported documents." }
|
||
project_ids: { type: array, items: { type: string } }
|
||
uploaded_by: { type: string }
|
||
created_at: { type: string, format: date-time }
|
||
preparation:
|
||
type: object
|
||
nullable: true
|
||
properties:
|
||
format: { type: string }
|
||
revision: { type: integer }
|
||
chunk_count: { type: integer }
|
||
has_chunks: { type: boolean }
|
||
has_consent: { type: boolean }
|
||
assets: { type: integer }
|
||
delivered_at: { type: string, format: date-time }
|
||
CompanyProfile:
|
||
type: object
|
||
required: [tenant_id, data, schema_version, revision, status, updated_by, updated_at]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
data: { $ref: "#/components/schemas/CompanyProfileDocument" }
|
||
schema_version: { type: string, description: "The portal form's schema the answers follow." }
|
||
revision: { type: integer, minimum: 1 }
|
||
status: { type: string, enum: [draft, submitted] }
|
||
updated_by: { type: string }
|
||
updated_at: { type: string, format: date-time }
|
||
submitted_by: { type: string }
|
||
submitted_at: { type: string, format: date-time }
|
||
RoleDatasetWrite:
|
||
type: object
|
||
required: [data, catalogue_version, expected_revision]
|
||
properties:
|
||
data: { $ref: "#/components/schemas/RoleDataset" }
|
||
catalogue_version: { type: string, description: "The catalogue the client read; another one is refused (catalogue_outdated)." }
|
||
expected_revision: { type: integer, minimum: 0 }
|
||
authorize: { type: array, items: { type: string }, description: "Ids of deputies and standard releases management authorizes." }
|
||
IntakeReportWrite:
|
||
type: object
|
||
required: [danger, what]
|
||
properties:
|
||
danger: { type: string, enum: ["yes", "no", "unknown"], description: "Immediate danger to people? Asked first." }
|
||
about: { type: string, enum: [product, it_ot, unknown], default: unknown, description: The reporter's own account; no assessment. }
|
||
what: { type: string, maxLength: 20000, description: What was noticed. }
|
||
when: { type: string, maxLength: 500 }
|
||
where: { type: string, maxLength: 500, description: "Where, or which product." }
|
||
contact: { type: string, maxLength: 500, description: Contact for questions. }
|
||
IntakeReport:
|
||
type: object
|
||
properties:
|
||
reference: { type: string, example: SH-2026-00001, description: The Eingangsreferenz; the Meldereferenz is the same string. }
|
||
received_at: { type: string, format: date-time }
|
||
about: { type: string }
|
||
danger: { type: string }
|
||
handover: { type: string, enum: ["", waiting, delivered, processed, refused] }
|
||
entries: { type: array, items: { $ref: "#/components/schemas/IntakeEntry" } }
|
||
IntakeEntry:
|
||
type: object
|
||
properties:
|
||
id: { type: integer }
|
||
kind: { type: string, enum: [capture, supplement] }
|
||
at: { type: string, format: date-time }
|
||
receipts:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
status: { type: string }
|
||
reason: { type: string }
|
||
handoff_id: { type: string }
|
||
run_id: { type: string }
|
||
at: { type: string, format: date-time }
|
||
PendingIntake:
|
||
type: object
|
||
properties:
|
||
entry_id: { type: integer }
|
||
tenant_id: { type: string, format: uuid }
|
||
reference: { type: string }
|
||
kind: { type: string, enum: [capture, supplement] }
|
||
at: { type: string, format: date-time }
|
||
received_at: { type: string, format: date-time }
|
||
channel: { type: string }
|
||
about: { type: string }
|
||
danger: { type: string }
|
||
status: { type: string, description: "The newest receipt's status, if any." }
|
||
reason: { type: string }
|
||
handoff_id: { type: string, description: "The newest receipt's handoff, if any." }
|
||
capture_settled: { type: boolean, description: "The report's capture is processed or refused; a supplement goes on only after it." }
|
||
RoleDatasetState:
|
||
type: object
|
||
required: [tenant_id, revision, catalogue_version, data, derived, catalogue]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
revision: { type: integer, minimum: 0 }
|
||
catalogue_version: { type: string }
|
||
updated_by: { type: string, description: "Keycloak sub of the last writer." }
|
||
updated_at: { type: string, format: date-time }
|
||
data: { $ref: "#/components/schemas/RoleDataset" }
|
||
derived:
|
||
type: object
|
||
properties:
|
||
deputies:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id: { type: string }
|
||
state: { type: string, enum: [wirksam, hinterlegt] }
|
||
reasons: { type: array, items: { type: string, enum: [basis_missing, not_yet_valid, expired, authorization_missing] } }
|
||
catalogue: { type: object, description: "Functions (key, label, sources, per, multiple, external, d02_row), decision types (key, label, default) and document keys." }
|
||
PruefwerkSettings:
|
||
type: object
|
||
required: [tenant_id, product, prueftag_cap, plan, cap_applies]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string, enum: [pruefwerk] }
|
||
prueftag_cap: { type: integer, minimum: 0, maximum: 10000, nullable: true }
|
||
plan: { type: string, enum: [standard, business, enterprise], description: "the Prüfwerk plan the limits come from" }
|
||
cap_applies: { type: boolean, description: "false on Enterprise: the cap is kept but not applied" }
|
||
updated_by: { type: string }
|
||
updated_at: { type: string, format: date-time }
|
||
RoleDatasetRevision:
|
||
type: object
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
revision: { type: integer, minimum: 1 }
|
||
catalogue_version: { type: string }
|
||
updated_by: { type: string }
|
||
updated_at: { type: string, format: date-time }
|
||
data: { $ref: "#/components/schemas/RoleDataset" }
|
||
RoleDatasetResolution:
|
||
type: object
|
||
properties:
|
||
revision: { type: integer, minimum: 0 }
|
||
catalogue_version: { type: string }
|
||
decision_type: { type: string }
|
||
function: { type: string }
|
||
source: { type: string, enum: [company, default] }
|
||
any_member: { type: boolean }
|
||
holders: { type: array, items: { $ref: "#/components/schemas/RoleHolder" } }
|
||
deputies:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id: { type: string }
|
||
holder: { $ref: "#/components/schemas/RoleHolder" }
|
||
state: { type: string, enum: [wirksam] }
|
||
status: { type: string, enum: [besetzt, rolle_offen, nicht_anwendbar] }
|
||
RoleDatasetHolders:
|
||
type: object
|
||
properties:
|
||
revision: { type: integer, minimum: 0 }
|
||
catalogue_version: { type: string }
|
||
function: { type: string }
|
||
label: { type: string, description: "the function's name in the catalogue" }
|
||
any_member: { type: boolean }
|
||
holders: { type: array, items: { $ref: "#/components/schemas/RoleHolder" } }
|
||
deputies:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
id: { type: string }
|
||
holder: { $ref: "#/components/schemas/RoleHolder" }
|
||
state: { type: string, enum: [wirksam] }
|
||
status: { type: string, enum: [besetzt, rolle_offen, nicht_anwendbar] }
|
||
RoleHolder:
|
||
type: object
|
||
required: [kind]
|
||
properties:
|
||
kind: { type: string, enum: [member, external, not_applicable] }
|
||
sub: { type: string }
|
||
name: { type: string }
|
||
organisation: { type: string }
|
||
contact: { type: string }
|
||
module_decision_ref: { type: string }
|
||
RoleDataset:
|
||
type: object
|
||
description: |
|
||
One document per company; sections follow A1 §2.3. Unknown keys are
|
||
refused at any level. Keys of functions and decision types come from
|
||
the catalogue (internal/roles).
|
||
additionalProperties: false
|
||
properties:
|
||
assignments: { type: array, maxItems: 500, items: { type: object } }
|
||
deputies: { type: array, maxItems: 500, items: { type: object } }
|
||
authority: { type: array, maxItems: 500, items: { type: object } }
|
||
immediate_authority: { type: array, maxItems: 500, items: { type: object } }
|
||
standard_releases: { type: array, maxItems: 500, items: { type: object } }
|
||
editors: { type: array, maxItems: 500, items: { type: object } }
|
||
critical_contact: { type: array, maxItems: 500, items: { type: object } }
|
||
CompanyProfileWrite:
|
||
type: object
|
||
required: [data, schema_version, expected_revision]
|
||
properties:
|
||
data: { $ref: "#/components/schemas/CompanyProfileDocument" }
|
||
schema_version: { type: string, minLength: 1, maxLength: 40 }
|
||
expected_revision: { type: integer, minimum: 0 }
|
||
CompanyProfileDocument:
|
||
type: object
|
||
description: |
|
||
The portal form's document. The registry checks only its outline;
|
||
the fields and their options are the portal's schema. Answers are
|
||
text, a number, yes/no, a list of texts or null.
|
||
required: [sections]
|
||
additionalProperties: false
|
||
properties:
|
||
audience: { type: string, enum: [own_company], nullable: true }
|
||
clientRef: { type: string, maxLength: 200 }
|
||
sections:
|
||
type: object
|
||
additionalProperties: false
|
||
properties:
|
||
company_profile: { type: object, additionalProperties: true }
|
||
compliance_scope: { type: object, additionalProperties: true }
|
||
ai_act: { type: object, additionalProperties: true }
|
||
documents: { type: array, items: { type: object } }
|
||
suggested: { type: array, items: { type: string }, description: "Field ids holding an unconfirmed system suggestion." }
|
||
lastStep: { type: string, maxLength: 200 }
|
||
ManagedService:
|
||
type: object
|
||
required: [id, tenant_id, kind, name, url, sku, status, created_at, updated_at]
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
kind: { type: string, enum: [git, ci-runner] }
|
||
name: { type: string }
|
||
url: { type: string, description: "https:// URL of the Git instance (for a ci-runner: the instance it serves)" }
|
||
sku: { type: string, example: INF-GIT-CLD-STD }
|
||
status: { $ref: "#/components/schemas/ManagedServiceStatus" }
|
||
created_at: { type: string, format: date-time }
|
||
updated_at: { type: string, format: date-time }
|
||
ManagedServiceAdmin:
|
||
allOf:
|
||
- $ref: "#/components/schemas/ManagedService"
|
||
- type: object
|
||
required: [instance_id, notes]
|
||
properties:
|
||
instance_id: { type: string }
|
||
notes: { type: string }
|
||
ManagedServiceStatus:
|
||
type: string
|
||
enum: [provisioning, active, restricted, halted]
|
||
ManagedServiceCreate:
|
||
type: object
|
||
required: [kind, name, url, sku]
|
||
properties:
|
||
kind: { type: string, enum: [git, ci-runner] }
|
||
name: { type: string, minLength: 1, maxLength: 100 }
|
||
url: { type: string, maxLength: 300, description: "absolute https:// URL with a host" }
|
||
sku: { type: string, pattern: "^INF-(GIT|CI)-(CLD|OPR)-(STD|BUS|ENT)$", description: "INF-GIT-* for kind git, INF-CI-* for kind ci-runner" }
|
||
status: { $ref: "#/components/schemas/ManagedServiceStatus" }
|
||
instance_id: { type: string, maxLength: 100, pattern: "^[a-z0-9-]*$" }
|
||
notes: { type: string, maxLength: 2000 }
|
||
ManagedServiceUpdate:
|
||
type: object
|
||
properties:
|
||
name: { type: string, minLength: 1, maxLength: 100 }
|
||
url: { type: string, maxLength: 300 }
|
||
sku: { type: string, pattern: "^INF-(GIT|CI)-(CLD|OPR)-(STD|BUS|ENT)$", description: "INF-GIT-* for kind git, INF-CI-* for kind ci-runner" }
|
||
status: { $ref: "#/components/schemas/ManagedServiceStatus" }
|
||
instance_id: { type: string, maxLength: 100, pattern: "^[a-z0-9-]*$" }
|
||
notes: { type: string, maxLength: 2000 }
|
||
TenantActivity:
|
||
type: object
|
||
properties:
|
||
usage:
|
||
type: object
|
||
additionalProperties: { type: number }
|
||
description: usage totals per metric over the last 30 days
|
||
last_activity_at: { type: string, format: date-time }
|
||
Tenant:
|
||
type: object
|
||
required: [id, slug, name, status, kind, plan, created_at, updated_at]
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
slug: { type: string }
|
||
name: { type: string }
|
||
status: { $ref: "#/components/schemas/TenantStatus" }
|
||
kind: { type: string, enum: [customer, demo] }
|
||
plan: { type: string }
|
||
erp_customer_id: { type: string }
|
||
stripe_cust_id: { type: string }
|
||
trial_ends_at: { type: string, format: date-time, nullable: true }
|
||
contract_start: { type: string, format: date, nullable: true }
|
||
contract_end: { type: string, format: date, nullable: true }
|
||
sales_owner: { type: string }
|
||
admin_email: { type: string, format: email, description: "the tenant's first admin; empty for sales-led tenants" }
|
||
created_at: { type: string, format: date-time }
|
||
updated_at: { type: string, format: date-time }
|
||
|
||
OrgMember:
|
||
type: object
|
||
required: [user_id, email, enabled]
|
||
properties:
|
||
user_id: { type: string }
|
||
email: { type: string, format: email }
|
||
first_name: { type: string }
|
||
last_name: { type: string }
|
||
org_roles:
|
||
type: array
|
||
items: { type: string }
|
||
enabled: { type: boolean }
|
||
created_at: { type: string, format: date-time, nullable: true }
|
||
pending: { type: boolean, description: "invitation not accepted yet (no password, no identity-provider link)" }
|
||
status: { type: string, enum: [invited, active, blocked], description: "status in this tenant (portal#74)" }
|
||
extra_capabilities:
|
||
type: array
|
||
description: Individual capabilities on top of the bundle (RBAC step 3).
|
||
items: { type: string }
|
||
|
||
MemberAction:
|
||
type: object
|
||
required: [status]
|
||
properties:
|
||
status: { type: string, enum: [role_changed, unchanged, blocked, unblocked, removed, invite_revoked, invite_resent] }
|
||
member: { $ref: "#/components/schemas/OrgMember" }
|
||
user_deleted: { type: boolean, description: "revoking the invitation also deleted the account" }
|
||
sessions_ended: { type: boolean }
|
||
api_keys:
|
||
type: array
|
||
description: The member's active API keys in this tenant, offered for revocation.
|
||
items: { $ref: "#/components/schemas/APIKey" }
|
||
|
||
CapabilityRequest:
|
||
type: object
|
||
required: [id, tenant_id, user_id, capability, requested_by, created_at]
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
user_id: { type: string }
|
||
user_email: { type: string }
|
||
capability: { type: string }
|
||
requested_by: { type: string }
|
||
requested_email: { type: string }
|
||
created_at: { type: string, format: date-time }
|
||
|
||
CapabilityAction:
|
||
type: object
|
||
required: [status]
|
||
properties:
|
||
status: { type: string, enum: [capability_granted, capability_revoked, unchanged, approval_requested, request_rejected, request_withdrawn] }
|
||
member: { $ref: "#/components/schemas/OrgMember" }
|
||
request: { $ref: "#/components/schemas/CapabilityRequest" }
|
||
|
||
Invite:
|
||
type: object
|
||
required: [user_id, email, status]
|
||
properties:
|
||
user_id: { type: string }
|
||
email: { type: string, format: email }
|
||
status: { type: string, enum: [invited, member] }
|
||
|
||
TenantCreate:
|
||
type: object
|
||
required: [slug, name]
|
||
properties:
|
||
slug: { type: string, pattern: '^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$' }
|
||
name: { type: string, minLength: 1, maxLength: 255 }
|
||
plan: { type: string, default: starter }
|
||
kind: { type: string, enum: [customer, demo], default: customer }
|
||
sales_owner: { type: string }
|
||
admin_email: { type: string, format: email, description: "IT_ADMIN to invite via Keycloak" }
|
||
admin_name: { type: string }
|
||
|
||
TenantCreated:
|
||
type: object
|
||
required: [tenant]
|
||
properties:
|
||
tenant: { $ref: "#/components/schemas/Tenant" }
|
||
invite_url: { type: string, description: "KC action-token URL — present only when admin_email was set and KC provisioning succeeded" }
|
||
|
||
TenantActivate:
|
||
type: object
|
||
properties:
|
||
plan: { type: string }
|
||
contract_start: { type: string, format: date }
|
||
contract_end: { type: string, format: date }
|
||
erp_customer_id: { type: string }
|
||
products:
|
||
type: array
|
||
description: Entitlements granted with the activation (SKU limits in config).
|
||
items:
|
||
type: object
|
||
required: [key]
|
||
properties:
|
||
key: { type: string }
|
||
config: { type: object, additionalProperties: true }
|
||
expires_at: { type: string, format: date-time }
|
||
|
||
TenantCancel:
|
||
type: object
|
||
properties:
|
||
reason: { type: string }
|
||
at_period_end: { type: boolean }
|
||
|
||
TenantProduct:
|
||
type: object
|
||
required: [tenant_id, product, enabled, config, created_at, updated_at]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
enabled: { type: boolean }
|
||
config: { type: object, additionalProperties: true }
|
||
expires_at: { type: string, format: date-time, nullable: true }
|
||
preview: { type: boolean, description: "staff preview grant of a product not for sale yet" }
|
||
preview_expires_at: { type: string, format: date-time, nullable: true }
|
||
created_at: { type: string, format: date-time }
|
||
updated_at: { type: string, format: date-time }
|
||
|
||
CatalogEntry:
|
||
type: object
|
||
required: [key, name, description, type, plans_required, supports_trial]
|
||
properties:
|
||
key: { type: string }
|
||
name: { type: string }
|
||
description: { type: string }
|
||
type: { type: string, enum: [standalone, headless, cli] }
|
||
launch_url: { type: string, description: "product host for this environment (standalone) or download page (cli)" }
|
||
skus: { type: array, items: { type: string } }
|
||
addons: { type: array, items: { $ref: "#/components/schemas/ProductAddon" } }
|
||
plans_required: { type: array, items: { type: string } }
|
||
demo_url: { type: string }
|
||
supports_trial: { type: boolean }
|
||
trial_days: { type: integer }
|
||
|
||
CatalogRequest:
|
||
type: object
|
||
required: [tenant_id, product]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
|
||
APIKey:
|
||
type: object
|
||
required: [id, tenant_id, name, scopes, prefix, created_at]
|
||
properties:
|
||
id: { type: string, format: uuid }
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
name: { type: string }
|
||
scopes: { type: array, items: { type: string } }
|
||
prefix: { type: string }
|
||
kind: { type: string, enum: [user, ci, integration] }
|
||
holder: { type: string, description: "integration keys: the holding product" }
|
||
expires_at: { type: string, format: date-time, nullable: true }
|
||
created_by: { type: string }
|
||
last_used_at: { type: string, format: date-time, nullable: true }
|
||
revoked_at: { type: string, format: date-time, nullable: true }
|
||
created_at: { type: string, format: date-time }
|
||
|
||
APIKeyCreate:
|
||
type: object
|
||
required: [tenant_id, name]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
name: { type: string, maxLength: 100 }
|
||
product: { type: string }
|
||
scopes:
|
||
type: array
|
||
items: { type: string }
|
||
description: Names from GET /v1/api-keys/scopes. Empty = legacy full
|
||
grant on product (deprecated); required for kind ci.
|
||
kind: { type: string, enum: [user, ci], default: user }
|
||
expires_at: { type: string, format: date-time, description: "required for kind ci, at most 365 days ahead" }
|
||
created_by: { type: string }
|
||
|
||
APIKeyScope:
|
||
type: object
|
||
required: [name, product, description]
|
||
properties:
|
||
name: { type: string, example: "pruefwerk:findings.read" }
|
||
product: { type: string, description: "catalogue product the tenant must be entitled to" }
|
||
description: { type: string }
|
||
|
||
APIKeyCreated:
|
||
type: object
|
||
required: [api_key, plaintext, warning]
|
||
properties:
|
||
api_key: { $ref: "#/components/schemas/APIKey" }
|
||
plaintext: { type: string }
|
||
warning: { type: string }
|
||
|
||
APIKeyVerify:
|
||
type: object
|
||
required: [valid]
|
||
properties:
|
||
valid: { type: boolean }
|
||
tenant_id: { type: string, format: uuid }
|
||
product: { type: string }
|
||
scopes:
|
||
type: array
|
||
items: { type: string }
|
||
description: The key's scopes limited to products the tenant is
|
||
entitled to right now.
|
||
key_id: { type: string, format: uuid }
|
||
kind: { type: string, enum: [user, ci, integration] }
|
||
holder: { type: string }
|
||
expires_at: { type: string, format: date-time }
|
||
tenant_status: { type: string }
|
||
legacy:
|
||
type: boolean
|
||
description: The key has no scopes and grants everything on product
|
||
(or on every entitled product when product is empty).
|
||
|
||
AuditAppend:
|
||
type: object
|
||
required: [action]
|
||
properties:
|
||
tenant_id: { type: string, format: uuid }
|
||
project_id: { type: string, format: uuid }
|
||
actor_id: { type: string }
|
||
actor_name: { type: string }
|
||
actor_type: { type: string, description: "user | service | staff | system | apikey (actor_id apikey:<key_id>)" }
|
||
action: { type: string }
|
||
target_id: { type: string }
|
||
target_type: { type: string }
|
||
target_name: { type: string }
|
||
product: { type: string }
|
||
metadata: { type: object, additionalProperties: true }
|
||
|
||
AuditEvent:
|
||
allOf:
|
||
- $ref: "#/components/schemas/AuditAppend"
|
||
- type: object
|
||
required: [id, created_at]
|
||
properties:
|
||
id: { type: integer, format: int64 }
|
||
source_ip: { type: string }
|
||
user_agent: { type: string }
|
||
created_at: { type: string, format: date-time }
|