Herald
OpenapiLegal

Publish the staged draft as a new effective version.

Admin — requires `inject_identity` + `settings.manage` + `has_access_to_realm`. Reads the draft, creates a new immutable `legal_agreement_version` row (advancing `version_no`, recording an `agreement.published` audit event), and clears the draft. Returns 404 when no draft exists for the type. This is the only path the admin UI uses to publish — there is no "publish without a draft" entry in the UI (the legacy `PUT /agreements/{type}` handler remains for backward compatibility).

POST
/api/legal/admin/{realmId}/agreements/{agreementType}/publish

Admin — requires inject_identity + settings.manage + has_access_to_realm. Reads the draft, creates a new immutable legal_agreement_version row (advancing version_no, recording an agreement.published audit event), and clears the draft. Returns 404 when no draft exists for the type. This is the only path the admin UI uses to publish — there is no "publish without a draft" entry in the UI (the legacy PUT /agreements/{type} handler remains for backward compatibility).

Path Parameters

realmId*string

Realm ID

agreementType*string

Agreement type: terms_of_service | privacy_policy

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

version_label?string|null

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/legal/admin/string/agreements/string/publish"
{  "effective_at": "2019-08-24T14:15:22Z",  "external_url": "string",  "mode": "full_text",  "version_id": "9e94c502-ca41-4342-a7f7-af96b444512c",  "version_no": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}