Skip to main content

REST API

Everything the web app does goes through an HTTP API that you can call yourself. This section lists every endpoint, grouped by area, with its method, path, authentication, parameters, request and response fields and status codes. It is generated from the server's openapi.json (425 operations in 33 groups).

Conventions​

Base URL and format​

The API is served by the same process and origin as the web app. Paths under /api are the application API; the table of other roots is below. Requests and responses are JSON (Content-Type: application/json).

RootWhat it is
/api/...The application API: sessions, workspaces, BI, workflows, control plane, governance
/data-api/v1/{ws}/...Serving published Data API endpoints
/oauth/token, /.well-known/jwks.json, /.well-known/openid-configurationEgret's machine identity provider
/catalog/...The embedded Iceberg REST catalog (the Iceberg REST specification, not listed here)
/service/...The Ranger-compatible policy service polled by engine plugins
/workflows/v1/{ws}/executions/webhook/...Anonymous workflow webhooks, mounted only when workflow.webhooks_enabled is on

Authentication​

MethodUsed forHow
Session cookieThe application APIPOST /api/auth/login with {"email", "password"} sets the egret_session and egret_csrf cookies. Single sign-on sets the same cookies after the browser flow.
CSRF headerEvery POST, PUT, PATCH and DELETE with a sessionSend the value of the egret_csrf cookie in X-Egret-CSRF. Without it the answer is 403 csrf check failed.
Bearer tokenThe Data APIPOST /oauth/token with the OAuth2 client_credentials grant returns a JWT with audience data-api (600 seconds). Send it as Authorization: Bearer <token>.
Bearer token/service/...Bearer <ranger.auth_token>; open when the token is empty.
NoneHealth and discovery/healthz, /readyz, /api/auth/config, /.well-known/*

Each endpoint page states its auth in the line under the heading. Permission requirements appear as the Forbidden (403) text, for example Missing dataset:manage permission; see Permissions.

Calling the API with curl​

Signing in and making a call (the local sign-in is rate limited to 5 attempts per 5 minutes, so reuse the cookie jar):

BASE=http://localhost:8080

curl -s -c jar.txt -X POST $BASE/api/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"admin@egret.local","password":"..."}'

CSRF=$(awk '$6=="egret_csrf"{print $7}' jar.txt)

# a read needs only the cookie
curl -s -b jar.txt $BASE/api/ws/default/datasets

# a write also needs the CSRF header
curl -s -b jar.txt -H "X-Egret-CSRF: $CSRF" -H 'Content-Type: application/json' \
-X POST $BASE/api/ws/default/databases/test \
-d '{"engine":"trino","host":"localhost","port":8091,"options":{"user":"egret","http_scheme":"http","catalog":"tpch"}}'
# {"ok":true,"latency_ms":42,"detail":"SELECT 1 ok"}

Workspace-scoped paths​

Most of the application API lives under /api/ws/{workspace}/..., where {workspace} is the workspace slug (default), not its id. Control-plane routes live under /api/control-plane/... and need platform permissions.

Errors​

An error answers with the matching HTTP status and a JSON body with one field:

{"error": "unauthorized"}
StatusMeaning
400Invalid input. Some browser-redirect routes (/api/auth/oidc/callback) answer plain text instead of JSON.
401No valid session or token. {"error":"unauthorized"}
403Authenticated, but the permission is missing, or the CSRF header is absent (csrf check failed, plain text).
404The object does not exist.
409A conflict, for example a name that is already taken: conflict: a chart with that name already exists. A write that recompiles policy profiles (a classification's clearance, a classification added to or removed from a catalog object, a classification deleted, a grant or rule write under /api/control-plane/perm) answers {"error": "the policy profiles this write recompiles changed while it ran (profile(s) 12 were bound or created meanwhile); nothing was written, retry", "code": "profile_set_changed", "retryable": true} when an engine was bound to another profile while it ran. Nothing was written: send it again.
422The JSON body does not match the schema; the text names the field, for example source.kind: unknown variant `table`, expected `physical` or `virtual` .
429Rate limited: {"error":"too many requests"}.
500An internal error. The body is generic; the server log has the detail.
502An engine call failed in a way the API cannot represent, for example engine: engine: http 406 Not Acceptable. See Engine 406 and 502 errors.

Long-running work is asynchronous: for example POST /api/ws/{workspace}/queries answers 202 with an id, and you poll GET /api/ws/{workspace}/queries/{id}.

Getting the document itself​

egret openapi prints the OpenAPI 3.1 document to standard output. It needs no database or network, so it runs in CI:

egret openapi > openapi.json

The pages below are generated from that file with scripts/gen-api-reference.mjs in the docs repository (node scripts/gen-api-reference.mjs path/to/openapi.json). Descriptions are the first paragraph of each doc comment in the source, so some are terse. The document's only declared security scheme is the Data API bearer token; session endpoints are described by their auth line here.

Endpoints by area​

AreaPageEndpoints
Authentication and identityAuthentication6
Authentication and identityOIDC single sign-on3
Authentication and identityMachine identity provider3
Authentication and identityCurrent user1
Workspaces and membersWorkspace administration10
Workspaces and membersUser administration3
Workspaces and membersWorkspace members11
Workspaces and membersAccess requests4
Workspaces and membersSharing6
Explore (BI)Databases9
Explore (BI)Queries7
Explore (BI)SQL Lab15
Explore (BI)Datasets23
Explore (BI)Charts14
Explore (BI)Dashboards15
Explore (BI)Folders4
Explore (BI)Alerts and reports21
Explore (BI)Data Apps19
Data APIData API management29
Data APIData API serving3
WorkflowsWorkflows117
Data governancePermission model43
Data governancePolicy administration16
Data governanceRanger-compatible policy service6
Data governanceGovernance data browser11
Data governanceClassification tags8
Control planeAccess control41
Control planeEngines32
Control planeCatalog registry14
Control planeEgret warehouses37
Control planeStorage connections7
Control planeSecrets4
Control planeAudit log1
Othercontrol-plane-perm11