Environment variables

Read and write the environment an application's workers run with.

Introduction

An app's environment is part of the version snapshot its workers are rendered from, so writing a variable is not an in-place edit. A write that changes the stored value records a new version carrying the same image and rolls the app, and a write that leaves the value unchanged records nothing at all.

A write while a rollout is still in flight returns 409 and is discarded, so setting several variables one at a time is that many sequential rollouts. Replace the whole set in one request with PATCH /v1/apps/{appId} instead. See Environment variables.

List environment variables

GETapi.serverless.runware.ai/v1/apps/{appId}/environment-variables

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

Query

limit

integerint32min: 1max: 100default: 20

Maximum number of items to return.

cursor

string

Opaque pagination cursor returned by a previous call, as nextCursor or, on the operations that offer one, prevCursor.

Response

nextCursor

stringnullable

Cursor for the next page. Null when there are no more items.

data

object[]
Array items6 properties each

id

string (uuid)UUID v4

appId

stringmin: 6max: 30

Immutable app identifier. Unique among the authenticated organization's live apps: it cannot be changed after creation, and it becomes available again once the app it named reaches deleted.

key

stringrequiredmin: 1max: 128

POSIX-style environment variable name. Letters, digits, and underscore. Must start with a letter or underscore. Matched by the deployment_configs column CHECK so a valid-by-contract request cannot 500 at INSERT.

value

stringrequired

createdAt

string (date-time)date-time

updatedAt

string (date-time)date-time

Errors

StatusWhen
400The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns 422 instead.
401Missing or invalid credentials
404Resource not found
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503A required service is temporarily unavailable

Update an environment variable

PUTapi.serverless.runware.ai/v1/apps/{appId}/environment-variables/{variableName}

Sets one environment variable, creating it if absent. Names the platform sets on the serving container itself are rejected with 422, as they are on create. A write that changes the stored value records a new version carrying the live environment set and the same image. If that image is deployable, the write pins it as activeVersionId and rolls the workload when the app can take one (active, initializing, or failed which becomes initializing). A stopped or stopping app pins the version and rolls it on resume. A write that leaves the stored value unchanged records no version and does not roll. A write while a rollout of this app is still in flight, or to a failed app while the workers of its failed rollout are still stopping, returns 409 Conflict and does not store the value. Each changing write is serialised behind that rollout, so setting several variables one at a time is that many sequential rolls with 409s between them. Replace the whole set in one request with PATCH /v1/apps/{appId} environmentVariables. An app holds at most 100 environment bindings in total, plain variables plus attached secrets, the same combined ceiling AppCreate.environmentVariables declares (create rejects secrets in-request, attach grows the set later). Overwriting an existing variable is always allowed. Adding one past the ceiling returns 422. The name must not collide with a secret already attached to this app (the secret's injected env var name). Secrets and plain env vars share the pod environment. A duplicate would be resolved last-wins by kubelet with no error, so the server rejects it with 422. The reverse check applies on attach.

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

variableName

stringrequiredmin: 1max: 128

POSIX-style environment variable name. Letters, digits, and underscore. Must start with a letter or underscore. Matched by the deployment_configs column CHECK so a valid-by-contract request cannot 500 at INSERT.

Body

value

stringrequiredmax: 4096

Value delivered to the workload as this variable's value. Bounded because every variable ends up in the pod template, which as a whole has to fit what the Kubernetes API server accepts. The same maxLength create applies, so one path cannot be used to exceed the other.

Response

id

string (uuid)UUID v4

appId

stringmin: 6max: 30

Immutable app identifier. Unique among the authenticated organization's live apps: it cannot be changed after creation, and it becomes available again once the app it named reaches deleted.

key

stringrequiredmin: 1max: 128

POSIX-style environment variable name. Letters, digits, and underscore. Must start with a letter or underscore. Matched by the deployment_configs column CHECK so a valid-by-contract request cannot 500 at INSERT.

value

stringrequired

createdAt

string (date-time)date-time

updatedAt

string (date-time)date-time

Errors

StatusWhen
400The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns 422 instead.
401Missing or invalid credentials
404Resource not found
409Resource already exists or the request conflicts with its current state
413The request body exceeds its size limit: 10 MiB on invoke-sync and invoke-async, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. detail names the limit in bytes.
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503A required service is temporarily unavailable

Delete an environment variable

DELETEapi.serverless.runware.ai/v1/apps/{appId}/environment-variables/{variableName}

Removes one environment variable. A successful delete records a new version carrying the remaining environment set and the same image. If that image is deployable, the delete pins it as activeVersionId and rolls the workload when the app can take one (active, initializing, or failed which becomes initializing). A stopped or stopping app pins the version and rolls it on resume. A delete of a key that is present while a rollout of this app is still in flight, or while the workers of a failed app's failed rollout are still stopping, returns 409 Conflict and does not remove the value. A name that is not present returns 404 even during that window.

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

variableName

stringrequiredmin: 1max: 128

POSIX-style environment variable name. Letters, digits, and underscore. Must start with a letter or underscore. Matched by the deployment_configs column CHECK so a valid-by-contract request cannot 500 at INSERT.

Errors

StatusWhen
401Missing or invalid credentials
404Resource not found
409Resource already exists or the request conflicts with its current state
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503A required service is temporarily unavailable