Skip to content
API reference3d60c45 · docs(api): environment

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

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

Shell
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

GET/v1/organizations/{org}/projects/{project}/applications/{cube}/env
Read-only key

Returns 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

NameTypeDescription
orgrequiredstring

The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with 403, and so is a slug that matches no organization. An ID that matches no organization at all is 404.

projectrequiredstring

The ID or slug of the project. A slug is unique within the organization.

cuberequiredstring

The ID or slug of the cube. A slug is unique within the project.

Responses

StatusDescription
200

The variables and secrets at the current version.

Env object10 fields
env_versionstring | nullrequired

The current version, as 7 lowercase hexadecimal characters that are unique within the cube. null before the first change.

live_env_versionstring | nullrequired

The version that the live deployment runs with. null when nothing is live, or when the live deployment is older than the environment feature.

live_build_env_versionstring | nullrequired

The version that the live deployment's build was made with. null in the same cases as live_env_version.

live_env_behindbooleanrequired

true when the live deployment runs with other values than the current ones. false when nothing is live.

live_build_env_behindbooleanrequired

true when a key marked build has another value than the live build was made with, which means build_keys_behind is not empty. Then a change needs a new build. false when nothing is live.

build_keys_behindarray of stringrequired

The keys whose change needs a new build, sorted: keys marked build now or when the live build was made, that were added, changed or removed since. Empty when nothing is live or when only unmarked keys changed.

databases_behindarray of stringrequired

The 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 objectrequired

The variables and secrets, sorted by key.

entries items7 fields
keystringrequired

The name of the variable or secret.

typestringrequired

variable, whose value is shown, or secret, whose value is never shown.

One of: variable, secret

valuestring | nullrequired

The value of a variable. Always null for a secret.

previewsbooleanrequired

Whether pull request previews get this entry. true for a variable, except one that refers to a database: previews never get it. For a secret, only once it is marked so.

buildbooleanrequired

Whether 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_byobjectrequired

The user who last changed the entry.

updated_by object2 fields
idstringrequired

The user's ID.

namestringrequired

The user's first and last name, or their email address when they have no name.

updated_atstringrequired

When the entry was last changed.

platformarray of objectrequired

The variables that Cubecen sets in every cube, sorted by key. They are read-only and not part of entries.

platform items3 fields
keystringrequired

The name of the variable: CUBECEN_CUBE_NAME, CUBECEN_DEPLOYMENT_ID, CUBECEN_PROJECT, CUBECEN_REGION or CUBECEN_WORKSPACE.

One of: CUBECEN_CUBE_NAME, CUBECEN_DEPLOYMENT_ID, CUBECEN_PROJECT, CUBECEN_REGION, CUBECEN_WORKSPACE

valuestring | nullrequired

The value. null when there is none, as for CUBECEN_DEPLOYMENT_ID before a deployment is live and CUBECEN_REGION while no region is set.

next_deploybooleanrequired

true when the value is what the next deployment gets: the running cube has the value of its own deployment, so a rename shows from the next deployment. false for CUBECEN_DEPLOYMENT_ID, which is the live deployment's, and for CUBECEN_REGION.

limitsobjectrequired

What an environment can hold.

limits object4 fields
max_entriesintegerrequired

The most entries, variables and secrets together.

max_key_lengthintegerrequired

The longest key, in characters.

max_value_bytesintegerrequired

The largest value, in bytes.

max_total_bytesintegerrequired

The 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 404, and so is a project, cube or other ID or slug in the path that matches nothing in the organization (or in the project or cube that the path names). An organization slug that matches nothing, and another organization by ID or by slug, is 403, not 404.

429

The key made too many requests. Wait for the number of seconds in Retry-After, then retry.

500

Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the error.requestId.

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

Shell
curl -sS "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/applications/<cube>/env" \
  -H "Authorization: Bearer $CUBECEN_API_KEY"
Response
{
  "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
  }
}

Change the variables and secrets of a cube

PATCH/v1/organizations/{org}/projects/{project}/applications/{cube}/env

Adds, 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

NameTypeDescription
orgrequiredstring

The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with 403, and so is a slug that matches no organization. An ID that matches no organization at all is 404.

projectrequiredstring

The ID or slug of the project. A slug is unique within the organization.

cuberequiredstring

The ID or slug of the cube. A slug is unique within the project.

Body

NameTypeDescription
expected_versionrequiredstring | null

The env_version that the change is based on, as getEnvironment gave it. null for the first change. A stale value is refused with 409 ENV_CHANGED.

setarray of object

The entries to add or replace.

set items5 fields
keystringrequired

The name: 1 to 128 letters, digits and _, not starting with a digit. Names that Cubecen sets are refused.

typestringrequired

variable or secret.

One of: variable, secret

valuestring

The 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 type.

previewsboolean

For a secret: whether pull request previews get it. Left out, a secret keeps its mark, and a new secret starts without one. false on a variable is refused: a variable always goes to previews.

buildboolean

Whether the build reads the key. Left out, a key keeps its mark, even when its type changes, and a new key starts without one.

deletearray of string

The keys to remove.

Responses

StatusDescription
200

The variables and secrets at the new version. A change that alters nothing answers the current version.

Env object10 fields
env_versionstring | nullrequired

The current version, as 7 lowercase hexadecimal characters that are unique within the cube. null before the first change.

live_env_versionstring | nullrequired

The version that the live deployment runs with. null when nothing is live, or when the live deployment is older than the environment feature.

live_build_env_versionstring | nullrequired

The version that the live deployment's build was made with. null in the same cases as live_env_version.

live_env_behindbooleanrequired

true when the live deployment runs with other values than the current ones. false when nothing is live.

live_build_env_behindbooleanrequired

true when a key marked build has another value than the live build was made with, which means build_keys_behind is not empty. Then a change needs a new build. false when nothing is live.

build_keys_behindarray of stringrequired

The keys whose change needs a new build, sorted: keys marked build now or when the live build was made, that were added, changed or removed since. Empty when nothing is live or when only unmarked keys changed.

databases_behindarray of stringrequired

The 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 objectrequired

The variables and secrets, sorted by key.

entries items7 fields
keystringrequired

The name of the variable or secret.

typestringrequired

variable, whose value is shown, or secret, whose value is never shown.

One of: variable, secret

valuestring | nullrequired

The value of a variable. Always null for a secret.

previewsbooleanrequired

Whether pull request previews get this entry. true for a variable, except one that refers to a database: previews never get it. For a secret, only once it is marked so.

buildbooleanrequired

Whether 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_byobjectrequired

The user who last changed the entry.

updated_by object2 fields
idstringrequired

The user's ID.

namestringrequired

The user's first and last name, or their email address when they have no name.

updated_atstringrequired

When the entry was last changed.

platformarray of objectrequired

The variables that Cubecen sets in every cube, sorted by key. They are read-only and not part of entries.

platform items3 fields
keystringrequired

The name of the variable: CUBECEN_CUBE_NAME, CUBECEN_DEPLOYMENT_ID, CUBECEN_PROJECT, CUBECEN_REGION or CUBECEN_WORKSPACE.

One of: CUBECEN_CUBE_NAME, CUBECEN_DEPLOYMENT_ID, CUBECEN_PROJECT, CUBECEN_REGION, CUBECEN_WORKSPACE

valuestring | nullrequired

The value. null when there is none, as for CUBECEN_DEPLOYMENT_ID before a deployment is live and CUBECEN_REGION while no region is set.

next_deploybooleanrequired

true when the value is what the next deployment gets: the running cube has the value of its own deployment, so a rename shows from the next deployment. false for CUBECEN_DEPLOYMENT_ID, which is the live deployment's, and for CUBECEN_REGION.

limitsobjectrequired

What an environment can hold.

limits object4 fields
max_entriesintegerrequired

The most entries, variables and secrets together.

max_key_lengthintegerrequired

The longest key, in characters.

max_value_bytesintegerrequired

The largest value, in bytes.

max_total_bytesintegerrequired

The largest size of all keys and values together, in bytes.

400

The request is not valid. error.field names the field to blame, when there is one.

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 404, and so is a project, cube or other ID or slug in the path that matches nothing in the organization (or in the project or cube that the path names). An organization slug that matches nothing, and another organization by ID or by slug, is 403, not 404.

409

The request conflicts with the current state of the resource. error.code says how.

413

The request body is larger than 1 MiB.

415

The request body must be JSON. Send Content-Type: application/json.

429

The key made too many requests. Wait for the number of seconds in Retry-After, then retry.

500

Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the error.requestId.

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

Shell
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"
       ]
     }'
Response
{
  "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
  }
}

List the versions of the variables of a cube

GET/v1/organizations/{org}/projects/{project}/applications/{cube}/env/versions
Read-only key

Returns 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

NameTypeDescription
orgrequiredstring

The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with 403, and so is a slug that matches no organization. An ID that matches no organization at all is 404.

projectrequiredstring

The ID or slug of the project. A slug is unique within the organization.

cuberequiredstring

The ID or slug of the cube. A slug is unique within the project.

Query parameters

NameTypeDescription
limitinteger

The most versions to return in a page, from 1 to 100. The default is 20.

cursorstring

Where the next page starts: an opaque value. Send the next_cursor of the previous page as it is. Leave it out to get the first page. A value that does not belong to this list is refused with 400.

Responses

StatusDescription
200

One page of the versions, newest first.

EnvVersionList object2 fields
dataarray of objectrequired

The versions on this page.

data items10 fields
versionstringrequired

The version's ID, as 7 lowercase hexadecimal characters.

kindstringrequired

change for a write, or restore for the values of an older version made current again.

One of: change, restore

restored_fromstring | nullrequired

The version that a restore brought back. null for a change.

deployment_idstring | nullrequired

The ID of the rollback that restored the version. null for a change, for a restore made on its own, and while that deployment was not created.

changesobjectrequired

The keys that this version added, changed and removed, compared with the version before it.

changes object3 fields
addedarray of stringrequired

The keys that the version added, sorted.

changedarray of stringrequired

The keys whose type, value or marks the version changed, sorted.

removedarray of stringrequired

The keys that the version removed, sorted.

created_byobjectrequired

The 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 fields
idstringrequired

The user's ID.

namestringrequired

The user's first and last name, or their email address when they have no name.

api_keyobject | nullrequired

The API key that made the version, for a write, a restore, or the restore of a rollback. null for every other version. A revoked key keeps its name here.

mcp_clientstring | nullrequired

The AI client that made the version for the person, through Cubecen's MCP server, such as claude.ai. null for every other version.

created_atstringrequired

When the version was made.

restorablebooleanrequired

false once the version's values are no longer kept: only the newest 100 versions keep them.

next_cursorstring | nullrequired

Send it as cursor to get the next page. null on the last page.

400

The request is not valid. error.field names the field to blame, when there is one.

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 404, and so is a project, cube or other ID or slug in the path that matches nothing in the organization (or in the project or cube that the path names). An organization slug that matches nothing, and another organization by ID or by slug, is 403, not 404.

429

The key made too many requests. Wait for the number of seconds in Retry-After, then retry.

500

Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the error.requestId.

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

Shell
curl -sS "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/applications/<cube>/env/versions" \
  -H "Authorization: Bearer $CUBECEN_API_KEY"
Response
{
  "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
}

Compare two versions of the variables of a cube

GET/v1/organizations/{org}/projects/{project}/applications/{cube}/env/diff
Read-only key

Returns 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

NameTypeDescription
orgrequiredstring

The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with 403, and so is a slug that matches no organization. An ID that matches no organization at all is 404.

projectrequiredstring

The ID or slug of the project. A slug is unique within the organization.

cuberequiredstring

The ID or slug of the cube. A slug is unique within the project.

Query parameters

NameTypeDescription
torequiredstring

The version to compare to: an env_version of this cube, as getEnvironment and listEnvironmentVersions show it. 7 lowercase hexadecimal characters.

fromstring

The version to compare from: an env_version of this cube. Without it, the current version.

Responses

StatusDescription
200

What the change from one version to the other adds, changes and removes.

EnvDiff object5 fields
fromstring | nullrequired

The version that the comparison starts from. null for the empty environment before the first version.

tostringrequired

The version that the comparison goes to.

addedarray of objectrequired

The keys that the second version has and the first has not.

added items3 fields
keystringrequired

The key.

typestringrequired

variable or secret: the key's type in the version that the comparison goes to, or in the first version for a removed key.

One of: variable, secret

from_typestring

For a changed key, the type it had in the first version.

One of: variable, secret

changedarray of objectrequired

The keys whose value, type or marks differ.

changed items3 fields
keystringrequired

The key.

typestringrequired

variable or secret: the key's type in the version that the comparison goes to, or in the first version for a removed key.

One of: variable, secret

from_typestring

For a changed key, the type it had in the first version.

One of: variable, secret

removedarray of objectrequired

The keys that the first version has and the second has not.

removed items3 fields
keystringrequired

The key.

typestringrequired

variable or secret: the key's type in the version that the comparison goes to, or in the first version for a removed key.

One of: variable, secret

from_typestring

For a changed key, the type it had in the first version.

One of: variable, secret

400

The request is not valid. error.field names the field to blame, when there is one.

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 404, and so is a project, cube or other ID or slug in the path that matches nothing in the organization (or in the project or cube that the path names). An organization slug that matches nothing, and another organization by ID or by slug, is 403, not 404.

409

The request conflicts with the current state of the resource. error.code says how.

429

The key made too many requests. Wait for the number of seconds in Retry-After, then retry.

500

Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the error.requestId.

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

Shell
curl -sS "https://api.cubecen.com/v1/organizations/<org>/projects/<project>/applications/<cube>/env/diff?to=<to>" \
  -H "Authorization: Bearer $CUBECEN_API_KEY"
Response
{
  "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"
    }
  ]
}

Bring back an earlier version of the variables

POST/v1/organizations/{org}/projects/{project}/applications/{cube}/env/restore

Makes 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

NameTypeDescription
orgrequiredstring

The ID or slug of the organization. A key works in one organization. Another organization, by ID or by slug, is refused with 403, and so is a slug that matches no organization. An ID that matches no organization at all is 404.

projectrequiredstring

The ID or slug of the project. A slug is unique within the organization.

cuberequiredstring

The ID or slug of the cube. A slug is unique within the project.

Body

NameTypeDescription
versionrequiredstring

The version to bring back: an env_version of this cube.

expected_versionrequiredstring | null

The current version, as getEnvironment shows it. null before the first version. A stale value is refused with 409 ENV_CHANGED.

Responses

StatusDescription
200

The variables and secrets at the version that now holds the restored values.

Env object10 fields
env_versionstring | nullrequired

The current version, as 7 lowercase hexadecimal characters that are unique within the cube. null before the first change.

live_env_versionstring | nullrequired

The version that the live deployment runs with. null when nothing is live, or when the live deployment is older than the environment feature.

live_build_env_versionstring | nullrequired

The version that the live deployment's build was made with. null in the same cases as live_env_version.

live_env_behindbooleanrequired

true when the live deployment runs with other values than the current ones. false when nothing is live.

live_build_env_behindbooleanrequired

true when a key marked build has another value than the live build was made with, which means build_keys_behind is not empty. Then a change needs a new build. false when nothing is live.

build_keys_behindarray of stringrequired

The keys whose change needs a new build, sorted: keys marked build now or when the live build was made, that were added, changed or removed since. Empty when nothing is live or when only unmarked keys changed.

databases_behindarray of stringrequired

The 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 objectrequired

The variables and secrets, sorted by key.

entries items7 fields
keystringrequired

The name of the variable or secret.

typestringrequired

variable, whose value is shown, or secret, whose value is never shown.

One of: variable, secret

valuestring | nullrequired

The value of a variable. Always null for a secret.

previewsbooleanrequired

Whether pull request previews get this entry. true for a variable, except one that refers to a database: previews never get it. For a secret, only once it is marked so.

buildbooleanrequired

Whether 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_byobjectrequired

The user who last changed the entry.

updated_by object2 fields
idstringrequired

The user's ID.

namestringrequired

The user's first and last name, or their email address when they have no name.

updated_atstringrequired

When the entry was last changed.

platformarray of objectrequired

The variables that Cubecen sets in every cube, sorted by key. They are read-only and not part of entries.

platform items3 fields
keystringrequired

The name of the variable: CUBECEN_CUBE_NAME, CUBECEN_DEPLOYMENT_ID, CUBECEN_PROJECT, CUBECEN_REGION or CUBECEN_WORKSPACE.

One of: CUBECEN_CUBE_NAME, CUBECEN_DEPLOYMENT_ID, CUBECEN_PROJECT, CUBECEN_REGION, CUBECEN_WORKSPACE

valuestring | nullrequired

The value. null when there is none, as for CUBECEN_DEPLOYMENT_ID before a deployment is live and CUBECEN_REGION while no region is set.

next_deploybooleanrequired

true when the value is what the next deployment gets: the running cube has the value of its own deployment, so a rename shows from the next deployment. false for CUBECEN_DEPLOYMENT_ID, which is the live deployment's, and for CUBECEN_REGION.

limitsobjectrequired

What an environment can hold.

limits object4 fields
max_entriesintegerrequired

The most entries, variables and secrets together.

max_key_lengthintegerrequired

The longest key, in characters.

max_value_bytesintegerrequired

The largest value, in bytes.

max_total_bytesintegerrequired

The largest size of all keys and values together, in bytes.

400

The request is not valid. error.field names the field to blame, when there is one.

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 404, and so is a project, cube or other ID or slug in the path that matches nothing in the organization (or in the project or cube that the path names). An organization slug that matches nothing, and another organization by ID or by slug, is 403, not 404.

409

The request conflicts with the current state of the resource. error.code says how.

413

The request body is larger than 1 MiB.

415

The request body must be JSON. Send Content-Type: application/json.

429

The key made too many requests. Wait for the number of seconds in Retry-After, then retry.

500

Something went wrong on our side. Retry the request with backoff. If it keeps failing, give support the error.requestId.

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

Shell
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"}'
Response
{
  "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
  }
}