Skip to content
NordBaseDocs

Search the docs

Find a page or a section of the NordBase docs

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:

bash
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.

ScopeAllows
account:readRead the Account, its Subscription, Pool use and this month's Usage
databases:readRead Databases, Replicas, schemas, Recovery windows, Usage and Operations
databases:writeCreate, change, delete and undelete Databases; add, remove and promote Replicas; start Restores
credentials:readList and read Credentials, never their secrets
credentials:writeCreate, change, rotate and revoke Credentials
sql:readRun read-only statements through the query endpoint
sql:writeWith sql:read, run statements that change data through the query endpoint
tokens:manageList, create and revoke Access tokens
audit:readRead the audit log. Only owners and admins hold it

Conventions

TopicRule
IdempotencyA 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 changesAnswer 202 Accepted with an Operation. Follow it with GET /v1/operations/{operation_id}
PaginationLists take ?limit= (1 to 100, default 20) and ?cursor=, and answer { "data": [...], "next_cursor": "..." }. next_cursor is null on the last page
TimesRFC 3339, UTC, whole seconds, such as 2026-11-25T21:14:03Z
SizesBytes, unless the field name says otherwise, such as egress_gb
Rate limit600 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:

json
{
  "id": "op_9t2k7m4x1q8p3v6d",
  "kind": "create_database",
  "status": "running",
  "database_id": "db-k7q2x9m4p1",
  "progress": 60,
  "created_at": "2026-11-25T21:14:03Z",
  "finished_at": null
}
FieldValues
kindcreate_database, update_database, delete_database, undelete_database, create_replica, delete_replica, promote_replica, restore
statuspending, running, succeeded, failed
progress0 to 100
errorWhen 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:

json
{
  "type": "about:blank",
  "title": "The change does not fit the Account's Pool",
  "status": 402,
  "code": "pool_exceeded",
  "needs": { "plan": "team" }
}
codeMeaningWhat to do
validation_failedThe request body or a parameter is invalid. fields maps each field path to a messageFix the fields named
unauthenticatedNo Access token, or an invalid, revoked or expired oneCheck the Authorization header
forbiddenThe Access token lacks the scope this endpoint needsUse a token with that scope
not_foundThe Database, Credential, Replica or Operation does not exist in your AccountCheck the id
conflictThe change conflicts with the current stateRead the resource again, then retry
pool_exceededThe change does not fit your Pool. needs.plan names the smallest Plan that fitsMake room or move to that Plan
feature_not_in_planYour Plan does not include this, such as Replicas on Start. needs.plan names the smallest Plan that doesMove to that Plan
region_unavailableThe Region cannot take new Instances nowChoose another Region from GET /v1/regions
outside_recovery_windowThe Restore point is not inside the Recovery windowRead GET /v1/databases/{database_id}/recovery-window
subscription_inactiveThe Subscription is not active, for example after a failed paymentUpdate billing in the console
goneThe Database was deleted more than 7 days ago and has been purgedNothing can bring it back
rate_limitedMore than 600 requests in a minute with this tokenWait as the RateLimit-* headers say
internalSomething failed on our sideRetry 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.

MethodPathScopeWhat it does
GET/regionsnoneRegions a Database or Replica can be placed in, with their weight
GET/plansnonePlans with their Pool, Allowances and features
GET/accountaccount:readThe Account, its Subscription, Pool use and this month's Usage
GET/databasesdatabases:readList Databases
POST/databasesdatabases:writeCreate a Database: its Primary, and a Standby when high_availability is true
GET/databases/{database_id}databases:readA Database with its Instances and Endpoints
PATCH/databases/{database_id}databases:writeRename, resize, or turn high availability on or off
DELETE/databases/{database_id}databases:writeDelete a Database. It can be undeleted for 7 days, then it and its history are purged
POST/databases/{database_id}/undeletedatabases:writeBring back a Database deleted less than 7 days ago
GET/databases/{database_id}/schemadatabases:readTables and columns (SQL) or Namespaces and collections (Document)
GET/databases/{database_id}/replicasdatabases:readList Replicas and Standbys
POST/databases/{database_id}/replicasdatabases:writeAdd a Replica in another Region. It uses your Pool
DELETE/databases/{database_id}/replicas/{instance_id}databases:writeRemove a Replica
POST/databases/{database_id}/replicas/{instance_id}/promotedatabases:writeMake this Replica the Primary. The Home region moves to its Region
GET/databases/{database_id}/credentialscredentials:readList Credentials, never their secrets
POST/databases/{database_id}/credentialscredentials:writeCreate a Credential. Its secret and Connection URL are returned once
GET/databases/{database_id}/credentials/{credential_id}credentials:readOne Credential
PATCH/databases/{database_id}/credentials/{credential_id}credentials:writeChange name, Permission set, expiry or allowed Regions. Takes effect within 5 seconds
DELETE/databases/{database_id}/credentials/{credential_id}credentials:writeRevoke now. Open connections using it are closed
POST/databases/{database_id}/credentials/{credential_id}/rotatecredentials:writeIssue a new secret. The old one keeps working for overlap_minutes, then stops
GET/databases/{database_id}/recovery-windowdatabases:readEarliest and latest Restore point
POST/databases/{database_id}/restoresdatabases:writeRestore to a Restore point, as a new Database or in place
GET/databases/{database_id}/usagedatabases:readOne Database's Usage for a month, ?month=2026-11, default the current one
POST/databases/{database_id}/querysql:read, plus sql:write to change dataRun one statement (SQL) or one command (Document)
GET/operations/{operation_id}databases:readFollow a long-running change
GET/access-tokenstokens:manageList Access tokens
POST/access-tokenstokens:manageCreate an Access token. The token is shown once
DELETE/access-tokens/{token_id}tokens:manageRevoke an Access token
GET/audit-logaudit:readEvery change in the Account, newest first. Filter with action and target, page with cursor

Example: create a Database

bash
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:

json
{
  "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

bash
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:

json
{
  "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:

bash
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 params and are bound to $1-style placeholders. One statement per call.
  • It is read-only unless you send "read_only": false and the Access token has sql: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; truncated says when rows were left out.
  • It takes consistency, nearest or strong, like the libraries.
  • Document Databases take namespace and command, a MongoDB command document, instead of sql.
  • 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.