# Console: audit

Source: https://docs.neode.sk/development/api-reference/console-audit/
Last updated: 2026-12-03

> 9 operations. The audit log and the security overview.

These routes are on the console, port 3375. They take an API token as `Authorization: Bearer ndt_...`; see [API tokens](https://docs.neode.sk/command-line/api-tokens.md).

The audit log and the security overview.

## GET /api/panel/security-audit/events

List security events: sign-ins, refusals, changes to access.

The server API's audit events, as it answers them.

Needs `audit.view`. `neodesk audit events` calls it.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `limit` | query | integer | default `50`, at least 1, at most 500 |
| `offset` | query | integer | default `0`, at least 0, at most 10000 |
| `action` | query | string | Only events of this action |

**200**: Done (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `enabled` | boolean | false when the server keeps no audit log |
| `total` | integer |  |
| `count` | integer |  |
| `events` | array of [ServerAuditEvent](https://docs.neode.sk/development/api-reference/schemas.md#serverauditevent) or null |  |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 502 | The server API did not answer |

## GET /api/panel/security-audit/hardening

Show the hardening checks of this server.

Needs `audit.view`. `neodesk audit hardening` calls it.

**200**: Done (`application/json`)

| Field | Type |
|---|---|
| `priorities` | array of object |
| `priorities[].id` | string, one of `session_timeout`, `single_session` |
| `priorities[].name` | string |
| `priorities[].category` | string |
| `priorities[].severity` | string |
| `priorities[].implemented` | boolean |
| `priorities[].description` | string |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |

## GET /api/panel/security-audit/overview

Show the security overview: failed sign-ins, lockouts, second factor use.

A score from 100 down: failed sign-ins in the last day, active bans, API keys older than 90 days and TLS each take points off.

Needs `audit.view`. `neodesk audit overview` calls it.

**200**: Done (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `score` | integer |  |
| `checks` | array of object |  |
| `checks[].id` | string, one of `tls_api`, `api_key_age`, `failed_logins`, `no_bans`, `audit_log`, `blocklist` |  |
| `checks[].name` | string |  |
| `checks[].pass` | boolean |  |
| `stats` | object |  |
| `stats.failed_logins` | integer | In the last day |
| `stats.bans` | number |  |
| `stats.config_changes` | integer |  |
| `stats.api_keys` | integer |  |
| `stats.old_keys` | integer | Older than 90 days |
| `tls` | object | signal and relay are not reported and stay null |
| `tls.signal` | null |  |
| `tls.relay` | null |  |
| `tls.api` | boolean |  |
| `tls.wss` | boolean | The request reached the console over HTTPS |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 502 | The server API's audit data cannot be read |

## GET /api/settings/audit

Show the audit log, newest first: who did what, when and from where.

Newest first.

Needs `audit.view`. `neodesk audit list` calls it.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `limit` | query | integer | default `100`, at least 1, at most 500 |

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | array of object | yes |
| `data[].id` | integer |  |
| `data[].user_id` | integer or null |  |
| `data[].action` | string |  |
| `data[].details` | string or null |  |
| `data[].ip_address` | string or null |  |
| `data[].created_at` | string or null (date-time) |  |
| `data[].username` | string or null |  |
| `data[].display_name` | string or null |  |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |

## GET /api/settings/audit/search

Search the whole audit log by text, kind and date range, newest first.

Searches every entry the log keeps. total is how many entries match, all how many the log holds.

Needs `audit.view`. `neodesk audit search` calls it.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `q` | query | string | Text in the account's username or name, the action code (also with spaces for underscores), the details or the address, any case |
| `actions` | query | string | Action codes, separated by commas, that match as well when q is given (the console sends the codes whose label in its language contains q) |
| `type` | query | string, one of `bans`, `signins`, `failed`, `devices`, `people`, `settings` | Only entries of this kind; any other value keeps every kind |
| `from` | query | string | The first time to include: RFC 3339, or a date for the start of that UTC day |
| `to` | query | string | The last time to include: RFC 3339, or a date for the end of that UTC day |
| `limit` | query | integer | default `50`, at least 1, at most 500 |
| `offset` | query | integer | default `0`, at least 0 |

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | object | yes |
| `data.entries` | array of object | yes |
| `data.entries[].id` | integer |  |
| `data.entries[].user_id` | integer or null |  |
| `data.entries[].action` | string |  |
| `data.entries[].details` | string or null |  |
| `data.entries[].ip_address` | string or null |  |
| `data.entries[].created_at` | string or null (date-time) |  |
| `data.entries[].username` | string or null |  |
| `data.entries[].display_name` | string or null |  |
| `data.total` | integer | yes |
| `data.all` | integer | yes |

| Error | When |
|---|---|
| 400 | from or to is no date or time (audit_bad_date) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 500 | Something failed on the server (the text of errors.server_error) |

## GET /api/settings/audit/export

Export the audit log entries that match a search as CSV (use --output).

Every entry that matches, newest first, with the columns id, time (UTC, RFC 3339), username, name, action, details and ip_address. A UTF-8 byte order mark, CRLF line ends. A text a spreadsheet would read as a formula gets a single quote in front.

Needs `audit.view`. `neodesk audit export` calls it.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `q` | query | string | Text in the account's username or name, the action code (also with spaces for underscores), the details or the address, any case |
| `actions` | query | string | Action codes, separated by commas, that match as well when q is given (the console sends the codes whose label in its language contains q) |
| `type` | query | string, one of `bans`, `signins`, `failed`, `devices`, `people`, `settings` | Only entries of this kind; any other value keeps every kind |
| `from` | query | string | The first time to include: RFC 3339, or a date for the start of that UTC day |
| `to` | query | string | The last time to include: RFC 3339, or a date for the end of that UTC day |

**200**: The file audit-log-&lt;YYYY-MM-DD>.csv (`text/csv`)

String (binary).

| Error | When |
|---|---|
| 400 | from or to is no date or time (audit_bad_date) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 500 | Something failed on the server (the text of errors.server_error) |

## GET /api/settings/audit/retention

Show how many days the audit log and the server events are kept.

0 days means they are kept until someone deletes them.

Needs `audit.view`. `neodesk audit retention` calls it.

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | [AuditRetention](https://docs.neode.sk/development/api-reference/schemas.md#auditretention) | yes |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |

## PUT /api/settings/audit/retention

Set how many days the audit log and the server events are kept.

The hourly clean-up deletes older entries and keeps the audit log's hash chain checkable. A change of the days is logged in the audit log.

Needs `server.config`. `neodesk audit retention-set` calls it.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `days` | integer or string | yes | A whole number from 0 to 3650, also as text; 0 keeps them until someone deletes them; at least 0, at most 3650 |

**200**: The retention as saved (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | [AuditRetention](https://docs.neode.sk/development/api-reference/schemas.md#auditretention) | yes |

| Error | When |
|---|---|
| 400 | days is missing or not a whole number from 0 to 3650 (code invalid_days) |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 500 | Something failed on the server |

## POST /api/settings/audit/verify

Check the audit log's hash chain and name the first entry that doesn't fit.

Seals the entries that wait to be sealed, then walks the chain from the oldest entry retention left: every entry must follow the one before it and its hash must be the hash of its content. Each check writes an audit entry with its result.

Needs `audit.view and audit.verify`. `neodesk audit verify` calls it.

**200**: The chain is whole (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `data` | [AuditChainReport](https://docs.neode.sk/development/api-reference/schemas.md#auditchainreport) | yes |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 409 | The chain is broken (code audit_chain_broken); error is the problem's message and data the report with the problem |
| 500 | Something failed on the server |
| 503 | The audit log of this server has no hash chain yet; a restart of the server adds it |
