# Log Viewer endpoints (Admin API)

> 4 FeatherPanel Admin API endpoints from admin/log-viewer.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/admin/log-viewer/

Defined in [`backend/app/routes/admin/log-viewer.php`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/log-viewer.php). Authentication used here: **Admin**. Read [Authentication](https://featherpanel.com/docs/api/authentication/) for how to send credentials and [Rate limits and errors](https://featherpanel.com/docs/api/rate-limits-and-errors/) for the response envelope.

Paths, methods, permissions and rate limits come from the route file. Summaries, parameters and response codes come from the OpenAPI annotations on the controllers; endpoints without annotations show only what the route file declares.

## Endpoints

### GET `/api/admin/log-viewer/get`

- Auth: Admin
- Permission: `admin.root`
- Route name: `admin-log-viewer-get`
- Controller: [`LogViewerController::getLogs`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/LogViewerController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/log-viewer.php#L25)

**Get log content** Retrieve the last N lines from a specific log file. Only available in developer mode and requires ADMIN\_ROOT permissions.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `type` | query | string | no | Log type to retrieve |
| `lines` | query | integer | no | Number of lines to retrieve from the end of the log file |

Response data: [`LogContent`](https://featherpanel.com/docs/api/schemas/#schema-logcontent)

| Response `data` field | Type | Description |
| --- | --- | --- |
| `logs` | string | Log content as string |
| `file` | string | Log file name |
| `type` | string | Log type |
| `lines_count` | integer | Number of lines in the log content |

```bash
curl -X GET "$PANEL_URL/api/admin/log-viewer/get" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Log content retrieved successfully · `401` Unauthorized · `403` Forbidden - Developer mode not enabled or insufficient permissions · `404` Log file not found · `500` Internal server error - Failed to fetch logs

### POST `/api/admin/log-viewer/clear`

- Auth: Admin
- Permission: `admin.root`
- Route name: `admin-log-viewer-clear`
- Controller: [`LogViewerController::clearLogs`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/LogViewerController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/log-viewer.php#L35)

**Clear log file** Clear the contents of a specific log file. Requires ADMIN\_ROOT permissions.

Request body: [`LogClear`](https://featherpanel.com/docs/api/schemas/#schema-logclear) (application/json)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | yes | Log type to clear |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `message` | string | Success message |

```bash
curl -X POST "$PANEL_URL/api/admin/log-viewer/clear" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"type":""}'
```

Plugin events: [`featherpanel:admin:log_viewer:cleared`](https://featherpanel.com/docs/plugins/events/log-viewer/#log-cleared)

Responses: `200` Log file cleared successfully · `401` Unauthorized · `403` Forbidden - Developer mode not enabled or insufficient permissions · `404` Log file not found · `500` Internal server error - Failed to clear logs

### GET `/api/admin/log-viewer/files`

- Auth: Admin
- Permission: `admin.root`
- Route name: `admin-log-viewer-files`
- Controller: [`LogViewerController::getLogFiles`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/LogViewerController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/log-viewer.php#L46)

**Get log files list** Retrieve a list of all available log files with metadata. Only available in developer mode and requires ADMIN\_ROOT permissions.

| Response `data` field | Type | Description |
| --- | --- | --- |
| `files` | LogFile\[\] |  |

```bash
curl -X GET "$PANEL_URL/api/admin/log-viewer/files" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Log files retrieved successfully · `401` Unauthorized · `403` Forbidden - Developer mode not enabled or insufficient permissions · `500` Internal server error - Failed to fetch log files

### POST `/api/admin/log-viewer/upload`

- Auth: Admin
- Permission: `admin.root`
- Route name: `admin-log-viewer-upload`
- Controller: [`LogViewerController::uploadLogs`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/LogViewerController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/log-viewer.php#L56)

**Upload logs to MythicalSystems Paste** Upload recent web and app logs to pastes.mythicalsystems.org and get shareable URLs. Requires ADMIN\_ROOT permissions.

| Response `data` field | Type | Description |
| --- | --- | --- |
| `web` | object |  |
| `app` | object |  |
| `runner` | object |  |

```bash
curl -X POST "$PANEL_URL/api/admin/log-viewer/upload" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:admin:log_viewer:uploaded`](https://featherpanel.com/docs/plugins/events/log-viewer/#logs-uploaded)

Responses: `200` Logs uploaded successfully · `401` Unauthorized · `403` Forbidden - Developer mode not enabled or insufficient permissions · `500` Internal server error - Failed to upload logs
