Naijacloud
Docs

Database console

Every /v1 route for database console. This page is generated from the API's OpenAPI contract, so it always matches what the API accepts and returns.

Authentication, pagination, errors and idempotency work the same on every route. They are described once, in the API overview.

POST /v1/services/{serviceId}/database/exports

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Body

FieldTypeRequiredNotes
formatSQL, ARCHIVEno

Returns

bash
curl -X POST "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/exports" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Content-Type: application/json" \ -d '{"format":"SQL"}'

Tables and views (SQL) or collections (MongoDB)

GET /v1/services/{serviceId}/database/objects

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Query parameters

NameTypeRequiredNotes
limitintegernoRows per page. Ignored when a cursor is given.
cursorstringnoThe nextCursor of the previous page, unchanged.
searchstringnoOnly rows whose name contains this. Send the same value with every page of one walk.

Returns

  • 200 with a page: { data: V1DatabaseObject[], nextCursor }, where each item is V1DatabaseObject.
bash
curl "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/objects" \ -H "Authorization: Bearer $NC_API_KEY"

Run a statement and get the result grid

POST /v1/services/{serviceId}/database/query

Runs as the service's own database user: it can write and drop as well as read.

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Body

FieldTypeRequiredNotes
statementstringyesSQL (Postgres/MySQL/MariaDB) or a mongosh expression (MongoDB). Runs as the service's own database user, so it can write and drop as well as read.
maxRowsnumberno

Returns

bash
curl -X POST "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/query" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Content-Type: application/json" \ -d '{"statement":"…"}'

Tables with estimated row counts

GET /v1/services/{serviceId}/database/tables

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Query parameters

NameTypeRequiredNotes
limitintegernoRows per page. Ignored when a cursor is given.
cursorstringnoThe nextCursor of the previous page, unchanged.
searchstringnoOnly rows whose name contains this. Send the same value with every page of one walk.

Returns

  • 200 with a page: { data: V1TableStat[], nextCursor }, where each item is V1TableStat.
bash
curl "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/tables" \ -H "Authorization: Bearer $NC_API_KEY"

A table's columns and primary key

GET /v1/services/{serviceId}/database/tables/{table}/columns

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.
tablestringyes

Query parameters

NameTypeRequiredNotes
schemastringno

Returns

bash
curl "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/tables/$TABLE/columns" \ -H "Authorization: Bearer $NC_API_KEY"

POST /v1/services/{serviceId}/database/tables/{table}/exports

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.
tablestringyes

Body

FieldTypeRequiredNotes
formatCSV, JSON, SQLno
schemastringnoPostgres schema, if not public.

Returns

bash
curl -X POST "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/tables/$TABLE/exports" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Content-Type: application/json" \ -d '{"format":"CSV","schema":"…"}'

Types

V1Column

FieldTypeNotes
namestring
typestring
nullableboolean
defaultstring, or null
isPrimaryKeyboolean
referencesV1ForeignKey, or null

V1DatabaseObject

FieldTypeNotes
namestring
schemastring, or null
kindstringtable, view or collection

V1Export

FieldTypeNotes
urlstringA short-lived presigned download URL.
filenamestring
formatstring
sizeBytesnumber, or null
expiresAtstring (date-time)

V1ForeignKey

FieldTypeNotes
schemastring, or null
tablestring
columnstring

V1QueryResult

FieldTypeNotes
engineWEB, STATIC, CRON, POSTGRES, MYSQL, MARIADB, MONGODB, REDIS, VALKEY
columnsarray of string
rowsarray of array of string, or nullOne array per row, cells in column order; null is SQL NULL.
rowCountnumber
truncatedbooleanMore rows matched than were returned.
messagestring, or null
noticesarray of string
executionMsnumber

V1TableSchema

FieldTypeNotes
namestring
schemastring, or null
columnsarray of V1Column
primaryKeyarray of string

V1TableStat

FieldTypeNotes
namestring
schemastring, or null
estimatedRowsnumber, or nullThe planner's estimate, never a live count.