Skip to main content

HTTP API

Everything the CLI and web UI do goes through the Catchment's HTTP API. This page covers authentication, shared conventions and the available routes. For request and response bodies, every Catchment serves its own schema:

PathContents
/openapi.jsonThe OpenAPI schema.
/docsInteractive documentation (Swagger UI).
/redocReference documentation (ReDoc).

All routes below are under /api, apart from /metrics.

Authentication​

A Catchment is either open, or protected by API keys. An open Catchment treats every request as having full access. This is also the right setting when a hosting platform authenticates requests before they reach the Catchment.

With keys configured, send one as a bearer token:

curl -H "Authorization: Bearer $DUCKSTRING_KEY" http://127.0.0.1:7474/api/status

Keys come in three levels, each including the ones before it:

LevelAllows
readStatus, run history, lineage, data and catalog queries.
demandAlso triggers: tap, wave, pulse, tide and removing a trigger.
fullEverything else: deploying, control actions, windows, Spouts, secrets, alerts, ducts, compute and Catchment settings.

A missing or unrecognised key gets 401; a key below the route's level gets 403. Tracebacks in run history are only returned to full keys; lower levels get the error message alone.

Conventions​

Targeting a major line. Routes that act on one Pond take the Pond name in the path and two optional query parameters:

ParameterDescription
majorThe major line. Defaults to the highest deployed.
versionA full version such as 1.2.0. Must be the major line's currently deployed version, otherwise 422.

Status codes.

CodeMeaning
401, 403Authentication, as above.
404Unknown Pond, table, Object, Spout, window or channel.
409The operation needs the Pond idle, or conflicts with its current state.
422Invalid input, including a deployment that breaks a version pin, and a failed confirmation for irreversible operations.

A connection test (/spouts/test, /alerts/{name}/test) that fails returns 200 with {"ok": false, "error": ...}, since the request itself succeeded.

Routes​

Catchment​

MethodPathLevelDescription
GET/api/healthnoneLiveness check.
GET/api/catchment/identityreadThe Catchment's name and id.
GET/api/catchment/settingsreadData root and cloud status.
PUT/api/catchment/settingsfullSet the data root.
GET/api/catchment/duck-poolsreadBuilt-in and defined pools.
POST/api/catchment/duck-poolsfullCreate or update a pool.
DELETE/api/catchment/duck-pools/{name}fullRemove a pool.
GET/api/catchment/compute-defaultsreadCatchment-wide compute defaults.
GET/api/catchment/instance-typesfullAvailable EC2 instance types.
POST/api/catchment/cloud/verifyfullCheck the cloud configuration.
POST/api/catchment/keys/rotatefullReplace API keys.
POST/api/catchment/resetfullReset every Pond.
GET/api/catchment/usagefullSize of the state directory.
GET/api/catchment/archivefullDownload the state directory as a tar stream.

Deploying and removing​

MethodPathLevelDescription
POST/api/deployfullDeploy a Pond (a packaged upload or a git reference).
GET/api/ponds/{name}/versions/{version}readWhether a version is deployed.
DELETE/api/ponds/{name}fullRemove a major line.

Status and history​

MethodPathLevelDescription
GET/api/statusreadEvery Pond's state, freshness, triggers and failures, the edges between Ponds, and the caller's access level.
GET/api/runsreadRun history, newest first. Parameters: pond, lineage (include upstream Ponds), ripples (include Ripple Runs), limit (up to 1000).
GET/api/viewreadThe Pond graph, including Ponds in upstream Catchments reached through ducts.
GET/api/lineagereadObserved table lineage. Parameters: pond, major, table, columns.
GET/api/ponds/{name}/tracereadThe run that produced some rows. Parameters: table, where.
GET/api/ponds/{name}/freshnessreadThe Pond's current freshness.

Triggers and windows​

MethodPathLevelDescription
POST/api/ponds/{name}/tapdemandTap.
POST/api/ponds/{name}/pulsedemandPulse.
POST/api/ponds/{name}/wavedemandSet a Wave.
POST/api/ponds/{name}/tidedemandSet a Tide. Body: bound_seconds.
POST/api/ponds/{name}/untriggerdemandRemove the standing trigger.
GET/api/ponds/{name}/windowsreadList windows.
POST/api/ponds/{name}/windowsfullAdd a window.
POST/api/ponds/{name}/windows/{window_name}/removefullRemove a window.

Control​

MethodPathLevelDescription
POST/api/ponds/{name}/wakefullWake.
POST/api/ponds/{name}/forcefullForce.
POST/api/ponds/{name}/refreshfullMark for a rebuild on the next run.
POST/api/repairfullRepair a connected set of Ponds.
POST/api/ponds/{name}/sleepfullSleep.
POST/api/ponds/{name}/killfullKill.
POST/api/ponds/{name}/clearfullClear a failure.
POST/api/ponds/{name}/resetfullReset to the freshly deployed state.
POST/api/ponds/{name}/reset-contractfullForget the recorded output schema.
POST/api/ponds/{name}/wipe-historyfullDelete run history.
POST/api/ponds/batchfullApply operations to many Ponds, as duckstring do.
GET/api/ponds/{name}/budgetreadRetry budgets.
POST/api/ponds/{name}/budgetfullSet retry budgets.
GET/api/ponds/{name}/duckreadEffective compute settings.
POST/api/ponds/{name}/duckfullSet or clear the compute override.

Data​

MethodPathLevelDescription
POST/api/queryreadRun SQL against one Pond's tables. Body: pond, sql, optional major, version, format (json, csv or parquet).
POST/api/query/page, /api/query/count, /api/query/historyreadPaged reads used by the web UI's data viewer.
GET/api/ponds/{name}/tablesreadList published tables.
GET/api/ponds/{name}/ripples/{table}readDownload a table's published files as a zip.
DELETE/api/ponds/{name}/tables/{table}fullDelete a table.
GET/api/ponds/{name}/objectsreadList Objects.
GET/api/ponds/{name}/objects/{obj}readDownload an Object.
DELETE/api/ponds/{name}/objects/{obj}fullDelete an Object.

Catalog​

MethodPathLevelDescription
GET/api/servereadServed majors and exposed tables.
POST/api/serve/queryreadRun SQL across the catalog. Read-level keys see only exposed tables.
POST/api/ponds/{name}/serve/promotefullChange the served major.
POST/api/ponds/{name}/serve/exposefullExpose or hide a table.

Spouts​

MethodPathLevelDescription
GET/api/ponds/{name}/spoutsfullList Spouts.
POST/api/ponds/{name}/spoutsfullAdd a Spout.
POST/api/ponds/{name}/spouts/testfullTest a destination without writing data.
POST/api/ponds/{name}/spouts/{spout}/removefullRemove a Spout.
POST/api/ponds/{name}/spouts/{spout}/{action}fullwake, force, sleep, kill, clear or resync.

Secrets and alerts​

MethodPathLevelDescription
GET/api/secretsfullSecret names and when each was set. Never values.
POST/api/secretsfullSet a secret. Body: name, value.
DELETE/api/secrets/{name}fullDelete a secret.
GET/api/alertsfullList channels.
POST/api/alertsfullAdd a channel.
DELETE/api/alerts/{name}fullRemove a channel.
POST/api/alerts/{name}/testfullSend a test message.
GET/api/alerts/deliveriesfullRecent deliveries.

Ducts​

MethodPathLevelDescription
GET/api/ductfullList ducts.
POST/api/ductfullCreate a duct.
DELETE/api/duct/{origin}fullDestroy a duct.
POST/api/duct/{origin}/pondsfullDraw a Pond.
DELETE/api/duct/{origin}/ponds/{pond}fullStop drawing a Pond.
POST/api/duct/{origin}/syncfullDraw every exposed Pond.
POST/api/ponds/{name}/openfullOpen a Pond to demand from other Catchments.
POST/api/ponds/{name}/closefullClose it.

The /api/draw/* routes that ducts use to transfer data, and the /api/duck/* and /api/pool/* routes that Ducks use to talk to the Catchment, are internal and not covered here.

Metrics​

GET /metrics serves Prometheus metrics without authentication, following exporter convention. Restrict network access to it if Pond names are sensitive.

MetricTypeDescription
duckstring_upgauge1 while the Catchment is serving.
duckstring_pond_freshness_lag_secondsgaugeSeconds since each Pond's freshness.
duckstring_pond_failed, duckstring_pond_blocked, duckstring_pond_killedgauge1 when the Pond is in that state.
duckstring_pond_runs_completed_totalcounterCompleted Pond Runs.
duckstring_pond_failures_totalcounterFailed Pond Runs.
duckstring_pond_run_seconds_totalcounterTotal Duck execution time, summed over Ripple Runs.
duckstring_pond_duck_targetgauge1 for the compute target each Pond runs on.
duckstring_pond_flockgauge1 for each Pond's effective Flock mode and engine.
duckstring_spout_delivery_lag_secondsgaugeSeconds since each Spout last delivered.
duckstring_spout_failedgauge1 when the Spout's latest delivery failed.
duckstring_alert_deliveries_totalcounterAlert deliveries, by status.
duckstring_flock_dispatched_totalcounterComputations sent to the Flock, per Pond.
duckstring_flock_dispatch_failures_totalcounterFlock dispatches that failed and ran in the Duck instead. The only sign that a Flock is misconfigured.

Other interfaces​

The catalog can also be queried over the Postgres wire protocol and Arrow Flight, each enabled by setting a port (DUCKSTRING_SERVE_PG_PORT, DUCKSTRING_SERVE_FLIGHT_PORT; see Environment Variables). Both use an API key as the password and apply the same access levels.