Environment
A cube's environment is its variables and secrets. A variable shows its value. A secret can be written but never read: its value is always null in an answer. Anyone who can read the cube can read its variables, so keep secrets out of variables.
Endpoints
/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ envPATCHChange the variables and secrets of a cube/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ envGETList the versions of the variables of a cube/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ env/ versionsGETCompare two versions of the variables of a cube/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ env/ diffPOSTBring back an earlier version of the variables/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ env/ restoreEvery change that alters something makes a new version, with an env_version such as 7f20b1d. Versions are IDs, not counters: compare them only for equality. Changing the environment takes two steps. Read it, to get the current env_version. Then send the change with that value as expected_version. If someone changed the variables in between, the change is refused with 409 ENV_CHANGED: read again, check your change and send it again.
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": "API_URL", "type": "variable", "value": "https://api.example.com"}],
"delete": ["OLD_URL"]}'The change is atomic: all of it is applied, or none of it. It reaches the running cube with the next build or deployment. live_env_behind in the answer is true when the live deployment runs with other values. Mark a key with build: true when the build reads it, such as VITE_API_URL: when live_build_env_behind is true, apply the change with a new build. Otherwise a deployment is enough.
A variable can refer to another cube of the same project, such as ${{ api.PUBLIC_URL }}, where api is that cube's slug, or to a database of the project, such as ${{ db.DATABASE_URL }}. A cube can have 200 entries, a value can be 64 KiB, and PORT and the names that start with CUBECEN_ are set by Cubecen.
The versions are a history. List them to see who changed what and when, without values. Compare two versions to see what going from one to the other adds, changes and removes. Restore a version to make an older one current again: its values become a new version. Only the newest 100 versions keep their values, so an older one can't be restored. Changing and restoring accept an Idempotency-Key: a retry with the same one gets the first answer.
Get the variables and secrets of a cube
/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ envReturns the variables and secrets of a cube, sorted by key, at the current version of its environment. It needs only read access.
A variable shows its value. A secret never does: its value is always null, because a secret can be written but not read. Anyone who can read the cube can read its variables, so keep secrets out of variables.
env_version names the current version: 7 lowercase hexadecimal characters, such as 7f20b1d. Every change that alters something makes a new version with a new ID. IDs do not count up: compare them only for equality. env_version is null before the first change. The environment can be read and changed while the cube is being created, is active or has failed, so that a failed first deploy can be fixed. For a cube in any other state, the request is 404.
A change reaches the running cube with the next build or deployment. live_env_version is the version the live deployment runs with, and live_build_env_version the one its build was made with. Both are null when nothing is live. live_env_behind is true when the live deployment runs with other values than the current ones. An entry with build set to true is read by the build: live_build_env_behind is true when one of them differs from what the live build was made with, and build_keys_behind names them. Then apply the change with a new build (createBuild). Otherwise, when only live_env_behind is true, a redeploy is enough (createDeployment).
platform lists the variables that Cubecen sets in every cube. They are read-only, their names are reserved, and they are not part of entries. limits says how much an environment can hold.
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. |
cuberequired | string | The ID or slug of the cube. A slug is unique within the project. |
Responses
| Status | Description |
|---|---|
| 200 | The variables and secrets at the current version. Env object10 fieldsenv_versionstring | nullrequiredThe current version, as 7 lowercase hexadecimal characters that are unique within the cube. live_env_versionstring | nullrequiredThe version that the live deployment runs with. live_build_env_versionstring | nullrequiredThe version that the live deployment's build was made with. live_env_behindbooleanrequired
live_build_env_behindbooleanrequired
build_keys_behindarray of stringrequiredThe keys whose change needs a new build, sorted: keys marked databases_behindarray of stringrequiredThe slugs of the databases that this cube refers to whose password was reset after the live deployment started. The cube cannot connect to them until it is deployed again. Empty when there is none. entriesarray of objectrequiredThe variables and secrets, sorted by key. entries items7 fieldskeystringrequiredThe name of the variable or secret. typestringrequired
One of: valuestring | nullrequiredThe value of a variable. Always previewsbooleanrequiredWhether pull request previews get this entry. buildbooleanrequiredWhether the build reads this key. A change to a key that is marked needs a new build, and a change to the others needs only a redeploy. A new key starts without the mark. updated_byobjectrequiredThe user who last changed the entry. updated_by object2 fieldsidstringrequiredThe user's ID. namestringrequiredThe user's first and last name, or their email address when they have no name. updated_atstringrequiredWhen the entry was last changed. platformarray of objectrequiredThe variables that Cubecen sets in every cube, sorted by key. They are read-only and not part of platform items3 fieldskeystringrequiredThe name of the variable: One of: valuestring | nullrequiredThe value. next_deploybooleanrequired
limitsobjectrequiredWhat an environment can hold. limits object4 fieldsmax_entriesintegerrequiredThe most entries, variables and secrets together. max_key_lengthintegerrequiredThe longest key, in characters. max_value_bytesintegerrequiredThe largest value, in bytes. max_total_bytesintegerrequiredThe largest size of all keys and values together, in bytes. |
| 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>/applications/<cube>/env" \
-H "Authorization: Bearer $CUBECEN_API_KEY"{
"env_version": "7f20b1d",
"live_env_version": "e3a91c2",
"live_build_env_version": "e3a91c2",
"live_env_behind": true,
"live_build_env_behind": true,
"build_keys_behind": [
"VITE_API_URL"
],
"databases_behind": [],
"entries": [
{
"key": "DATABASE_URL",
"type": "secret",
"value": null,
"previews": false,
"build": false,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-20T10:02:11Z"
},
{
"key": "LOG_LEVEL",
"type": "variable",
"value": "info",
"previews": true,
"build": false,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-20T10:02:11Z"
},
{
"key": "VITE_API_URL",
"type": "variable",
"value": "https://api.example.com",
"previews": true,
"build": true,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-24T14:30:05Z"
}
],
"platform": [
{
"key": "CUBECEN_CUBE_NAME",
"value": "Web",
"next_deploy": true
},
{
"key": "CUBECEN_DEPLOYMENT_ID",
"value": "dpl_00000002a0fdd794980f85f9c353bf",
"next_deploy": false
},
{
"key": "CUBECEN_PROJECT",
"value": "Storefront",
"next_deploy": true
},
{
"key": "CUBECEN_REGION",
"value": null,
"next_deploy": false
},
{
"key": "CUBECEN_WORKSPACE",
"value": "Acme",
"next_deploy": true
}
],
"limits": {
"max_entries": 200,
"max_key_length": 128,
"max_value_bytes": 65536,
"max_total_bytes": 262144
}
}{
"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"
}
}Change the variables and secrets of a cube
/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ envAdds, changes and removes variables and secrets in one atomic change: all of it is applied, or none of it. It needs a key with full access.
Send expected_version: the env_version that your change is based on, as getEnvironment gave it, or null for the first change. It is required. If the environment has changed since, the request is refused with 409 ENV_CHANGED: read the environment again, check what you change and send it again.
set adds or replaces entries. Each has a key, a type (variable or secret) and a value. The value is required: it can be empty or span several lines, and it cannot contain a NUL character. To change only the marks of an entry that exists, leave value out and send its type with build or, for a secret, previews. delete lists the keys to remove. A key cannot be in both lists, and the change needs at least one entry in either.
build marks a key that the build reads, such as VITE_API_URL: a change to a marked key needs a new build, and a change to the others needs only a redeploy. Left out, a key keeps its mark, and a new key starts without one. previews is for secrets: whether pull request previews get the secret. Variables go to previews, so previews: false on a variable is refused, except on one that refers to a database, which previews never get. Left out, a secret keeps its mark, and a new secret starts without one.
A secret never turns into a variable without a new value. A variable becomes a secret when you send its value again with type set to secret.
A key is 1 to 128 letters, digits and _, and does not start with a digit. PORT and the names that start with a prefix of the platform, such as CUBECEN_ and KUBERNETES_, are set by Cubecen: they are refused with ENV_KEY_RESERVED. A cube can have 200 entries, a value can be 64 KiB, and keys and values together can be 256 KiB. More is refused with ENV_TOO_LARGE.
A variable can refer to another cube of the same project: ${{ api.PUBLIC_URL }} or ${{ api.PUBLIC_HOST }}, where api is the slug of that cube. ${{ api.PRIVATE_URL }} gives its address on the project's private network. A reference is resolved each time a build or deployment starts. A reference to no cube of the project, a reference with another field, a reference in a secret, and PRIVATE_URL in a variable that a browser reads, such as one that starts with VITE_ or NEXT_PUBLIC_, are refused with 400. A variable can also refer to a database of the project: ${{ db.DATABASE_URL }} for the pooled connection or ${{ db.DATABASE_URL_UNPOOLED }} for the direct one, where db is the database's slug. It is sent to the cube as a secret, pull request previews never get it, and it is refused with 400 in a variable that a browser reads. A build or deployment is refused with 409 DATABASE_NOT_READY while the database is not ready. Any other ${{ ... }} text in a variable is refused with 400 too, because it would be taken for a reference; a secret can hold it, since a secret is never resolved.
A change that alters nothing is answered with the current state and makes no new version. The answer is the environment at the new version, as getEnvironment shows it. The change reaches the running cube with the next build or deployment: live_env_behind and live_build_env_behind in the answer say which one.
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. |
cuberequired | string | The ID or slug of the cube. A slug is unique within the project. |
Body
| Name | Type | Description |
|---|---|---|
expected_versionrequired | string | null | The |
set | array of object | The entries to add or replace. set items5 fieldskeystringrequiredThe name: 1 to 128 letters, digits and typestringrequired
One of: valuestringThe value, up to 64 KiB. It is required: it can be empty or span several lines, and cannot contain a NUL character. Only to change the marks of an entry that exists, leave it out and keep its previewsbooleanFor a secret: whether pull request previews get it. Left out, a secret keeps its mark, and a new secret starts without one. buildbooleanWhether the build reads the key. Left out, a key keeps its mark, even when its type changes, and a new key starts without one. |
delete | array of string | The keys to remove. |
Responses
| Status | Description |
|---|---|
| 200 | The variables and secrets at the new version. A change that alters nothing answers the current version. Env object10 fieldsenv_versionstring | nullrequiredThe current version, as 7 lowercase hexadecimal characters that are unique within the cube. live_env_versionstring | nullrequiredThe version that the live deployment runs with. live_build_env_versionstring | nullrequiredThe version that the live deployment's build was made with. live_env_behindbooleanrequired
live_build_env_behindbooleanrequired
build_keys_behindarray of stringrequiredThe keys whose change needs a new build, sorted: keys marked databases_behindarray of stringrequiredThe slugs of the databases that this cube refers to whose password was reset after the live deployment started. The cube cannot connect to them until it is deployed again. Empty when there is none. entriesarray of objectrequiredThe variables and secrets, sorted by key. entries items7 fieldskeystringrequiredThe name of the variable or secret. typestringrequired
One of: valuestring | nullrequiredThe value of a variable. Always previewsbooleanrequiredWhether pull request previews get this entry. buildbooleanrequiredWhether the build reads this key. A change to a key that is marked needs a new build, and a change to the others needs only a redeploy. A new key starts without the mark. updated_byobjectrequiredThe user who last changed the entry. updated_by object2 fieldsidstringrequiredThe user's ID. namestringrequiredThe user's first and last name, or their email address when they have no name. updated_atstringrequiredWhen the entry was last changed. platformarray of objectrequiredThe variables that Cubecen sets in every cube, sorted by key. They are read-only and not part of platform items3 fieldskeystringrequiredThe name of the variable: One of: valuestring | nullrequiredThe value. next_deploybooleanrequired
limitsobjectrequiredWhat an environment can hold. limits object4 fieldsmax_entriesintegerrequiredThe most entries, variables and secrets together. max_key_lengthintegerrequiredThe longest key, in characters. max_value_bytesintegerrequiredThe largest value, in bytes. max_total_bytesintegerrequiredThe largest size of all keys and values together, in bytes. |
| 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>/applications/<cube>/env" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"expected_version": "7f20b1d",
"set": [
{
"key": "LOG_LEVEL",
"type": "variable",
"value": "debug"
},
{
"key": "STRIPE_KEY",
"type": "secret",
"value": "example-secret-value"
}
],
"delete": [
"OLD_FLAG"
]
}'{
"env_version": "9b1f0c4",
"live_env_version": "e3a91c2",
"live_build_env_version": "e3a91c2",
"live_env_behind": true,
"live_build_env_behind": false,
"build_keys_behind": [],
"databases_behind": [],
"entries": [
{
"key": "DATABASE_URL",
"type": "secret",
"value": null,
"previews": false,
"build": false,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-20T10:02:11Z"
},
{
"key": "LOG_LEVEL",
"type": "variable",
"value": "debug",
"previews": true,
"build": false,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-25T11:05:42Z"
},
{
"key": "STRIPE_KEY",
"type": "secret",
"value": null,
"previews": false,
"build": false,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-25T11:05:42Z"
},
{
"key": "VITE_API_URL",
"type": "variable",
"value": "https://api.example.com",
"previews": true,
"build": true,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-24T14:30:05Z"
}
],
"platform": [
{
"key": "CUBECEN_CUBE_NAME",
"value": "Web",
"next_deploy": true
},
{
"key": "CUBECEN_DEPLOYMENT_ID",
"value": "dpl_00000002a0fdd794980f85f9c353bf",
"next_deploy": false
},
{
"key": "CUBECEN_PROJECT",
"value": "Storefront",
"next_deploy": true
},
{
"key": "CUBECEN_REGION",
"value": null,
"next_deploy": false
},
{
"key": "CUBECEN_WORKSPACE",
"value": "Acme",
"next_deploy": true
}
],
"limits": {
"max_entries": 200,
"max_key_length": 128,
"max_value_bytes": 65536,
"max_total_bytes": 262144
}
}{
"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": "ENV_CHANGED",
"message": "The env changed since it was loaded; review it and save again",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"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"
}
}List the versions of the variables of a cube
/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ env/ versionsReturns the history of a cube's variables and secrets, newest first, a page at a time. It needs only read access.
Each version has its version ID, its kind, who made it and when, and the keys it added, changed and removed in changes. The history never shows values, not even of variables: an older version may hold a value as a variable that was later made a secret. The first item of the first page is the current version.
kind is change (a write) or restore (the values of an older version made current again). A restore names the version it brought back in restored_from, and deployment_id is the rollback that restored it, or null. created_by is the user who made the version. api_key is the API key it was made with, and mcp_client the AI client it was made through Cubecen's MCP server, such as claude.ai. For a version made with a key or an AI client, created_by is the key's owner or the person the client acts for. Both are null for any other version.
Only the newest 100 versions keep their values. Older ones stay in the list with restorable set to false, and cannot be restored or compared.
The answer holds up to limit versions in data. When there are more, next_cursor is set: send it back as cursor to get the next page. On the last page next_cursor is null.
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. |
cuberequired | string | The ID or slug of the cube. A slug is unique within the project. |
Query parameters
| Name | Type | Description |
|---|---|---|
limit | integer | The most versions to return in a page, from 1 to 100. The default is 20. |
cursor | string | Where the next page starts: an opaque value. Send the |
Responses
| Status | Description |
|---|---|
| 200 | One page of the versions, newest first. EnvVersionList object2 fieldsdataarray of objectrequiredThe versions on this page. data items10 fieldsversionstringrequiredThe version's ID, as 7 lowercase hexadecimal characters. kindstringrequired
One of: restored_fromstring | nullrequiredThe version that a restore brought back. deployment_idstring | nullrequiredThe ID of the rollback that restored the version. changesobjectrequiredThe keys that this version added, changed and removed, compared with the version before it. changes object3 fieldsaddedarray of stringrequiredThe keys that the version added, sorted. changedarray of stringrequiredThe keys whose type, value or marks the version changed, sorted. removedarray of stringrequiredThe keys that the version removed, sorted. created_byobjectrequiredThe user who made the version. For a version made with an API key, the key's owner. For one made through an AI client, the person it acts for. created_by object2 fieldsidstringrequiredThe user's ID. namestringrequiredThe user's first and last name, or their email address when they have no name. api_keyobject | nullrequiredThe API key that made the version, for a write, a restore, or the restore of a rollback. mcp_clientstring | nullrequiredThe AI client that made the version for the person, through Cubecen's MCP server, such as created_atstringrequiredWhen the version was made. restorablebooleanrequired
next_cursorstring | nullrequiredSend it as |
| 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 |
| 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>/applications/<cube>/env/versions" \
-H "Authorization: Bearer $CUBECEN_API_KEY"{
"data": [
{
"version": "9b1f0c4",
"kind": "change",
"restored_from": null,
"deployment_id": null,
"changes": {
"added": [
"STRIPE_KEY"
],
"changed": [
"LOG_LEVEL"
],
"removed": [
"OLD_FLAG"
]
},
"created_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"api_key": {
"id": "7e3b9d14-6a52-4f08-b1c7-2d9a5e8f0b36",
"name": "CI"
},
"mcp_client": null,
"created_at": "2026-10-25T11:05:42Z",
"restorable": true
},
{
"version": "7f20b1d",
"kind": "change",
"restored_from": null,
"deployment_id": null,
"changes": {
"added": [],
"changed": [
"VITE_API_URL"
],
"removed": []
},
"created_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"api_key": null,
"mcp_client": "claude.ai",
"created_at": "2026-10-24T14:30:05Z",
"restorable": true
},
{
"version": "e3a91c2",
"kind": "restore",
"restored_from": "b7d2e49",
"deployment_id": "dpl_00000005a0fdd794980f85f9c353bf",
"changes": {
"added": [
"OLD_FLAG"
],
"changed": [],
"removed": []
},
"created_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"api_key": null,
"mcp_client": null,
"created_at": "2026-10-20T10:02:11Z",
"restorable": true
}
],
"next_cursor": null
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "limit must be between 1 and 100",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"field": "limit"
}
}{
"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"
}
}Compare two versions of the variables of a cube
/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ env/ diffReturns what going from one version of a cube's variables and secrets to another adds, changes and removes: keys and types, never values. It needs only read access.
to is the version to compare to. It is required. from is the version to compare from; without it, the current version. In the answer, from is null when the environment has no version yet. Use it to see what restoreEnvironmentVersion, or a rollback with env_version in createDeployment, would change. For a changed key, from_type is the type it had before.
Secrets are compared by their values on our side, so a secret that was saved again with the same value counts as unchanged. A key whose build mark, or a secret's previews mark, differs also counts as changed, with from_type equal to type. A version that no longer keeps its values, because only the newest 100 do, cannot be compared: it is refused with 409 ENV_VERSION_UNAVAILABLE.
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. |
cuberequired | string | The ID or slug of the cube. A slug is unique within the project. |
Query parameters
| Name | Type | Description |
|---|---|---|
torequired | string | The version to compare to: an |
from | string | The version to compare from: an |
Responses
| Status | Description |
|---|---|
| 200 | What the change from one version to the other adds, changes and removes. EnvDiff object5 fieldsfromstring | nullrequiredThe version that the comparison starts from. tostringrequiredThe version that the comparison goes to. addedarray of objectrequiredThe keys that the second version has and the first has not. added items3 fieldskeystringrequiredThe key. typestringrequired
One of: from_typestringFor a changed key, the type it had in the first version. One of: changedarray of objectrequiredThe keys whose value, type or marks differ. changed items3 fieldskeystringrequiredThe key. typestringrequired
One of: from_typestringFor a changed key, the type it had in the first version. One of: removedarray of objectrequiredThe keys that the first version has and the second has not. removed items3 fieldskeystringrequiredThe key. typestringrequired
One of: from_typestringFor a changed key, the type it had in the first version. One of: |
| 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. |
| 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>/applications/<cube>/env/diff?to=<to>" \
-H "Authorization: Bearer $CUBECEN_API_KEY"{
"from": "7f20b1d",
"to": "e3a91c2",
"added": [
{
"key": "OLD_FLAG",
"type": "variable"
}
],
"changed": [
{
"key": "STRIPE_KEY",
"type": "secret",
"from_type": "secret"
},
{
"key": "API_TOKEN",
"type": "secret",
"from_type": "variable"
}
],
"removed": [
{
"key": "NEW_FLAG",
"type": "variable"
}
]
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "to must be an env_version of this cube",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"field": "to"
}
}{
"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": "ENV_VERSION_UNAVAILABLE",
"message": "The values of this env version are no longer kept, so it cannot be compared",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"field": "to"
}
}{
"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"
}
}Bring back an earlier version of the variables
/ v1/ organizations/ {org}/ projects/ {project}/ applications/ {cube}/ env/ restoreMakes an older version of a cube's variables and secrets the current one again. Its values become a new version, of kind restore, on top of expected_version. It needs a key with full access.
Send version, the version to bring back, and expected_version, the current version as getEnvironment shows it, or null before the first version. Both are required. If the environment has changed since, the request is refused with 409 ENV_CHANGED. Restoring values that the environment already holds changes nothing, and the answer is the current state.
Old secret values come back too: a secret that you changed since returns to its old value. Compare first with compareEnvironmentVersions. A key that is marked build now, or in the restored version, stays marked. A version whose values are no longer kept, or one of whose secrets can no longer be read, is refused with 409 ENV_VERSION_UNAVAILABLE.
The answer is the environment at the new version. The restored values reach the running cube with the next build or deployment, like any change. To roll back a release together with its variables in one step, use createDeployment with the release's env_version.
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. |
cuberequired | string | The ID or slug of the cube. A slug is unique within the project. |
Body
| Name | Type | Description |
|---|---|---|
versionrequired | string | The version to bring back: an |
expected_versionrequired | string | null | The current version, as |
Responses
| Status | Description |
|---|---|
| 200 | The variables and secrets at the version that now holds the restored values. Env object10 fieldsenv_versionstring | nullrequiredThe current version, as 7 lowercase hexadecimal characters that are unique within the cube. live_env_versionstring | nullrequiredThe version that the live deployment runs with. live_build_env_versionstring | nullrequiredThe version that the live deployment's build was made with. live_env_behindbooleanrequired
live_build_env_behindbooleanrequired
build_keys_behindarray of stringrequiredThe keys whose change needs a new build, sorted: keys marked databases_behindarray of stringrequiredThe slugs of the databases that this cube refers to whose password was reset after the live deployment started. The cube cannot connect to them until it is deployed again. Empty when there is none. entriesarray of objectrequiredThe variables and secrets, sorted by key. entries items7 fieldskeystringrequiredThe name of the variable or secret. typestringrequired
One of: valuestring | nullrequiredThe value of a variable. Always previewsbooleanrequiredWhether pull request previews get this entry. buildbooleanrequiredWhether the build reads this key. A change to a key that is marked needs a new build, and a change to the others needs only a redeploy. A new key starts without the mark. updated_byobjectrequiredThe user who last changed the entry. updated_by object2 fieldsidstringrequiredThe user's ID. namestringrequiredThe user's first and last name, or their email address when they have no name. updated_atstringrequiredWhen the entry was last changed. platformarray of objectrequiredThe variables that Cubecen sets in every cube, sorted by key. They are read-only and not part of platform items3 fieldskeystringrequiredThe name of the variable: One of: valuestring | nullrequiredThe value. next_deploybooleanrequired
limitsobjectrequiredWhat an environment can hold. limits object4 fieldsmax_entriesintegerrequiredThe most entries, variables and secrets together. max_key_lengthintegerrequiredThe longest key, in characters. max_value_bytesintegerrequiredThe largest value, in bytes. max_total_bytesintegerrequiredThe largest size of all keys and values together, in bytes. |
| 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 POST "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/applications/<cube>/env/restore" \
-H "Authorization: Bearer $CUBECEN_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"version": "e3a91c2", "expected_version": "9b1f0c4"}'{
"env_version": "4d8a6e1",
"live_env_version": "e3a91c2",
"live_build_env_version": "e3a91c2",
"live_env_behind": true,
"live_build_env_behind": false,
"build_keys_behind": [],
"databases_behind": [],
"entries": [
{
"key": "LOG_LEVEL",
"type": "variable",
"value": "info",
"previews": true,
"build": false,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-25T12:40:18Z"
},
{
"key": "VITE_API_URL",
"type": "variable",
"value": "https://api.example.com",
"previews": true,
"build": true,
"updated_by": {
"id": "c41e7a02-93bd-4d58-b0f6-6a1d2e8f4c73",
"name": "Ada Lovelace"
},
"updated_at": "2026-10-24T14:30:05Z"
}
],
"platform": [
{
"key": "CUBECEN_CUBE_NAME",
"value": "Web",
"next_deploy": true
},
{
"key": "CUBECEN_DEPLOYMENT_ID",
"value": "dpl_00000002a0fdd794980f85f9c353bf",
"next_deploy": false
},
{
"key": "CUBECEN_PROJECT",
"value": "Storefront",
"next_deploy": true
},
{
"key": "CUBECEN_REGION",
"value": null,
"next_deploy": false
},
{
"key": "CUBECEN_WORKSPACE",
"value": "Acme",
"next_deploy": true
}
],
"limits": {
"max_entries": 200,
"max_key_length": 128,
"max_value_bytes": 65536,
"max_total_bytes": 262144
}
}{
"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": "ENV_CHANGED",
"message": "The env changed since it was loaded; review it and save again",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}{
"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"
}
}