API
Everything in the LEA Platform console is available over HTTP. The API has two parts:
| Prefix | What it is |
|---|---|
/api/* | Data API (PostgREST) over hosts, rules, groups, results and audit |
/lea/* | Platform endpoints: authentication, license, version, compliance evidence |
Base URL: your own LEA server, e.g. https://lea.example.com. All responses are JSON.
Authentication
Every request except /lea/version needs a bearer token.
Local account (service user):
curl -X POST -u apiuser:'<password>' https://lea.example.com/lea/authenticate_api
# → {"token": "<TOKEN>"}
SSO token exchange: send a token from your OIDC provider and get a LEA token back.
curl -X POST -H "Authorization: Bearer <SSO_TOKEN>" \
https://lea.example.com/lea/authenticate_api_from_token
Use the token:
curl -H "Authorization: Bearer <TOKEN>" https://lea.example.com/api/clients
Store tokens in a secret manager or environment variables, not in scripts.
Roles
| Role | Read | Change |
|---|---|---|
| admin | Yes | Yes |
| read | Yes | No |
Query syntax (PostgREST)
GET /api/ returns the OpenAPI description of the data API.
| Operator | Meaning |
|---|---|
eq / neq | equals / not equals |
like / ilike | pattern match (* wildcard) / case-insensitive |
in | value in list |
GET /api/clients_verified?verified=eq.true
GET /api/clients?name=ilike.*prod*
GET /api/cmds?id=in.(1,2,3)
GET /api/clients?order=name.asc&offset=0&limit=100
GET /api/clients?select=id,name
Add the header Prefer: count=exact to get a total count.
Filter by a dynamic tag value:
GET /api/clients?cmd_info->hostname->>stdout=like.web-*
Main endpoints
Hosts
| Method | Path | Description |
|---|---|---|
| GET | /api/clients | Hosts with system info |
| GET | /api/clients_verified | Hosts with pass/fail, active and enrollment state |
| GET | /api/clients_verified_with_group?group_id=eq.{id} | Hosts in a group |
| GET | /api/client_effective_groups?client_id=eq.{id} | All groups of a host, including nested |
| GET | /api/client_logs?client_id=eq.{id} | Agent logs of a host |
| DELETE | /api/clients?id=in.({ids}) | Delete hosts |
Rules
| Method | Path | Description |
|---|---|---|
| GET | /api/cmds | All rules with full definition |
| GET | /api/cmds_with_verification | Rules with pass/fail across hosts |
| POST | /api/cmds | Create a rule (JSON as in the rule editor's JSON tools) |
| PATCH | /api/cmds?id=eq.{id} | Update a rule |
| DELETE | /api/cmds?id=eq.{id} | Delete a rule |
| GET | /api/cmd_tags_catalog | Tags used on rules |
Groups
| Method | Path | Description |
|---|---|---|
| GET | /api/client_groups | Groups and their settings |
| GET | /api/client_groups_view | Groups with host counts |
| POST / PATCH / DELETE | /api/client_groups | Create, update, delete groups |
Results
| Method | Path | Description |
|---|---|---|
| GET | /api/latest_cmd_results_all | Latest result per host and rule |
| GET | /api/latest_cmd_results_with_group?group_id=eq.{id} | Latest results in a group |
| GET | /api/cmd_results?clients_id=eq.{id}&cmd_id=eq.{id} | Result history for a host/rule pair |
| GET | /api/rpc/cmd_results_timeseries?p_hours={h}&p_points={n} | Pass/fail counts over time |
Audit
| Method | Path | Description |
|---|---|---|
| GET | /api/audit_log | System audit (filter by action, table_name, actor, request_id) |
| GET | /api/webhook_audit | Webhook and compliance events |
| GET | /api/cmds_changed_log | Recent rule changes |
Enrollment (admin)
| Method | Path | Body | Effect |
|---|---|---|---|
| POST | /api/rpc/reenroll_clients | {"p_ids": [1,2], "p_minutes": 60} | Open a re-enrollment window (1–1440 min) |
| POST | /api/rpc/close_reenroll_window | {"p_ids": [1,2]} | Close unused windows |
| POST | /api/rpc/confirm_reenrolled_clients | {"p_ids": [1,2]} | End probation, clear conflicts |
Read enrollment state from /api/clients_verified (enrollment_state, cert_status).
Example: open a 30-minute window for every host with a certificate error.
IDS=$(curl -s -H "Authorization: Bearer $TOKEN" \
"$LEA/api/clients_verified?enrollment_state=eq.cert_error&select=id" | jq -c 'map(.id)')
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
"$LEA/api/rpc/reenroll_clients" -d "{\"p_ids\": $IDS, \"p_minutes\": 30}"
Settings and platform
| Method | Path | Description |
|---|---|---|
| GET / PATCH | /api/settings_ui?name=eq.settings_front | Server settings (admin to change) |
| GET / POST / PATCH / DELETE | /api/settings_webhook | Webhooks; secrets are write-only |
| GET | /api/users, /api/user_roles_view | Users and roles |
| GET | /lea/license | License details (admin) |
| GET | /lea/license?request=true | Generate a license request (admin) |
| POST | /lea/license | Upload a license (admin) |
| GET | /lea/version | Version; no authentication |
Status codes
| Code | Meaning |
|---|---|
| 200 / 201 / 204 | OK / created / OK with no body |
| 400 | Bad query or body |
| 401 | Missing or invalid token |
| 403 | Role not allowed |
| 404 | Not found |
| 500 | Server error; check the server logs |
Try LEA Platform on your own servers:
Start a free POCTry it on your own servers.
30 days, up to 25 endpoints, every feature. We help you install it and agree on success criteria first.