Reference
Management API
The REST API behind the console and the MCP server: Access tokens and scopes, idempotency, Operations, pagination, errors and every endpoint.
The management API creates and manages Databases, Replicas, Credentials and Restores. The console and the MCP server use exactly these operations, so anything you can do there you can script.
The API manages your Account. It never carries your data's connections: software connects to a Database with a Connection URL.
Base URL
https://api.nordbase.<base>/v1<base> is the NordBase domain. It has not been chosen yet, so this page writes <base> literally; the console shows the real address.
Authentication
Every request, except GET /regions and GET /plans, carries an Access token:
curl "https://api.nordbase.<base>/v1/databases" \
-H "Authorization: Bearer $NORDBASE_ACCESS_TOKEN"An Access token starts with nbt_ followed by 40 letters and digits, and its id starts with at_. It is shown once, when you create it. Create your first one in the console; after that, a token with tokens:manage can create others. An Access token can never connect to a Database, and a Credential secret (nbs_…) is never accepted here.
Scopes
Each Access token has one or more scopes. Give each token only what its job needs.
| Scope | Allows |
|---|---|
account:read | Read the Account, its Subscription, Pool use and this month's Usage |
databases:read | Read Databases, Replicas, schemas, Recovery windows, Usage and Operations |
databases:write | Create, change, delete and undelete Databases; add, remove and promote Replicas; start Restores |
credentials:read | List and read Credentials, never their secrets |
credentials:write | Create, change, rotate and revoke Credentials |
sql:read | Run read-only statements through the query endpoint |
sql:write | With sql:read, run statements that change data through the query endpoint |
tokens:manage | List, create and revoke Access tokens |
audit:read | Read the audit log. Only owners and admins hold it |
Conventions
| Topic | Rule |
|---|---|
| Idempotency | A POST accepts an Idempotency-Key header, up to 255 characters. Repeating a key within 24 hours returns the first response instead of doing the work twice |
| Long-running changes | Answer 202 Accepted with an Operation. Follow it with GET /v1/operations/{operation_id} |
| Pagination | Lists take ?limit= (1 to 100, default 20) and ?cursor=, and answer { "data": [...], "next_cursor": "..." }. next_cursor is null on the last page |
| Times | RFC 3339, UTC, whole seconds, such as 2026-11-25T21:14:03Z |
| Sizes | Bytes, unless the field name says otherwise, such as egress_gb |
| Rate limit | 600 requests a minute per Access token. Every response carries RateLimit-* headers |
Use a fresh UUID as the Idempotency-Key for each new change, and the same one when you retry that change after a timeout.
Operations
Creating a Database, adding a Replica or restoring takes longer than one request. These calls answer 202 with an Operation:
{
"id": "op_9t2k7m4x1q8p3v6d",
"kind": "create_database",
"status": "running",
"database_id": "db-k7q2x9m4p1",
"progress": 60,
"created_at": "2026-11-25T21:14:03Z",
"finished_at": null
}| Field | Values |
|---|---|
kind | create_database, update_database, delete_database, undelete_database, create_replica, delete_replica, promote_replica, restore |
status | pending, running, succeeded, failed |
progress | 0 to 100 |
error | When failed: a problem object, as below |
Poll every few seconds until status is succeeded or failed.
Errors
Errors are application/problem+json (RFC 9457) with a stable code you can branch on:
{
"type": "about:blank",
"title": "The change does not fit the Account's Pool",
"status": 402,
"code": "pool_exceeded",
"needs": { "plan": "team" }
}code | Meaning | What to do |
|---|---|---|
validation_failed | The request body or a parameter is invalid. fields maps each field path to a message | Fix the fields named |
unauthenticated | No Access token, or an invalid, revoked or expired one | Check the Authorization header |
forbidden | The Access token lacks the scope this endpoint needs | Use a token with that scope |
not_found | The Database, Credential, Replica or Operation does not exist in your Account | Check the id |
conflict | The change conflicts with the current state | Read the resource again, then retry |
pool_exceeded | The change does not fit your Pool. needs.plan names the smallest Plan that fits | Make room or move to that Plan |
feature_not_in_plan | Your Plan does not include this, such as Replicas on Start. needs.plan names the smallest Plan that does | Move to that Plan |
region_unavailable | The Region cannot take new Instances now | Choose another Region from GET /v1/regions |
outside_recovery_window | The Restore point is not inside the Recovery window | Read GET /v1/databases/{database_id}/recovery-window |
subscription_inactive | The Subscription is not active, for example after a failed payment | Update billing in the console |
gone | The Database was deleted more than 7 days ago and has been purged | Nothing can bring it back |
rate_limited | More than 600 requests in a minute with this token | Wait as the RateLimit-* headers say |
internal | Something failed on our side | Retry with the same Idempotency-Key; quote request_id if you contact us |
The type and title above are examples; branch on code. Every problem can also carry detail and a request_id.
Endpoints
Paths are relative to https://api.nordbase.<base>/v1.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /regions | none | Regions a Database or Replica can be placed in, with their weight |
| GET | /plans | none | Plans with their Pool, Allowances and features |
| GET | /account | account:read | The Account, its Subscription, Pool use and this month's Usage |
| GET | /databases | databases:read | List Databases |
| POST | /databases | databases:write | Create a Database: its Primary, and a Standby when high_availability is true |
| GET | /databases/{database_id} | databases:read | A Database with its Instances and Endpoints |
| PATCH | /databases/{database_id} | databases:write | Rename, resize, or turn high availability on or off |
| DELETE | /databases/{database_id} | databases:write | Delete a Database. It can be undeleted for 7 days, then it and its history are purged |
| POST | /databases/{database_id}/undelete | databases:write | Bring back a Database deleted less than 7 days ago |
| GET | /databases/{database_id}/schema | databases:read | Tables and columns (SQL) or Namespaces and collections (Document) |
| GET | /databases/{database_id}/replicas | databases:read | List Replicas and Standbys |
| POST | /databases/{database_id}/replicas | databases:write | Add a Replica in another Region. It uses your Pool |
| DELETE | /databases/{database_id}/replicas/{instance_id} | databases:write | Remove a Replica |
| POST | /databases/{database_id}/replicas/{instance_id}/promote | databases:write | Make this Replica the Primary. The Home region moves to its Region |
| GET | /databases/{database_id}/credentials | credentials:read | List Credentials, never their secrets |
| POST | /databases/{database_id}/credentials | credentials:write | Create a Credential. Its secret and Connection URL are returned once |
| GET | /databases/{database_id}/credentials/{credential_id} | credentials:read | One Credential |
| PATCH | /databases/{database_id}/credentials/{credential_id} | credentials:write | Change name, Permission set, expiry or allowed Regions. Takes effect within 5 seconds |
| DELETE | /databases/{database_id}/credentials/{credential_id} | credentials:write | Revoke now. Open connections using it are closed |
| POST | /databases/{database_id}/credentials/{credential_id}/rotate | credentials:write | Issue a new secret. The old one keeps working for overlap_minutes, then stops |
| GET | /databases/{database_id}/recovery-window | databases:read | Earliest and latest Restore point |
| POST | /databases/{database_id}/restores | databases:write | Restore to a Restore point, as a new Database or in place |
| GET | /databases/{database_id}/usage | databases:read | One Database's Usage for a month, ?month=2026-11, default the current one |
| POST | /databases/{database_id}/query | sql:read, plus sql:write to change data | Run one statement (SQL) or one command (Document) |
| GET | /operations/{operation_id} | databases:read | Follow a long-running change |
| GET | /access-tokens | tokens:manage | List Access tokens |
| POST | /access-tokens | tokens:manage | Create an Access token. The token is shown once |
| DELETE | /access-tokens/{token_id} | tokens:manage | Revoke an Access token |
| GET | /audit-log | audit:read | Every change in the Account, newest first. Filter with action and target, page with cursor |
Example: create a Database
curl -X POST "https://api.nordbase.<base>/v1/databases" \
-H "Authorization: Bearer $NORDBASE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 0b7f3c1e-5d2a-4e8b-9f61-2c4a7d9e8b10" \
-d '{
"name": "shop-production",
"engine": "sql",
"region": "fi-hel",
"size": "micro",
"high_availability": false,
"postgres_version": 18
}'name, engine and region are required. size defaults to nano, high_availability to false and postgres_version to 18 (16 and 17 are also available, for SQL Databases only).
The answer is 202 Accepted:
{
"database": {
"id": "db-k7q2x9m4p1",
"name": "shop-production",
"engine": "sql",
"home_region": "fi-hel",
"size": "micro",
"high_availability": false,
"postgres_version": 18,
"status": "provisioning",
"endpoints": { "fi-hel": "db-k7q2x9m4p1.fi-hel.nordbase.<base>" },
"instances": [
{ "id": "in_3v8q1m0x7k2p9d4f", "role": "primary", "region": "fi-hel", "size": "micro", "status": "provisioning", "lag_ms": null }
],
"storage_used": 0,
"read_only_lock": false,
"deleted_at": null,
"created_at": "2026-11-25T21:14:03Z"
},
"operation": {
"id": "op_9t2k7m4x1q8p3v6d",
"kind": "create_database",
"status": "pending",
"database_id": "db-k7q2x9m4p1",
"progress": 0,
"created_at": "2026-11-25T21:14:03Z",
"finished_at": null
}
}Example: create a Credential
curl -X POST "https://api.nordbase.<base>/v1/databases/db-k7q2x9m4p1/credentials" \
-H "Authorization: Bearer $NORDBASE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 4c7d1a9e-2b6f-4e83-9a05-6d1b8c3f7e24" \
-d '{
"name": "web-app",
"permissions": {
"preset": "read_write",
"grants": [
{ "effect": "deny", "object": { "schema": "public", "table": "payouts" }, "actions": ["read", "insert", "update", "delete"] }
]
},
"expires_at": null,
"allowed_regions": ["fi-hel"]
}'The answer is 201 Created, sent with Cache-Control: no-store. The secret, the Connection URL and the key file are in it once, and never again:
{
"id": "cr_4k2m8p0d9a",
"name": "web-app",
"permissions": {
"preset": "read_write",
"grants": [
{ "effect": "deny", "object": { "schema": "public", "table": "payouts" }, "actions": ["read", "insert", "update", "delete"] }
]
},
"expires_at": null,
"allowed_regions": ["fi-hel"],
"created_at": "2026-11-25T21:20:41Z",
"last_used_at": null,
"secret": "nbs_…",
"connection_url": "postgresql://cr_4k2m8p0d9a:nbs_…@db-k7q2x9m4p1.fi-hel.nordbase.<base>:5432/db-k7q2x9m4p1?sslmode=verify-full&sslrootcert=system",
"key_file": {
"type": "nordbase_credential",
"version": 1,
"database_id": "db-k7q2x9m4p1",
"engine": "sql",
"credential_id": "cr_4k2m8p0d9a",
"secret": "nbs_…",
"home_region": "fi-hel",
"endpoints": { "fi-hel": "db-k7q2x9m4p1.fi-hel.nordbase.<base>" },
"connection_url": "postgresql://…"
}
}See Credentials for presets, Grants and rotation.
The query endpoint
POST /v1/databases/{database_id}/query runs one statement for the console or an AI agent:
curl -X POST "https://api.nordbase.<base>/v1/databases/db-k7q2x9m4p1/query" \
-H "Authorization: Bearer $NORDBASE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "sql": "select id, name from customers where email = $1", "params": ["[email protected]"] }'- Values go in
paramsand are bound to$1-style placeholders. One statement per call. - It is read-only unless you send
"read_only": falseand the Access token hassql:write. - It runs with your Account's own access, through an internal role for each Database, not as one of your Credentials.
- It stops after 30 seconds and returns at most 10,000 rows;
truncatedsays when rows were left out. - It takes
consistency,nearestorstrong, like the libraries. - Document Databases take
namespaceandcommand, a MongoDB command document, instead ofsql. - Every call counts as a Read or a Write, like any other statement.
It is meant for the console and AI agents. Apps connect with a library and a Credential; see the Quickstart.