Authentication
How to log in, manage session tokens, and log out via the REST API.
The 2log REST API allows you to manage your instance programmatically. This is useful for automating recurring tasks, integrating 2log with other systems, or building your own tools on top of it.
All examples in this section use curl and assume your 2log server is reachable at http://your-server. The Caddy reverse proxy forwards everything under /api to the QuickHub REST backend, so all API endpoints are prefixed with /api.
Under the hood, 2log is built on the QuickHub framework. QuickHub provides real-time data synchronization over WebSockets. Resources (such as the user list or a device configuration) live on the server and are identified by a resource path like labcontrol/users.
The REST API gives you plain HTTP access to these same resources. Since slashes in URLs would be interpreted as path separators, the REST API uses dots as namespace separators in the URL. The server translates dots back to slashes internally:
| URL path component | Internal resource path |
|---|---|
labcontrol.users |
labcontrol/users |
labcontrol.groups |
labcontrol/groups |
labcontrol.users.groups.{uuid} |
labcontrol/users/groups/{uuid} |
The REST API exposes three types of endpoints, each mapping to a different QuickHub resource type:
| Endpoint prefix | Resource type | Description |
|---|---|---|
/api/lists/{resource} |
Synchronized List | Ordered collections of items (e.g. users, groups, permissions). Supports GET, POST, PUT, PATCH, DELETE. |
/api/objects/{resource} |
Object | Key-value stores (e.g. the current user’s profile). Supports GET, PUT, PATCH. |
/api/services/{service}/{method} |
Service | RPC-style function calls (e.g. addUser, getLogs). Always uses POST. |
Additionally, there are endpoints for binary data:
| Endpoint prefix | Description |
|---|---|
/api/images/{resource} |
Upload, list and download images. |
/api/files |
Generic file upload and download. |
The following pages explain each area in detail.
How to log in, manage session tokens, and log out via the REST API.
Create, read, update and delete users via the REST API.
Read and manage resource controllers, their aspects (billing, QR code, permissions, etc.) via the REST API.
Manage groups, individual permissions and RFID cards via the REST API.
Query and create log entries via the REST API.
Complete reference for all available service methods.
HTTP status codes and error response format.