# Record an audit event for a change made in the console

> Record an audit event for a change made in the console: CustomDomain™ API reference in the enterprise group. Covers parameters, request body and responses.

Source: https://docs.customdomain.ai/docs/api-reference/enterprise/recordAuditEvent

## `POST https://api.customdomain.ai/v1/audit`

Ingest for the few mutations that happen in the customer console's own database, so the control plane never sees them. Everything the control plane changes itself is recorded by its own handler and is not accepted here. The organization, actor, address and time are derived on the server; the body names only the action, an optional target and a small before and after summary. Requires an API key whose role may manage identity settings (admin or owner); a widget JWT is refused with `403`, and a `503` means the audit log is not configured on the deployment.

The console's server also records here what an operator did through its owner routes. It presents the provisioning secret in `X-Provision-Secret`, names the workspace in `tenant_id`, and may use only the `user.*` and `workspace.*` verbs listed, which a tenant key may not. The actor is recorded as `operator`, the reason in `after.reason` is required for `user.disabled`, `user.enabled`, `user.sessions_revoked`, `user.password_reset_link_issued`, `workspace.features_set` and `user.erased` and recorded when given for the others, and the answer is a `500` when the log did not take the event.

### Authentication

`apiKey`, `provisionSecret`

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | `whitelabel.configured`, `api_key.default_revealed`, `user.disabled`, `user.enabled`, `user.sessions_revoked`, `user.verification_resent`, `user.password_reset_link_issued`, `workspace.features_set`, `workspace.mode_set`, `user.onboarding_reset`, `user.nudged`, `user.push_tested`, `user.erased`, `user.restored` | yes | The console-recordable verb. With an API key only `whitelabel.configured` and `api_key.default_revealed`; with the provisioning secret only the others. Any other value is refused with `400`. |
| `tenant_id` | string | no | Provisioning secret only, and required with it: the workspace the event is recorded on. An unknown one is a `404`. |
| `target` | string | no | What the event is about. Defaults to the caller's own organization when empty. |
| `before` | object | no | A small summary of the state before the change; at most 24 keys. |
| `after` | object | no | A small summary of the state after the change; at most 24 keys. |

### Responses

| Status | Description |
| --- | --- |
| `200` | Recorded |
| `400` | Error envelope: {code, title, details}. |
| `401` | Error envelope: {code, title, details}. |
| `403` | Error envelope: {code, title, details}. |
| `404` | Error envelope: {code, title, details}. |
| `500` | Error envelope: {code, title, details}. |
| `503` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `recorded` | boolean | yes |  |
| `action` | string | yes | The verb that was recorded. |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
