REST API
The LakeOps REST API gives you programmatic access to catalogs, tables, maintenance, policies, observability, and SQL queries. Use it from scripts, CI/CD, or your own applications. LakeOps does not ship a CLI or SDK — call the API with curl or any HTTP client.
AI agents normally use the MCP server on the same host with the same API key. MCP covers discovery, health, maintenance, and policies. Catalog registration, rollback, renames, table properties, and SQL are REST-only.
Base URL
LakeOps runs in data regions around the world, and each region has its own API host. Use the host for the region where your organization's catalogs live. The examples on this page use https://api.lakeops.dev. Connect Your Agent shows the host for your region; the REST API uses it without the /mcp path.
Authentication
Every request must include an API key as a Bearer token in the Authorization header. Create API keys in Organization > API Keys.
Example request
export LAKEOPS_API_KEY="<your-api-key>"
curl https://api.lakeops.dev/api/catalogs \
-H "Authorization: Bearer $LAKEOPS_API_KEY"403 Forbidden, as does a key that is not owned by an organization.401 Unauthorized.Scopes in the key form
Each permission you pick when creating a key maps to one scope ID.
| In the console | Scope ID |
|---|---|
| Grant full read | read |
| Grant full write | write |
| Policies: Read / Write | policies:readpolicies:write |
| Catalogs: Read / Write / Admin | catalogs:readcatalogs:writecatalogs:admin |
| Tables: Read / Write / Delete | tables:readtables:writetables:delete |
| Query: Read | query:read |
Response format
Responses are JSON and return the resource directly. Validation and server errors return a JSON object; the exact fields vary by route. Most include error or message, and some add details or success: false. Check the HTTP status first. Authentication failures (401) and scope failures (403) return only the status code.
// GET /api/catalogs — 200
[
{ "name": "production-glue", "type": "glue", "status": true,
"tableCount": 142, "totalSizeInBytes": 2638827906662, ... }
]
// 400
{
"error": "Validation error",
"message": "Catalog name is required"
}Endpoints
The API is organized by domain. Each group shows the minimum scope required.
Catalogs
catalogs:readcatalogs:writecatalogs:adminReading the list needs catalogs:read; registering and refreshing need catalogs:write. Changing, deleting, or reading a catalog's configuration needs catalogs:admin, which must be granted explicitly (write does not include it); in the console only organization admins can do these. Secrets are write-only: they come back as ******** everywhere, admins included.
| Method | Path | Description |
|---|---|---|
GET | /api/catalogs | List catalogs with table statistics. Never includes properties; credentials in the URI are stripped. (catalogs:read) |
POST | /api/catalogs | Register a new catalog. The response has the same credential-free shape as the list. (catalogs:write) |
PUT | /api/catalogs/{name} | Update a catalog. When sent, properties replaces the whole set: keys left out are removed, and ******** keeps a stored secret. (catalogs:admin) |
PATCH | /api/catalogs/{name}/properties | Add, update, or remove individual properties with updates and removals; everything else is untouched. (catalogs:admin) |
DELETE | /api/catalogs/{name} | Remove a catalog. (catalogs:admin) |
GET | /api/config/catalog/{name} | Get a catalog's configuration, including properties, with every secret masked as ********. (catalogs:admin) |
POST | /api/refresh/catalog/{name} | Trigger a full metadata refresh for a catalog. (catalogs:write) |
POST | /api/refresh/table/{catalogName}/{namespace}/{tableName} | Trigger a metadata refresh for a single table. (catalogs:write) |
Tables
tables:readtables:writeTable deletion over REST is authorized by tables:write. The separate tables:delete scope only gates the MCP delete_table tool, so treat any key with tables:write as able to delete tables.
| Method | Path | Description |
|---|---|---|
GET | /api/search | Search and filter tables by name, catalog, namespace, or health status |
GET | /api/namespaces/{catalogName} | List root namespaces in a catalog |
GET | /api/namespaces/{catalogName}/{namespacePath} | List child namespaces under a path |
GET | /api/tables/{catalogName}/{namespace}/{tableName}/metrics | Live file and record counts for the current snapshot, plus the file-size distribution |
GET | /api/partition-distribution/{catalogName}/{namespace}/{tableName} | Partition-level file counts, sizes, and delete ratios |
GET | /api/table-metrics | Metrics (records, file counts, sizes) for one or more tables |
DELETE | /api/tables/{catalogName}/{namespace}/{tableName} | Delete a table |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/rename | Rename a table |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/properties | Set table properties |
DELETE | /api/tables/{catalogName}/{namespace}/{tableName}/properties | Remove table properties |
Maintenance
tables:readtables:writeBoth POST routes need tables:write. The execute route runs one operation with the body as its config. The compaction route takes a required where predicate on file metadata and returns a plan; adding execute: true submits a compaction workflow for the matching files instead.
| Method | Path | Description |
|---|---|---|
POST | /api/tables/{catalogName}/{namespace}/{tableName}/policies/{type}/execute | Run one maintenance operation once with the body as config (COMPACT_DATA_FILES, EXPIRE_SNAPSHOTS, REMOVE_ORPHAN_FILES, REWRITE_MANIFESTS, …) |
POST | /api/compaction/{catalogName}/{namespace}/{tableName} | Plan compaction for files matching a WHERE predicate |
GET | /api/compaction/job/{jobId} | Status of a compaction planner job |
Snapshot management
tables:write| Method | Path | Description |
|---|---|---|
POST | /api/tables/{catalogName}/{namespace}/{tableName}/rollback-to-snapshot | Roll back a table to a specific snapshot ID |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/rollback-to-timestamp | Roll back a table to a point in time |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/set-current-snapshot | Set the current snapshot for a table |
DELETE | /api/tables/{catalogName}/{namespace}/{tableName}/branches/{branchName} | Delete a table branch |
DELETE | /api/tables/{catalogName}/{namespace}/{tableName}/tags/{tagName} | Delete a table tag |
Observability
readInsights and the per-table maintenance and events routes also accept tables:read.
| Method | Path | Description |
|---|---|---|
GET | /api/dashboard | Org-wide dashboard: table health, storage trends, operations count |
GET | /api/monitoring/maintenance-summary | Maintenance operation counts by type and status |
GET | /api/monitoring/maintenance-samples | Adaptive maintenance signals: needs_compaction, scores, projected triggers |
GET | /api/monitoring/operations-stats | Operations statistics and top failing tables |
GET | /api/insights/search | Search health insights by severity, type, catalog, or table |
GET | /api/insights/{catalogName}/{namespace}/{tableName} | Get insights for a specific table |
GET | /api/tables/{catalogName}/{namespace}/{tableName}/maintenance | Maintenance state for a table (compaction, expiry, rewrites, orphan cleanup) |
GET | /api/events | Search operation events across the lake |
GET | /api/events/timeline | Operation event timeline with aggregations |
GET | /api/events/storage-timeline | Storage usage timeline |
GET | /api/tables/{catalogName}/{namespace}/{tableName}/events | Operation events for a specific table |
Query
query:read| Method | Path | Description |
|---|---|---|
POST | /api/query/{catalogName} | Execute a read-only SQL query against tables in a catalog |
Policies
policies:readpolicies:writeTable-level routes under /api/tables/… are authorized as tables:read (GET) and tables:write (POST, PUT, DELETE).
| Method | Path | Description |
|---|---|---|
GET | /api/policies | List governance policies, optionally filtered by type or catalog |
POST | /api/policies/{type} | Create a governance policy |
GET | /api/policies/{type}/{id} | Get a policy by type and ID |
PUT | /api/policies/{type}/{id} | Update a policy |
DELETE | /api/policies/{type}/{id} | Delete a policy |
GET | /api/tables/{catalogName}/{namespace}/{tableName}/policies | List policies attached to a table |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/policies/{type} | Create a table-level policy |
PUT | /api/tables/{catalogName}/{namespace}/{tableName}/policies/{type}/{id} | Update a table-level policy |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/policies/{type}/{id}/enable | Enable a table-level policy |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/policies/{type}/{id}/disable | Disable a table-level policy |
POST | /api/tables/{catalogName}/{namespace}/{tableName}/policies/{type}/{id}/execute | Trigger immediate execution of a table-level policy |
Examples
List all catalogs
curl https://api.lakeops.dev/api/catalogs \
-H "Authorization: Bearer $LAKEOPS_API_KEY"Add, change, or remove catalog properties
Needs catalogs:admin. Properties you don't name are left as they are. Send secrets in full: the masked ******** value is rejected here.
curl -X PATCH https://api.lakeops.dev/api/catalogs/prod_rest/properties \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"updates": { "s3.region": "eu-west-1" },
"removals": ["old-key"]
}'
# 200
{ "updated": ["s3.region"], "removed": ["old-key"], "missing": [] }Search tables by health status
curl "https://api.lakeops.dev/api/search?status=CRITICAL&catalog=production-glue" \
-H "Authorization: Bearer $LAKEOPS_API_KEY"Get table health insights
curl https://api.lakeops.dev/api/insights/production-glue/analytics/page_events \
-H "Authorization: Bearer $LAKEOPS_API_KEY"Run compaction on one table now
Needs tables:write. Returns once the workflow is submitted; the second call lists the table's operation events so you can follow it.
curl -X POST https://api.lakeops.dev/api/tables/production-glue/analytics/page_events/policies/COMPACT_DATA_FILES/execute \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"whereClause": "1=1"}'
curl https://api.lakeops.dev/api/tables/production-glue/analytics/page_events/events \
-H "Authorization: Bearer $LAKEOPS_API_KEY"Create a nightly compaction policy
Needs policies:write. cronExpression is 5-field Unix cron.
curl -X POST https://api.lakeops.dev/api/policies/COMPACT_DATA_FILES \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "nightly-compaction",
"catalogName": "production-glue",
"executionType": "SCHEDULED",
"cronExpression": "0 2 * * *",
"config": {
"strategy": "binpack",
"targetFileSizeBytes": 536870912
}
}'Run an ad-hoc SQL query
Needs query:read. Only SELECT, SHOW, DESCRIBE, and EXPLAIN are allowed. limit defaults to 1000 (max 10000).
curl -X POST https://api.lakeops.dev/api/query/production-glue \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "SELECT COUNT(*) FROM analytics.page_events",
"limit": 100
}'Get the org-wide dashboard
curl "https://api.lakeops.dev/api/dashboard?period=30d" \
-H "Authorization: Bearer $LAKEOPS_API_KEY"
# period: 1d, 7d, 14d, or 30d (default 30d)
# Response includes:
# - totalCatalogs, totalTables, totalDataSizeBytes
# - healthyTables, warningTables, criticalTables
# - totalDeletedSizeBytes, compactionDataOptimizedBytes, compactionFileReductionPercent
# - tablesNeedingOptimization, tablesMaintained, totalEventsGitHub Actions integration
Automate table maintenance as part of your CI/CD pipeline. Store your API key as a GitHub Actions secret and call the REST API from workflow steps.
1. Add the API key as a secret
Go to your repository's Settings > Secrets and variables > Actions and add a secret named LAKEOPS_API_KEY.
2. Example workflow
This workflow runs nightly: finds tables in CRITICAL health, runs compaction on each, and prints a lake health summary. The key needs read and tables:write.
# .github/workflows/lakeops-maintenance.yml
name: LakeOps Nightly Maintenance
on:
schedule:
- cron: "0 3 * * *" # 3 AM UTC daily
workflow_dispatch: # manual trigger
env:
LAKEOPS_API: https://api.lakeops.dev
CATALOG: production-glue
jobs:
maintain:
runs-on: ubuntu-latest
env:
LAKEOPS_API_KEY: ${{ secrets.LAKEOPS_API_KEY }}
steps:
- name: Find critical tables
run: |
curl -sf "$LAKEOPS_API/api/search?status=CRITICAL&catalog=$CATALOG&pageSize=100" \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
| jq -r '.results[] | .namespace + "/" + .tableName' > critical_tables.txt
echo "Critical tables: $(wc -l < critical_tables.txt)"
- name: Compact critical tables
run: |
while IFS= read -r table; do
echo "Compacting $CATALOG/$table"
curl -sf -X POST "$LAKEOPS_API/api/tables/$CATALOG/$table/policies/COMPACT_DATA_FILES/execute" \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"whereClause": "1=1"}'
echo
done < critical_tables.txt
- name: Lake health summary
run: |
curl -sf "$LAKEOPS_API/api/dashboard" \
-H "Authorization: Bearer $LAKEOPS_API_KEY" \
| jq '{healthyTables, warningTables, criticalTables, totalDeletedSizeBytes}'More CI/CD patterns
Best practices
- •Use the narrowest scopes that work. A health-check job needs
readonly; addtables:writeorpolicies:writeonly for jobs that change tables or policies. Avoid the globalwritescope in CI. - •Set an expiration on keys used in CI/CD. Rotate regularly.
- •Store keys in secret managers (GitHub Secrets, AWS Secrets Manager, Vault) — never commit them to source control.
- •For high-frequency polling, prefer the
/api/dashboardendpoint over individual table queries.
Next steps
- •Connect Your Agent — give an AI agent the same access over MCP. Tool and scope reference is on MCP Server.
- •Policies — define governance rules that the API can create and manage.
- •Manage the Lakehouse — agent prompts for the same jobs, with an MCP-to-REST mapping.
