Repository navigation
REST API Reference
A summary of the management REST API of kingresd. The contract is kingres/api/openapi.yaml (OpenAPI 3.1), revision 0.34.0 in 0.1.0 and 0.1.1 (0.2.0 has 0.35.0, with 14 operations for Extensions; 0.2.1 has 0.37.0 with 199 operations, six of them new for the ledger checks at 0.36.0 and one, resumeTask, at 0.37.0), with 178 operations on 142 paths and 330 schemas at 0.34.0; its conventions are written in kingres/api/README.md. This page does not repeat the spec: it names the groups, the rules that hold for all operations, and the errors. The service itself is described in Control Plane and REST API; the console is a client of this API only (Web Console).
-
Base path
/api/v1. Plural nouns, kebab-case path segments, camelCase JSON properties. -
Identifiers. Instance and shard group ids are integers (the map group is group 0). A server id is an opaque string (its host as stored). Databases, roles, schemas, tables and server groups are addressed by name. Tables are
/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}. -
Lists are objects with
items. Large lists takelimit(1 to 500, default 50) and an opaquecursorand returnnextCursor. Small lists (servers, databases, server groups, colocation groups, instances) return everything. -
Types. Timestamps are RFC 3339 UTC, sizes are bytes, hashes are 64 lower-case hex characters. A value the server does not know is
null, never an invented zero. -
Updates.
PATCHis a partial update;PUTon a sub-resource replaces it. -
Request id. Every response carries
X-Request-Id, copied into error bodies and audit events. -
Long-running operations answer 202 with a
TaskandLocation: /api/v1/tasks/{taskId}; pollGET /tasks/{taskId}(stateispending,running,paused,failedordone, withprogress). Tasks are durable and idempotent; a conflicting second request is 409operation_in_progress. The setup operations are followed throughGET /setup/stateinstead. -
Forwarding. A mutating cluster operation received by a server that is not the manager leader is forwarded to it and the client sees the leader's answer; if the leader cannot be reached the answer is 503
leader_unavailable. - Request pipeline (in this order): node-state gating, cross-site check, rate limit, authentication, CSRF check, role check, query-parameter validation, handler. Unknown query parameters are 400.
| Mechanism | How |
|---|---|
| Session cookie |
POST /auth/login with a PostgreSQL role and password sets kingres_session (HttpOnly, Secure, SameSite=Strict). The response holds a csrfToken that browsers send as X-CSRF-Token on POST, PUT, PATCH and DELETE. The token is fixed for the session |
| Bearer token |
login with issueToken: true also returns a token for scripts; bearer requests need no CSRF header |
| Setup token |
X-Setup-Token for /setup/* operations, one-time, loopback callers unless allow-remote-setup is true |
| Metrics scrape |
/metrics (outside the contract) takes a stats-role session token or the configured metrics-token
|
The role needs LOGIN and membership in at least one cluster role. A session belongs to the server that issued it; another server answers 401, and a restart ends it. The four cluster roles form a hierarchy kingres_admin > kingres_ops > kingres_readonly > kingres_stats; every operation names its minimum in x-required-role. The contract has 76 operations for admin, 23 for ops, 68 for readonly, 4 for stats and 7 without a role. An account with only kingres_stats reaches /metrics/query, /cluster/summary and /auth/*. Audited operations (those that change something, plus executeQuery) are written to an append-only audit log; read it with GET /audit (admin). Entries never hold a key, passphrase or credential. See Security Model.
Every error is RFC 9457 application/problem+json with type, title, status, detail, instance, the machine-readable code and, where useful, errors[] (field-level, for validation_failed), sqlState and sqlPosition (for sql_error) and requestId. Clients must branch on code. Unexpected failures are 500 internal_error.
| Status | Meaning | Codes |
|---|---|---|
| 400 | Malformed request |
bad_request, validation_failed
|
| 401 | Not signed in |
unauthenticated, invalid_credentials, session_expired, setup_token_invalid
|
| 403 | Role, CSRF or address |
forbidden, csrf_token_invalid
|
| 404 | Unknown resource | not_found |
| 405 | Wrong method, Allow header, answered before authentication |
method_not_allowed |
| 409 | State conflict |
conflict, already_exists, immutable_field, rebalance_in_progress, operation_in_progress, task_not_cancellable, last_admin, role_in_use, optimistic_lock_failed, no_replica_available, instance_already_running, instance_already_stopped, server_owns_buckets, server_hosts_map_group, last_server, server_group_not_empty, ledger_entry_pending; the codes added by later revisions (for example failover_in_progress, group_degraded, failover_needs_decision, version_mismatch, cluster_inconsistent, nothing_to_rebalance, no_receiving_server, lease_settings_differ, bucket_busy, schema_pinned, schema_move_in_progress, sharding_mode_in_use, partition_policy_conflict, upload_offset_mismatch) are listed with the status of the operation that answers them |
| 422 | Well-formed, cannot be done |
unprocessable, sql_error, unsupported_operation, node_state_invalid
|
| 429 | Rate limit on unauthenticated operations | rate_limited |
| 503 | Cannot serve now |
node_uninitialized, map_group_unavailable, leader_unavailable, quorum_unavailable, service_unavailable, system_database_stopped
|
The full closed list is the enum ProblemCode (99 values at 0.34.0). Others in it: certificate_revoked, certificate_authority_unavailable, internal_api_disabled, workbench_busy, insufficient_disk, nothing_pending, rebalance_not_running, ledger_not_published, origin_prefix_locked, signing_key_missing, last_signing_key, chain_not_diverged, the configuration codes config_parameter_unknown, config_parameter_managed, config_parameter_refused, config_level_not_allowed, config_value_below_floor, config_change_superseded, config_restart_order_conflict, the analytics codes table_not_eligible, extension_unavailable, extension_version_mismatch, sketch_hash_mismatch, extension_missing and conversion_refused, the codes of table and database transfers (data_transfer_disabled, insecure_transport, transfer_quota_exceeded, upload_incomplete, chunk_too_large, upload_checksum_mismatch, import_header_mismatch, import_ledger_policy, import_too_large, import_end_marker, export_untrusted_code, export_not_readable, large_objects_present, schema_unrecognised, archive_invalid, archive_incompatible, archive_statement_refused, ledger_restart_not_acknowledged) and replicas_cannot_be_kept, schema_not_distributable, split_unsupported.
unsupported_operation (422) means this server version does not implement the operation yet. It is answered after authentication, CSRF and role checks. Clients treat it as "not available in this version", not as a user error. At 0.34.0 every operation of the contract is built; the only place it is still answered is the check anchors of startLedgerVerification, which is not built, and a call that needs a newer version of an extension than the server has (Limitations and Known Issues).
The contract has a revision number, 0.34.0 in 0.1.0 and 0.1.1, 0.35.0 in release 0.2.0 and 0.37.0 in releases 0.2.1 and 0.2.2 (0.36.0 added the ledger checks of phase 18, 0.37.0 adds resumeTask and the instances of a preload change), and a changelog in the README of kingres/api from 0.2.0 on. Each entry says whether the revision is breaking or additive. The revision is part of the first release (0.1.0, published on 2026-11-28). 0.34.0 added no operation and one audit action (releaseMapGroupHold, written by the local command kingresd -release-map-hold, which is not a REST operation). Rules that clients should follow: tolerate unknown enum values (for example alert kinds and audit actions), branch on code, and treat a missing optional property as "absent from a server of an older revision". kingresd -version prints the contract revision it was built from. The contract is the source of the operation table generated into kingresd and of the console's types; both are checked against it.
npx --yes @redocly/cli@latest lint kingres/api/openapi.yaml # from the repository root
cd kingres/api && npm install && node scripts/check-contract.mjs # mechanical rules; exit 0 when they hold
cd kingres/control-plane && go generate ./internal/contract # operation table of kingresd; a test fails while it is stale
cd kingres/web && npm run api:check # generated types match the contract
check-contract.mjs enforces, among others: every operation has an id, summary, description, tags and a valid role; authenticated operations list 401, 403, 422 and 503; operations with a body or query parameters list 400; unauthenticated ones list 429; every error is application/problem+json; every 202 has a Location header and a Task body; every operation lists 405.
The roles below are the minimum role (none means no authentication). The tables are generated from the contract at 0.34.0 (178 operations on 142 paths in 26 groups); the contract is the reference. Notes on some groups follow the tables.
| Operation | Role | Purpose |
|---|---|---|
GET /healthz |
none | Liveness probe |
GET /readyz |
none | Readiness probe |
| Operation | Role | Purpose |
|---|---|---|
POST /auth/login |
none | Sign in |
POST /auth/logout |
stats | Sign out |
GET /auth/session |
stats | Get the current session |
| Operation | Role | Purpose |
|---|---|---|
GET /setup/state |
none | Get the setup state of this server |
POST /setup/init-cluster |
none | Create a new cluster on this server |
POST /setup/join-cluster |
none | Join an existing cluster |
POST /setup/token-check |
none | Check the setup token |
| Operation | Role | Purpose |
|---|---|---|
GET /this-server |
readonly | Get this server |
GET /this-server/resources |
readonly | Get disk, memory and CPU of this server |
GET /this-server/instances |
readonly | List local PostgreSQL instances |
GET /this-server/instances/{instanceId} |
readonly | Get a local instance |
POST /this-server/instances/{instanceId}/restart |
ops | Restart a local instance |
POST /this-server/instances/{instanceId}/stop |
ops | Stop a local instance |
POST /this-server/instances/{instanceId}/start |
ops | Start a local instance |
GET /this-server/settings |
readonly | Get local settings |
PATCH /this-server/settings |
admin | Update local settings |
POST /this-server/leave-cluster |
admin | Leave the cluster |
GET /this-server/logs |
ops | List local logs |
| Operation | Role | Purpose |
|---|---|---|
GET /cluster |
readonly | Get the cluster overview |
GET /cluster/summary |
stats | Get the short cluster summary |
| Operation | Role | Purpose |
|---|---|---|
GET /servers |
readonly | List servers |
POST /servers |
admin | Add a server |
GET /servers/{serverId} |
readonly | Get a server |
PATCH /servers/{serverId} |
ops | Update a server |
DELETE /servers/{serverId} |
ops | Remove a server (drain) |
POST /servers/{serverId}/failover |
ops | Fail over a server |
POST /servers/{serverId}/drain |
ops | Drain a server |
GET /servers/{serverId}/drain-preview |
readonly | Preview the drain of a server |
POST /servers/{serverId}/certificates/renewals |
admin | Renew the certificates of a server now |
POST /servers/{serverId}/certificates/revocations |
admin | Revoke the certificates of a server |
GET /certificate-authority/escrow |
admin | Get the escrow of the certificate authority key |
PUT /certificate-authority/escrow |
admin | Switch the escrow of the certificate authority key on or off |
POST /certificate-authority/escrow/rotations |
admin | Rotate the escrow keys and reseal the copies |
| Operation | Role | Purpose |
|---|---|---|
GET /server-groups |
readonly | List server groups |
POST /server-groups |
ops | Create a server group |
DELETE /server-groups/{serverGroupName} |
ops | Delete a server group |
| Operation | Role | Purpose |
|---|---|---|
GET /database-create-options |
readonly | Get the options of the create-database dialog |
GET /databases |
readonly | List databases |
POST /databases |
admin | Create a database |
GET /databases/{databaseName} |
readonly | Get a database |
PATCH /databases/{databaseName} |
admin | Update a database |
DELETE /databases/{databaseName} |
admin | Drop a database |
GET /databases/{databaseName}/approximate-aggregates |
readonly | Get the approximate-aggregates setting of a database |
PUT /databases/{databaseName}/approximate-aggregates |
admin | Turn approximate aggregates on or off for a database |
| Operation | Role | Purpose |
|---|---|---|
GET /databases/{databaseName}/tables |
readonly | List tables of a database |
GET /databases/{databaseName}/schemas/{schemaName}/tables/{tableName} |
readonly | Get a table |
PUT /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/distribution |
admin | Distribute a table |
PATCH /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/distribution |
admin | Change the distribution of a distributed table |
DELETE /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/distribution |
admin | Turn a distributed table back into a plain table |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/distribution/preview |
admin | Preview a change of a table |
GET /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/related-tables |
readonly | List the tables linked to a table by foreign keys |
GET /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions |
readonly | List the user partitions of a distributed table |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions |
admin | Create a user partition |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions/attach |
admin | Attach a distributed table as a user partition |
DELETE /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions/{partitionName} |
admin | Drop a user partition |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions/{partitionName}/detach |
admin | Detach a user partition as a table of its own |
PUT /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/storage |
admin | Change the storage format of a table |
PUT /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions/{partitionName}/storage |
admin | Change the storage format of one partition |
GET /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy |
readonly | Get the time-partitioning policy of a table |
PUT /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy |
admin | Set the time-partitioning policy of a table |
DELETE /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy |
admin | Remove the time-partitioning policy of a table |
GET /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy/runs |
readonly | List the runs of a time-partitioning policy |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy/runs |
admin | Run a time-partitioning policy now |
GET /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy/runs/{runId} |
readonly | Get one run of a time-partitioning policy |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partition-policy/plan |
readonly | Preview the actions of a time-partitioning policy |
PUT /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/ledger |
admin | Put a table under ledger control |
| Operation | Role | Purpose |
|---|---|---|
GET /databases/{databaseName}/colocation-groups |
readonly | List colocation groups |
POST /databases/{databaseName}/colocation-groups/{colocationId}/buckets/{bucket}/split-preview |
readonly | Preview the split of a bucket |
POST /databases/{databaseName}/colocation-groups/{colocationId}/buckets/{bucket}/split |
admin | Split a bucket |
GET /databases/{databaseName}/colocation-groups/{colocationId}/buckets |
readonly | List buckets of a colocation group |
GET /databases/{databaseName}/bucket-distribution |
readonly | Get bucket counts per server |
| Operation | Role | Purpose |
|---|---|---|
GET /databases/{databaseName}/schemas |
readonly | List the schemas of a database |
GET /databases/{databaseName}/schemas/{schemaName} |
readonly | Get a schema |
PUT /databases/{databaseName}/schemas/{schemaName}/distribution |
admin | Distribute a schema |
DELETE /databases/{databaseName}/schemas/{schemaName}/distribution |
admin | Make a distributed schema local |
POST /databases/{databaseName}/schemas/{schemaName}/moves |
ops | Move a distributed schema to another shard group |
| Operation | Role | Purpose |
|---|---|---|
GET /replication/topology |
readonly | Get the replication topology |
POST /replication/restore-preferred-primaries |
ops | Restore preferred primaries |
GET /failover |
readonly | Get the current failover status |
POST /failover/map/abandon |
admin | Give up a stuck bootstrap of the map group |
GET /failover/reports |
readonly | List failover reports |
GET /failover/reports/{reportId} |
readonly | Get a failover report |
| Operation | Role | Purpose |
|---|---|---|
GET /rebalance |
readonly | Get the current rebalance status |
POST /rebalance |
ops | Start (or resume) a rebalance |
POST /rebalance/plan |
readonly | Preview a rebalance plan |
POST /rebalance/stop |
ops | Stop the running rebalance |
GET /rebalance/reports |
readonly | List rebalance reports |
GET /rebalance/reports/{reportId} |
readonly | Get a rebalance report |
| Operation | Role | Purpose |
|---|---|---|
GET /tasks |
readonly | List tasks |
GET /tasks/{taskId} |
readonly | Get a task |
POST /tasks/{taskId}/cancel |
ops | Cancel a task |
POST /tasks/{taskId}/resume |
ops | Resume a paused task of kind preload.update (0.37.0, in 0.2.1) |
| Operation | Role | Purpose |
|---|---|---|
GET /cluster-roles |
readonly | List built-in cluster roles |
GET /roles |
admin | List roles |
POST /roles |
admin | Create a role |
GET /roles/{roleName} |
admin | Get a role |
PATCH /roles/{roleName} |
admin | Update a role |
DELETE /roles/{roleName} |
admin | Drop a role |
PUT /roles/{roleName}/memberships |
admin | Replace the role membership |
PUT /roles/{roleName}/cluster-roles |
admin | Replace the cluster roles of a role |
| Operation | Role | Purpose |
|---|---|---|
GET /grants |
admin | List grants |
POST /grants |
admin | Grant privileges |
POST /grants/revocations |
admin | Revoke privileges |
POST /grants/template-applications |
admin | Apply a grant template |
| Operation | Role | Purpose |
|---|---|---|
GET /settings/network-access |
admin | Get network access rules |
PUT /settings/network-access |
admin | Replace network access rules |
| Operation | Role | Purpose |
|---|---|---|
GET /audit |
admin | List audit events |
| Operation | Role | Purpose |
|---|---|---|
POST /settings/cluster/auto-failover/reset |
admin | Reset the counter of automatic failovers |
GET /settings/cluster |
readonly | Get cluster settings |
PATCH /settings/cluster |
admin | Update cluster settings |
| Operation | Role | Purpose |
|---|---|---|
GET /ledger/status |
readonly | List ledger status of all databases |
GET /databases/{databaseName}/ledger |
readonly | Get ledger status of a database |
GET /databases/{databaseName}/ledger/blocks |
readonly | List ledger blocks |
GET /databases/{databaseName}/ledger/digests |
readonly | List digests |
POST /databases/{databaseName}/ledger/digests |
ops | Generate a digest |
GET /databases/{databaseName}/ledger/verifications |
readonly | List verification runs |
POST /databases/{databaseName}/ledger/verifications |
ops | Start a ledger verification |
GET /databases/{databaseName}/ledger/verifications/{verificationId} |
readonly | Get a verification run |
POST /databases/{databaseName}/ledger/inclusion-proofs |
readonly | Create an inclusion proof for a row |
GET /ledger/settings |
readonly | Get the cluster settings of ledger publication and anchoring |
PUT /ledger/settings |
admin | Change the cluster settings of ledger publication and anchoring |
GET /ledger/signing |
readonly | Get the signing keys of the ledger |
POST /ledger/signing/keys |
admin | Create the first signing key, or rotate to a new one |
POST /ledger/signing/keys/{fingerprint}/retire |
admin | Retire a signing key now |
POST /ledger/signing/keys/{fingerprint}/revoke |
admin | Revoke a signing key (compromise) |
GET /ledger/signing/trust-file |
readonly | Download the trust file for kingres-verify |
GET /ledger/publication |
readonly | Get the state of the ledger publication |
GET /ledger/publication/audit |
readonly | Get the settings and state of the scheduled audit of the publication (0.36.0, in 0.2.1) |
PATCH /ledger/publication/audit |
admin | Change the settings of the scheduled audit (0.36.0, in 0.2.1) |
POST /ledger/publication/audit/runs |
ops | Audit the publication now (0.36.0, in 0.2.1) |
POST /databases/{databaseName}/ledger/publication/audit/acknowledge |
admin | Acknowledge an altered finding of the audit (0.36.0, in 0.2.1) |
GET /databases/{databaseName}/ledger/check-reports |
readonly | List the reports of the ledger checks (0.36.0, in 0.2.1) |
GET /databases/{databaseName}/ledger/check-reports/{reportId} |
readonly | Get a report of a ledger check (0.36.0, in 0.2.1) |
GET /ledger/anchor-targets |
readonly | List anchor targets |
POST /ledger/anchor-targets |
admin | Add an anchor target |
GET /ledger/anchor-targets/{targetId} |
readonly | Get an anchor target |
PATCH /ledger/anchor-targets/{targetId} |
admin | Change an anchor target |
DELETE /ledger/anchor-targets/{targetId} |
admin | Delete an anchor target |
POST /ledger/anchor-targets/{targetId}/test |
admin | Test an anchor target |
GET /databases/{databaseName}/ledger/aggregate |
readonly | Get an aggregate checkpoint of a database |
GET /databases/{databaseName}/ledger/aggregates |
readonly | List the aggregate checkpoints of a database |
GET /databases/{databaseName}/ledger/anchors |
readonly | List the anchor records of a database |
POST /databases/{databaseName}/ledger/anchors |
ops | Anchor the newest aggregate now |
POST /databases/{databaseName}/ledger/anchors/{anchorId}/retry |
ops | Retry a failed anchor record |
GET /databases/{databaseName}/ledger/anchors/{anchorId}/evidence |
readonly | Download the evidence of an anchor |
POST /databases/{databaseName}/ledger/bundles |
ops | Create a bundle for offline verification |
GET /databases/{databaseName}/ledger/bundles/{bundleId} |
ops | Download a bundle |
GET /databases/{databaseName}/ledger/client-keys |
readonly | List the registered client keys of a database |
POST /databases/{databaseName}/ledger/client-keys |
admin | Register a client key |
POST /databases/{databaseName}/ledger/client-keys/{keyId}/revoke |
admin | Revoke a client key |
PUT /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/ledger/signature-policy |
admin | Require client signatures for a ledger table |
POST /databases/{databaseName}/ledger/upgrade |
admin | Upgrade the kingres_ledger extension of a database |
POST /databases/{databaseName}/ledger/chains/{shardGroupId}/acknowledge |
admin | Acknowledge a diverged chain and start a new epoch |
| Operation | Role | Purpose |
|---|---|---|
POST /query |
readonly | Execute a SQL statement |
POST /query/statements/{statementId}/cancel |
readonly | Cancel a running statement |
| Operation | Role | Purpose |
|---|---|---|
GET /alerts |
readonly | List alerts |
PUT /alerts/{alertId}/acknowledgement |
ops | Acknowledge an alert |
| Operation | Role | Purpose |
|---|---|---|
GET /logs |
ops | Search cluster logs |
| Operation | Role | Purpose |
|---|---|---|
GET /metrics/query |
stats | Query a metric time series |
| Operation | Role | Purpose |
|---|---|---|
GET /config/parameters |
readonly | List PostgreSQL parameters with their values on every server |
GET /config/parameters/{name} |
readonly | Get one PostgreSQL parameter |
POST /config/changes/preview |
admin | Check a configuration change and show what it would do |
GET /config/changes |
readonly | List configuration changes |
POST /config/changes |
admin | Change PostgreSQL parameters |
POST /config/changes/{changeId}/revert |
admin | Revert a configuration change |
GET /config/servers |
readonly | Configuration state of every server |
GET /config/summary |
readonly | Configuration numbers for the dashboard |
GET /config/time |
readonly | Clocks and time zones of the servers |
GET /config/time-zones |
readonly | List the time zones PostgreSQL knows |
POST /config/restarts |
admin | Restart the instances that wait for a restart |
| Operation | Role | Purpose |
|---|---|---|
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/export |
admin | Export a table to a CSV file |
POST /databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/import |
admin | Import an uploaded CSV file into a table |
POST /databases/{databaseName}/export |
admin | Export a database to one archive |
POST /data-uploads |
admin | Start a resumable upload |
GET /data-uploads/{uploadId} |
admin | Read an upload |
PATCH /data-uploads/{uploadId} |
admin | Send one chunk of an upload |
DELETE /data-uploads/{uploadId} |
admin | Delete an upload |
POST /data-uploads/{uploadId}/validation |
admin | Validate an uploaded database archive |
POST /database-imports |
admin | Import a database archive as a new database |
GET /data-exports |
admin | List the exports of the signed-in role |
GET /data-exports/{exportId} |
admin | Read an export |
DELETE /data-exports/{exportId} |
admin | Delete an export |
GET /data-exports/{exportId}/content |
admin | Download an export file |
-
Setup.
GET /setup/state(no authentication) showsuninitialized,standaloneorclustered;setupTaskfollows an accepted init or join.POST /setup/token-checkvalidates a token without consuming it. See Cluster Setup. -
Servers and server groups.
POST /serversadds a server (taskserver.add);DELETE /servers/{serverId}removes a server that holds no data and does not move data;POST /servers/{serverId}/drainmoves the data off a server (with the hand-over of the map group when the server holds its primary) andGET /servers/{serverId}/drain-previewshows the plan first;POST /servers/{serverId}/failovertakesmode(hardorgraceful),dryRun,allowDataLoss,targetsandcomment;POST /failover/map/abandongives up a stuck bootstrap of the map group and takeslostServerIdto declare a lost candidate. A hard failover that accepts a loss of data needskingres_admin. See Servers Databases and Roles and High Availability. -
Certificate authority.
GET/PUT /certificate-authority/escrowandPOST /certificate-authority/escrow/rotationsshow, switch on or off and rotate the escrow of the key of the certificate authority (off until switched on). -
Rebalance. One cluster-wide task, a preview with
/rebalance/plan, stop and resume. Strategies by bucket count or disk size, weights, an automatic mode, one move at a time by default; schemas are items of the plan. See Rebalancing. -
Tables and schemas. Distribute (
PUT .../distribution, withrelatedTablesfor a table that foreign keys link), change the distribution (PATCH), make a table ordinary again (DELETE), preview a change, list the related tables, create, attach, detach and drop partitions, change the storage of a table or a partition (row or columnar), and the time-partitioning policy with its plan and runs. Distributed schemas have their own operations (/schemas, distribution, moves).Table.operationsays which long operation runs on a table. A bucket is split with.../buckets/{bucket}/splitafter a preview. See Sharding Table Lifecycle and Analytics Extensions. -
Data transfer. Export of a table or a database, resumable uploads, validation of a database archive, import of a table (
/tables/.../import) and of a database (POST /database-imports), and the staged exports. Off until the cluster settingdataTransfer.enabledis on; every operation needskingres_adminand TLS. See Administrator Guide. -
Configuration. Parameters at cluster, server group, server and database level, a preview, an apply task
config.apply, a restart taskconfig.restart, history and revert. See Configuration. -
Ledger. 37 operations in 0.2.0 (43 in 0.2.1): status, blocks, digests, verification runs and inclusion proofs per database; the signing keys, the trust file for
kingres-verify, the publication state, anchor targets and anchor records with their evidence, bundles for offline verification, client keys and signature policy, the upgrade of the extension and the acknowledgement of a diverged chain. An inclusion proof is the document of the extension, unchanged, in snake_case (the only exception to camelCase), so that it can be handed tokingres-verify. See Ledger, Ledger Signing and Publication, Ledger Anchoring and The Verifier. The checkanchorsof a verification answers 422unsupported_operationin release 0.2.0 and earlier. In release 0.2.1 (contract 0.36.0 for the ledger checks, 0.37.0 and 199 operations in all) it is built, with six new operations:getLedgerPublicationAudit,updateLedgerPublicationAudit,runLedgerPublicationAudit,acknowledgeLedgerPublicationAlteration,listLedgerCheckReportsandgetLedgerCheckReport(Ledger Anchoring). -
Query.
POST /queryruns one SQL statement as the signed-in role, so PostgreSQL privileges apply; the contract has no read-only mode. It has a row limit and a time limit, and a running statement is cancelled with/query/statements/{statementId}/cancel, on the server that started it. -
Audit.
GET /auditmerges the audit logs of the servers.AuditActionis the closed list of operation ids plus a few events that are not operations (for exampleloginFailed,autoFailoverandreleaseMapGroupHold). -
Alerts, Logs, Metrics. Alert kinds are an open set (the contract lists them in
AlertKind); logs are searched cluster-wide;GET /metrics/queryreturns a time series from the short in-memory history (Monitoring and Alerts). A Prometheus endpoint,GET /metrics, is outside the contract.
Each task kind has one subject type. The kinds in the contract: cluster.init, cluster.join, server.add, server.remove, server.failover, server.leave, instance.start, instance.stop, instance.restart, database.create, database.update, database.drop, database.approximateAggregates, database.export, database.import, archive.validate, table.distribute, table.undistribute, table.alter, table.partition, table.setStorage, table.export, table.import, partition.maintain, schema.distribute, schema.move, schema.undistribute, bucket.split, rebalance, replication.restorePreferredPrimaries, ledger.verify, the ledger.key.* tasks, ledger.bundle.create, ledger.epoch.start, ledger.upgrade, certificate.renew, certificate.revoke, replicate.apply, networkAccess.apply, config.apply, config.restart and standby.reconcile. System tasks such as automatic failover use server.failover with createdBy: system; a scheduled run of a time-partitioning policy is a partition.maintain task with createdBy: system. Task.id 0 stands for the bootstrap of a map-group failover and never names a stored task.
POST /api/v1/auth/login {"username":"alice","password":"s3cret","issueToken":true}
GET /api/v1/rebalance
POST /api/v1/servers/{serverId}/failover {"mode":"hard","dryRun":true}
POST /api/v1/databases/shop/ledger/inclusion-proofs {"schema":"app","table":"accounts","primaryKey":{"id":1}}
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations