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.
Export the whole database to a download link
POST /v1/services/{serviceId}/database/exports
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
format | SQL, ARCHIVE | no |
Returns
200withV1Export.
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
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
Query parameters
| Name | Type | Required | Notes |
|---|---|---|---|
limit | integer | no | Rows per page. Ignored when a cursor is given. |
cursor | string | no | The nextCursor of the previous page, unchanged. |
search | string | no | Only rows whose name contains this. Send the same value with every page of one walk. |
Returns
200with a page:{ data: V1DatabaseObject[], nextCursor }, where each item isV1DatabaseObject.
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
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
statement | string | yes | SQL (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. |
maxRows | number | no |
Returns
200withV1QueryResult.
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
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
Query parameters
| Name | Type | Required | Notes |
|---|---|---|---|
limit | integer | no | Rows per page. Ignored when a cursor is given. |
cursor | string | no | The nextCursor of the previous page, unchanged. |
search | string | no | Only rows whose name contains this. Send the same value with every page of one walk. |
Returns
200with a page:{ data: V1TableStat[], nextCursor }, where each item isV1TableStat.
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
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
table | string | yes |
Query parameters
| Name | Type | Required | Notes |
|---|---|---|---|
schema | string | no |
Returns
200withV1TableSchema.
curl "https://api.naijacloud.com/v1/services/$SERVICE_ID/database/tables/$TABLE/columns" \
-H "Authorization: Bearer $NC_API_KEY"Export one table as CSV, JSON or SQL to a download link
POST /v1/services/{serviceId}/database/tables/{table}/exports
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
table | string | yes |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
format | CSV, JSON, SQL | no | |
schema | string | no | Postgres schema, if not public. |
Returns
200withV1Export.
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
| Field | Type | Notes |
|---|---|---|
name | string | |
type | string | |
nullable | boolean | |
default | string, or null | |
isPrimaryKey | boolean | |
references | V1ForeignKey, or null |
V1DatabaseObject
| Field | Type | Notes |
|---|---|---|
name | string | |
schema | string, or null | |
kind | string | table, view or collection |
V1Export
| Field | Type | Notes |
|---|---|---|
url | string | A short-lived presigned download URL. |
filename | string | |
format | string | |
sizeBytes | number, or null | |
expiresAt | string (date-time) |
V1ForeignKey
| Field | Type | Notes |
|---|---|---|
schema | string, or null | |
table | string | |
column | string |
V1QueryResult
| Field | Type | Notes |
|---|---|---|
engine | WEB, STATIC, CRON, POSTGRES, MYSQL, MARIADB, MONGODB, REDIS, VALKEY | |
columns | array of string | |
rows | array of array of string, or null | One array per row, cells in column order; null is SQL NULL. |
rowCount | number | |
truncated | boolean | More rows matched than were returned. |
message | string, or null | |
notices | array of string | |
executionMs | number |
V1TableSchema
| Field | Type | Notes |
|---|---|---|
name | string | |
schema | string, or null | |
columns | array of V1Column | |
primaryKey | array of string |
V1TableStat
| Field | Type | Notes |
|---|---|---|
name | string | |
schema | string, or null | |
estimatedRows | number, or null | The planner's estimate, never a live count. |