Skip to content

Documentation

API

Everything in the LEA Platform console is available over HTTP. The API has two parts:

PrefixWhat 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

RoleReadChange
adminYesYes
readYesNo

Query syntax (PostgREST)

GET /api/ returns the OpenAPI description of the data API.

OperatorMeaning
eq / neqequals / not equals
like / ilikepattern match (* wildcard) / case-insensitive
invalue 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

MethodPathDescription
GET/api/clientsHosts with system info
GET/api/clients_verifiedHosts 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

MethodPathDescription
GET/api/cmdsAll rules with full definition
GET/api/cmds_with_verificationRules with pass/fail across hosts
POST/api/cmdsCreate 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_catalogTags used on rules

Groups

MethodPathDescription
GET/api/client_groupsGroups and their settings
GET/api/client_groups_viewGroups with host counts
POST / PATCH / DELETE/api/client_groupsCreate, update, delete groups

Results

MethodPathDescription
GET/api/latest_cmd_results_allLatest 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

MethodPathDescription
GET/api/audit_logSystem audit (filter by action, table_name, actor, request_id)
GET/api/webhook_auditWebhook and compliance events
GET/api/cmds_changed_logRecent rule changes

Enrollment (admin)

MethodPathBodyEffect
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

MethodPathDescription
GET / PATCH/api/settings_ui?name=eq.settings_frontServer settings (admin to change)
GET / POST / PATCH / DELETE/api/settings_webhookWebhooks; secrets are write-only
GET/api/users, /api/user_roles_viewUsers and roles
GET/lea/licenseLicense details (admin)
GET/lea/license?request=trueGenerate a license request (admin)
POST/lea/licenseUpload a license (admin)
GET/lea/versionVersion; no authentication

Status codes

CodeMeaning
200 / 201 / 204OK / created / OK with no body
400Bad query or body
401Missing or invalid token
403Role not allowed
404Not found
500Server error; check the server logs

Try LEA Platform on your own servers:

Start a free POC

Try it on your own servers.

30 days, up to 25 endpoints, every feature. We help you install it and agree on success criteria first.