Databases
A database is a Postgres 17 database in a project, next to its cubes. Cubecen runs it with Neon, in Frankfurt (aws-eu-central-1). The Launch and Scale plans have databases; the Free plan has none.
Endpoints
/ v1/ organizations/ {org}/ projects/ {project}/ databasesPOSTCreate a database/ v1/ organizations/ {org}/ projects/ {project}/ databasesGETGet a database/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}PATCHRename a database/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}DELETEDelete a database/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}GETGet the connection of a database/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}/ connectionPOSTReset the password of a database/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}/ reset-passwordA database's slug is how cubes refer to it, so no cube or other database of the project can have the same one. Creating a database answers 202 with its status at provisioning, and it is ready within a minute. Read it until then.
A cube connects through one of its variables. Put ${{ db.DATABASE_URL }} in a variable, not a secret, where db is the database's slug. The cube gets the connection as a secret when it is next built or deployed, and pull request previews never get it. A reference in a variable that a browser reads, such as one that starts with VITE_ or NEXT_PUBLIC_, is refused, because it would publish the password. See Environment. DATABASE_URL goes through a connection pooler: use it in your app. DATABASE_URL_UNPOOLED connects directly: use it for migrations, LISTEN and anything that keeps session state.
curl -sS -X PATCH "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/applications/<cube>/env" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expected_version": "7f20b1d",
"set": [{"key": "DATABASE_URL", "type": "variable", "value": "${{ db.DATABASE_URL }}"}]}'To connect from outside Cubecen, such as with psql or a migration tool, read the connection. It holds the password, so it needs a Full key. No other answer holds the password. Resetting the password stops the old one at once. Every cube that refers to the database can't connect until it is deployed again, and its environment then lists the database's slug in databases_behind.
The plan limits how many databases an organization can have, and what each can use: how far its compute can scale, its storage, and its compute hours and data transfer each month. A database that uses up its compute hours, its data transfer or its storage is suspended: it keeps its data but takes no connections. Compute hours and data transfer start again on the 1st of the month at 00:00 UTC; a database that is full stays suspended until its storage limit is raised. usage is measured about every hour, so a database can go a little past a limit first.
While a cube refers to a database, the database can't be deleted and its slug can't change: referenced_by lists those cubes. Deleting a database deletes its data, and you can't undo it. Support can recover it within 7 days.
List the databases of a project
/ v1/ organizations/ {org}/ projects/ {project}/ databasesReturns the Postgres databases of a project, oldest first. It needs only read access.
A database is a project resource next to its cubes. The answer never holds a password: read it with getDatabaseConnection.
The list is paged. limit sets the page size, from 1 to 100, and is 20 by default. When there are more, the answer has next_cursor: send it as cursor to get the next page. The last page has no next_cursor.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
Query parameters
| Name | Type | Description |
|---|---|---|
limit | integer | How many databases to return, from 1 to 100. The default is 20. |
cursor | string | The |
Responses
| Status | Description |
|---|---|
| 200 | A page of databases. DatabasePage object2 fieldsitemsarray of objectrequiredThe databases on this page, oldest first. items items14 fieldsidstringrequiredThe database's ID. slugstringrequiredThe database's slug: how cubes refer to it, as in namestringrequiredThe database's name. statusstringrequired
One of: suspended_reasonstring | nullrequiredWhy the database is suspended, while it is. grace_ends_atstring | nullrequiredSet when the organization's plan no longer has databases: the database is suspended at this time unless the plan has databases again. It stays set during the suspension. delete_afterstring | nullrequiredWhen a database suspended for the plan is deleted, 90 days after the suspension began. regionstringrequiredWhere the database runs: postgres_versionintegerrequiredThe major version of Postgres. hoststring | nullrequiredThe host that referenced_byarray of objectrequiredThe cubes whose variables refer to the database. While any does, it cannot be deleted and its slug cannot change. referenced_by items3 fieldsidstringrequiredThe cube's ID. slugstringrequiredThe cube's slug. namestringrequiredThe cube's name. limitsobjectrequiredWhat the database can use. limits object4 fieldsmax_cunumberrequiredThe most compute it can scale up to, in compute units: 1 unit is 1 vCPU and 4 GiB of memory. storage_gbintegerrequiredThe storage it can hold, in GB of 10^9 bytes. compute_hoursintegerrequiredThe compute it can use in a calendar month (UTC), in compute-unit hours. transfer_gbintegerrequiredThe data it can transfer in a calendar month, in GB. usageobjectrequiredWhat the database used this month. usage object6 fieldscompute_hoursnumberrequiredThe compute used this month, in compute-unit hours. storage_gbnumberrequiredThe storage it holds now, in GB. transfer_gbnumberrequiredThe data transferred this month, in GB. period_startstringrequiredThe start of the month, UTC. period_endstringrequiredThe start of the next month, UTC. It is not part of this one. as_ofstring | nullrequiredWhen the usage was last measured. It is measured about every hour, so a database can go a little past a limit before it is suspended. created_atstringrequiredWhen the database was created. next_cursorstringSend it as |
| 401 | The API key is missing, unknown, expired or revoked. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases" \
-H "Authorization: Bearer $CUBECEN_API_KEY"{
"items": [
{
"id": "2c7e4b19-5a03-4d8f-9e61-b04f7a3d2c58",
"slug": "db",
"name": "Main DB",
"status": "ready",
"suspended_reason": null,
"grace_ends_at": null,
"delete_after": null,
"region": "aws-eu-central-1",
"postgres_version": 17,
"host": "db-a1b2c3-pooler.eu-central-1.example.com",
"referenced_by": [
{
"id": "f1a83d52-6e07-4b9c-8d34-7a0c9e215b68",
"slug": "api",
"name": "API"
}
],
"limits": {
"max_cu": 1,
"storage_gb": 10,
"compute_hours": 100,
"transfer_gb": 10
},
"usage": {
"compute_hours": 12.4,
"storage_gb": 0.3,
"transfer_gb": 1.1,
"period_start": "2026-10-01T00:00:00Z",
"period_end": "2026-11-01T00:00:00Z",
"as_of": "2026-10-25T09:00:00Z"
},
"created_at": "2026-10-20T10:02:11Z"
}
]
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Create a database
/ v1/ organizations/ {org}/ projects/ {project}/ databasesAdds a Postgres 17 database to the project. It needs a key with full access.
Send a name, 1 to 64 characters, and a slug: lowercase letters, digits and single hyphens. The slug is how cubes refer to the database, so it must differ from the slug of every cube and every other database of the project. A slug that is taken is refused with 409 CONFLICT.
The answer is 202 Accepted with the database in status provisioning. It becomes ready within a minute: read it with getDatabase until then.
The plan sets how many databases an organization can have and how much each can use. The Free plan has none. A database past the plan's count is refused with 402 PLAN_LIMIT_REACHED, with error.limit set to databases.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
Body
| Name | Type | Description |
|---|---|---|
namerequired | string | The database's name, 1 to 64 characters. |
slugrequired | string | The database's slug: lowercase letters, digits and single hyphens. No cube or other database of the project can have it. |
Responses
| Status | Description |
|---|---|
| 202 | The database is being created. Its status is Database object14 fieldsidstringrequiredThe database's ID. slugstringrequiredThe database's slug: how cubes refer to it, as in namestringrequiredThe database's name. statusstringrequired
One of: suspended_reasonstring | nullrequiredWhy the database is suspended, while it is. grace_ends_atstring | nullrequiredSet when the organization's plan no longer has databases: the database is suspended at this time unless the plan has databases again. It stays set during the suspension. delete_afterstring | nullrequiredWhen a database suspended for the plan is deleted, 90 days after the suspension began. regionstringrequiredWhere the database runs: postgres_versionintegerrequiredThe major version of Postgres. hoststring | nullrequiredThe host that referenced_byarray of objectrequiredThe cubes whose variables refer to the database. While any does, it cannot be deleted and its slug cannot change. referenced_by items3 fieldsidstringrequiredThe cube's ID. slugstringrequiredThe cube's slug. namestringrequiredThe cube's name. limitsobjectrequiredWhat the database can use. limits object4 fieldsmax_cunumberrequiredThe most compute it can scale up to, in compute units: 1 unit is 1 vCPU and 4 GiB of memory. storage_gbintegerrequiredThe storage it can hold, in GB of 10^9 bytes. compute_hoursintegerrequiredThe compute it can use in a calendar month (UTC), in compute-unit hours. transfer_gbintegerrequiredThe data it can transfer in a calendar month, in GB. usageobjectrequiredWhat the database used this month. usage object6 fieldscompute_hoursnumberrequiredThe compute used this month, in compute-unit hours. storage_gbnumberrequiredThe storage it holds now, in GB. transfer_gbnumberrequiredThe data transferred this month, in GB. period_startstringrequiredThe start of the month, UTC. period_endstringrequiredThe start of the next month, UTC. It is not part of this one. as_ofstring | nullrequiredWhen the usage was last measured. It is measured about every hour, so a database can go a little past a limit before it is suspended. created_atstringrequiredWhen the database was created. |
| 400 | The request is not valid. |
| 401 | The API key is missing, unknown, expired or revoked. |
| 402 | The organization's plan does not allow this. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 409 | The request conflicts with the current state of the resource. |
| 413 | The request body is larger than 1 MiB. |
| 415 | The request body must be JSON. Send |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS -X POST "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"name": "Main DB", "slug": "db"}'{
"id": "2c7e4b19-5a03-4d8f-9e61-b04f7a3d2c58",
"slug": "db",
"name": "Main DB",
"status": "provisioning",
"suspended_reason": null,
"grace_ends_at": null,
"delete_after": null,
"region": "aws-eu-central-1",
"postgres_version": 17,
"host": null,
"referenced_by": [],
"limits": {
"max_cu": 1,
"storage_gb": 10,
"compute_hours": 100,
"transfer_gb": 10
},
"usage": {
"compute_hours": 0,
"storage_gb": 0,
"transfer_gb": 0,
"period_start": "2026-10-01T00:00:00Z",
"period_end": "2026-11-01T00:00:00Z",
"as_of": null
},
"created_at": "2026-10-25T11:05:42Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request body must be valid JSON with only supported fields",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "PLAN_LIMIT_REACHED",
"message": "The plan allows no more databases",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"limit": "databases",
"max": 3,
"used": 3,
"plan": "launch"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "CONFLICT",
"message": "Resource already exists",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"field": "slug"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request body is too large",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Content-Type must be application/json",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Get a database
/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}Returns one database: its status, the cubes that refer to it, its limits and what it used this month. It needs only read access.
status is provisioning while the database is being made, then ready. suspended means it keeps its data but takes no connections: suspended_reason says why. failed means it could not be made: delete it and create it again. deleting means its deletion has started.
referenced_by lists the cubes whose variables refer to the database. While any does, it cannot be deleted and its slug cannot change.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
database-idrequired | string | The ID or slug of the database. A slug is unique among the cubes and databases of the project. |
Responses
| Status | Description |
|---|---|
| 200 | The database. Database object14 fieldsidstringrequiredThe database's ID. slugstringrequiredThe database's slug: how cubes refer to it, as in namestringrequiredThe database's name. statusstringrequired
One of: suspended_reasonstring | nullrequiredWhy the database is suspended, while it is. grace_ends_atstring | nullrequiredSet when the organization's plan no longer has databases: the database is suspended at this time unless the plan has databases again. It stays set during the suspension. delete_afterstring | nullrequiredWhen a database suspended for the plan is deleted, 90 days after the suspension began. regionstringrequiredWhere the database runs: postgres_versionintegerrequiredThe major version of Postgres. hoststring | nullrequiredThe host that referenced_byarray of objectrequiredThe cubes whose variables refer to the database. While any does, it cannot be deleted and its slug cannot change. referenced_by items3 fieldsidstringrequiredThe cube's ID. slugstringrequiredThe cube's slug. namestringrequiredThe cube's name. limitsobjectrequiredWhat the database can use. limits object4 fieldsmax_cunumberrequiredThe most compute it can scale up to, in compute units: 1 unit is 1 vCPU and 4 GiB of memory. storage_gbintegerrequiredThe storage it can hold, in GB of 10^9 bytes. compute_hoursintegerrequiredThe compute it can use in a calendar month (UTC), in compute-unit hours. transfer_gbintegerrequiredThe data it can transfer in a calendar month, in GB. usageobjectrequiredWhat the database used this month. usage object6 fieldscompute_hoursnumberrequiredThe compute used this month, in compute-unit hours. storage_gbnumberrequiredThe storage it holds now, in GB. transfer_gbnumberrequiredThe data transferred this month, in GB. period_startstringrequiredThe start of the month, UTC. period_endstringrequiredThe start of the next month, UTC. It is not part of this one. as_ofstring | nullrequiredWhen the usage was last measured. It is measured about every hour, so a database can go a little past a limit before it is suspended. created_atstringrequiredWhen the database was created. |
| 401 | The API key is missing, unknown, expired or revoked. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases/<database-id>" \
-H "Authorization: Bearer $CUBECEN_API_KEY"{
"id": "2c7e4b19-5a03-4d8f-9e61-b04f7a3d2c58",
"slug": "db",
"name": "Main DB",
"status": "ready",
"suspended_reason": null,
"grace_ends_at": null,
"delete_after": null,
"region": "aws-eu-central-1",
"postgres_version": 17,
"host": "db-a1b2c3-pooler.eu-central-1.example.com",
"referenced_by": [
{
"id": "f1a83d52-6e07-4b9c-8d34-7a0c9e215b68",
"slug": "api",
"name": "API"
}
],
"limits": {
"max_cu": 1,
"storage_gb": 10,
"compute_hours": 100,
"transfer_gb": 10
},
"usage": {
"compute_hours": 12.4,
"storage_gb": 0.3,
"transfer_gb": 1.1,
"period_start": "2026-10-01T00:00:00Z",
"period_end": "2026-11-01T00:00:00Z",
"as_of": "2026-10-25T09:00:00Z"
},
"created_at": "2026-10-20T10:02:11Z"
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Rename a database
/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}Changes a database's name, its slug or both. It needs a key with full access.
Send only the fields to change, and at least one. The rules for each field are those of createDatabase. A slug that another cube or database of the project has is refused with 409 CONFLICT.
A slug change is refused with 409 DATABASE_REFERENCED while a cube's variables refer to the old slug: error.cubes names those cubes. Change their references first. The name can always change.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
database-idrequired | string | The ID or slug of the database. A slug is unique among the cubes and databases of the project. |
Body
| Name | Type | Description |
|---|---|---|
name | string | The new name, 1 to 64 characters. |
slug | string | The new slug: lowercase letters, digits and single hyphens. Refused while cubes refer to the old one. |
Responses
| Status | Description |
|---|---|
| 200 | The database, with the changes. Database object14 fieldsidstringrequiredThe database's ID. slugstringrequiredThe database's slug: how cubes refer to it, as in namestringrequiredThe database's name. statusstringrequired
One of: suspended_reasonstring | nullrequiredWhy the database is suspended, while it is. grace_ends_atstring | nullrequiredSet when the organization's plan no longer has databases: the database is suspended at this time unless the plan has databases again. It stays set during the suspension. delete_afterstring | nullrequiredWhen a database suspended for the plan is deleted, 90 days after the suspension began. regionstringrequiredWhere the database runs: postgres_versionintegerrequiredThe major version of Postgres. hoststring | nullrequiredThe host that referenced_byarray of objectrequiredThe cubes whose variables refer to the database. While any does, it cannot be deleted and its slug cannot change. referenced_by items3 fieldsidstringrequiredThe cube's ID. slugstringrequiredThe cube's slug. namestringrequiredThe cube's name. limitsobjectrequiredWhat the database can use. limits object4 fieldsmax_cunumberrequiredThe most compute it can scale up to, in compute units: 1 unit is 1 vCPU and 4 GiB of memory. storage_gbintegerrequiredThe storage it can hold, in GB of 10^9 bytes. compute_hoursintegerrequiredThe compute it can use in a calendar month (UTC), in compute-unit hours. transfer_gbintegerrequiredThe data it can transfer in a calendar month, in GB. usageobjectrequiredWhat the database used this month. usage object6 fieldscompute_hoursnumberrequiredThe compute used this month, in compute-unit hours. storage_gbnumberrequiredThe storage it holds now, in GB. transfer_gbnumberrequiredThe data transferred this month, in GB. period_startstringrequiredThe start of the month, UTC. period_endstringrequiredThe start of the next month, UTC. It is not part of this one. as_ofstring | nullrequiredWhen the usage was last measured. It is measured about every hour, so a database can go a little past a limit before it is suspended. created_atstringrequiredWhen the database was created. |
| 400 | The request is not valid. |
| 401 | The API key is missing, unknown, expired or revoked. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 409 | The request conflicts with the current state of the resource. |
| 413 | The request body is larger than 1 MiB. |
| 415 | The request body must be JSON. Send |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS -X PATCH "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases/<database-id>" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"name": "Primary DB"}'{
"id": "2c7e4b19-5a03-4d8f-9e61-b04f7a3d2c58",
"slug": "db",
"name": "Primary DB",
"status": "ready",
"suspended_reason": null,
"grace_ends_at": null,
"delete_after": null,
"region": "aws-eu-central-1",
"postgres_version": 17,
"host": "db-a1b2c3-pooler.eu-central-1.example.com",
"referenced_by": [],
"limits": {
"max_cu": 1,
"storage_gb": 10,
"compute_hours": 100,
"transfer_gb": 10
},
"usage": {
"compute_hours": 12.4,
"storage_gb": 0.3,
"transfer_gb": 1.1,
"period_start": "2026-10-01T00:00:00Z",
"period_end": "2026-11-01T00:00:00Z",
"as_of": "2026-10-25T09:00:00Z"
},
"created_at": "2026-10-20T10:02:11Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request body must be valid JSON with only supported fields",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "CONFLICT",
"message": "Resource already exists",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"field": "slug"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request body is too large",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Content-Type must be application/json",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Delete a database
/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}Deletes a database and its data. It needs a key with full access. You cannot undo it. Support can recover a deleted database within 7 days.
The answer is 202 Accepted with the database in status deleting. The deletion ends within seconds, and the database is then gone from the list and from getDatabase.
A database is refused with 409 DATABASE_REFERENCED while a cube's variables refer to it: error.cubes names those cubes. Remove the references first.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
database-idrequired | string | The ID or slug of the database. A slug is unique among the cubes and databases of the project. |
Responses
| Status | Description |
|---|---|
| 202 | The deletion has started. The status is Database object14 fieldsidstringrequiredThe database's ID. slugstringrequiredThe database's slug: how cubes refer to it, as in namestringrequiredThe database's name. statusstringrequired
One of: suspended_reasonstring | nullrequiredWhy the database is suspended, while it is. grace_ends_atstring | nullrequiredSet when the organization's plan no longer has databases: the database is suspended at this time unless the plan has databases again. It stays set during the suspension. delete_afterstring | nullrequiredWhen a database suspended for the plan is deleted, 90 days after the suspension began. regionstringrequiredWhere the database runs: postgres_versionintegerrequiredThe major version of Postgres. hoststring | nullrequiredThe host that referenced_byarray of objectrequiredThe cubes whose variables refer to the database. While any does, it cannot be deleted and its slug cannot change. referenced_by items3 fieldsidstringrequiredThe cube's ID. slugstringrequiredThe cube's slug. namestringrequiredThe cube's name. limitsobjectrequiredWhat the database can use. limits object4 fieldsmax_cunumberrequiredThe most compute it can scale up to, in compute units: 1 unit is 1 vCPU and 4 GiB of memory. storage_gbintegerrequiredThe storage it can hold, in GB of 10^9 bytes. compute_hoursintegerrequiredThe compute it can use in a calendar month (UTC), in compute-unit hours. transfer_gbintegerrequiredThe data it can transfer in a calendar month, in GB. usageobjectrequiredWhat the database used this month. usage object6 fieldscompute_hoursnumberrequiredThe compute used this month, in compute-unit hours. storage_gbnumberrequiredThe storage it holds now, in GB. transfer_gbnumberrequiredThe data transferred this month, in GB. period_startstringrequiredThe start of the month, UTC. period_endstringrequiredThe start of the next month, UTC. It is not part of this one. as_ofstring | nullrequiredWhen the usage was last measured. It is measured about every hour, so a database can go a little past a limit before it is suspended. created_atstringrequiredWhen the database was created. |
| 401 | The API key is missing, unknown, expired or revoked. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 409 | The request conflicts with the current state of the resource. |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS -X DELETE "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases/<database-id>" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"id": "2c7e4b19-5a03-4d8f-9e61-b04f7a3d2c58",
"slug": "db",
"name": "Main DB",
"status": "deleting",
"suspended_reason": null,
"grace_ends_at": null,
"delete_after": null,
"region": "aws-eu-central-1",
"postgres_version": 17,
"host": "db-a1b2c3-pooler.eu-central-1.example.com",
"referenced_by": [],
"limits": {
"max_cu": 1,
"storage_gb": 10,
"compute_hours": 100,
"transfer_gb": 10
},
"usage": {
"compute_hours": 12.4,
"storage_gb": 0.3,
"transfer_gb": 1.1,
"period_start": "2026-10-01T00:00:00Z",
"period_end": "2026-11-01T00:00:00Z",
"as_of": "2026-10-25T09:00:00Z"
},
"created_at": "2026-10-20T10:02:11Z"
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_REFERENCED",
"message": "The env of api refers to this database; remove those references before deleting it",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"cubes": [
"api"
]
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Get the connection of a database
/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}/ connectionReturns how to connect to a database from outside Cubecen, for example with psql or a migration tool: the hosts, the user, the password and two connection URLs. It needs a key with full access, because it holds the password.
database_url goes through a connection pooler: use it in applications. database_url_unpooled connects directly: use it for migrations, LISTEN and anything that keeps session state. Both require TLS (sslmode=require). The answer is never cached.
A cube does not need this: put ${{ db.DATABASE_URL }} or ${{ db.DATABASE_URL_UNPOOLED }} in one of its variables, where db is the database's slug (see updateEnvironment).
A database that is not ready yet is refused with 409 DATABASE_NOT_READY.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
database-idrequired | string | The ID or slug of the database. A slug is unique among the cubes and databases of the project. |
Responses
| Status | Description |
|---|---|
| 200 | The connection of the database. It holds the password. DatabaseConnection object8 fieldshoststringrequiredThe host for direct connections. pooled_hoststringrequiredThe host of the connection pooler. portintegerrequiredThe port, 5432. databasestringrequiredThe name of the database to connect to. userstringrequiredThe user to connect as. passwordstringrequiredThe password. database_urlstringrequiredA URL through the connection pooler, with database_url_unpooledstringrequiredA URL for a direct connection, with |
| 401 | The API key is missing, unknown, expired or revoked. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 409 | The request conflicts with the current state of the resource. |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases/<database-id>/connection" \
-H "Authorization: Bearer $CUBECEN_API_KEY"{
"host": "db-a1b2c3.eu-central-1.example.com",
"pooled_host": "db-a1b2c3-pooler.eu-central-1.example.com",
"port": 5432,
"database": "app",
"user": "app",
"password": "example-password",
"database_url": "postgresql://app:example-password@db-a1b2c3-pooler.eu-central-1.example.com/app?sslmode=require",
"database_url_unpooled": "postgresql://app:example-password@db-a1b2c3.eu-central-1.example.com/app?sslmode=require"
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_NOT_READY",
"message": "The database is not ready yet; try again once its status is ready",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Reset the password of a database
/ v1/ organizations/ {org}/ projects/ {project}/ databases/ {database-id}/ reset-passwordGives the database a new password and returns the new connection, as getDatabaseConnection does. It needs a key with full access.
The old password stops working at once. Every cube that refers to the database cannot connect until it is deployed again: its getEnvironment then has live_env_behind set to true and the database's slug in databases_behind. Redeploy those cubes with createDeployment.
A database that is not ready yet is refused with 409 DATABASE_NOT_READY. A reset that is already running is refused with 409 BUSY: retry after the seconds in Retry-After.
Path parameters
| Name | Type | Description |
|---|---|---|
orgrequired | string | The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with |
projectrequired | string | The ID or slug of the project. A slug is unique within the organization. |
database-idrequired | string | The ID or slug of the database. A slug is unique among the cubes and databases of the project. |
Responses
| Status | Description |
|---|---|
| 200 | The new connection of the database. It holds the new password. DatabaseConnection object8 fieldshoststringrequiredThe host for direct connections. pooled_hoststringrequiredThe host of the connection pooler. portintegerrequiredThe port, 5432. databasestringrequiredThe name of the database to connect to. userstringrequiredThe user to connect as. passwordstringrequiredThe password. database_urlstringrequiredA URL through the connection pooler, with database_url_unpooledstringrequiredA URL for a direct connection, with |
| 401 | The API key is missing, unknown, expired or revoked. |
| 403 | The key may not do this. Its access level or its owner's role does not allow it, or the organization is not the key's. |
| 404 | Nothing was found at this address. An organization ID that matches no organization is |
| 409 | The request conflicts with the current state of the resource. |
| 429 | The key made too many requests. Wait for the number of seconds in |
| 500 | Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the |
| 503 | The service is temporarily unavailable. Retry the same request with backoff: wait a little longer after each failed attempt. The error code can differ from the one shown. |
Example
curl -sS -X POST "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/databases/<database-id>/reset-password" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"host": "db-a1b2c3.eu-central-1.example.com",
"pooled_host": "db-a1b2c3-pooler.eu-central-1.example.com",
"port": 5432,
"database": "app",
"user": "app",
"password": "example-new-password",
"database_url": "postgresql://app:example-new-password@db-a1b2c3-pooler.eu-central-1.example.com/app?sslmode=require",
"database_url_unpooled": "postgresql://app:example-new-password@db-a1b2c3.eu-central-1.example.com/app?sslmode=require"
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication required",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_NOT_READY",
"message": "The database is not ready yet; try again once its status is ready",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests with this API key; try again shortly",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"error": {
"code": "DATABASE_UNAVAILABLE",
"message": "Database unavailable",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}