Skip to main content
POST
/
static-sites
/
{id}
/
env-vars
Create static site environment variable
curl --request POST \
  --url https://api.sevalla.com/v3/static-sites/{id}/env-vars \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "API_BASE_URL",
  "value": "https://api.example.com",
  "is_production": true,
  "is_preview": true,
  "branch": "main"
}
'
{
  "id": "fb5e5168-4281-4bec-94c5-0d1584e9e657",
  "static_site_id": "fb5e5168-4281-4bec-94c5-0d1584e9e657",
  "key": "API_KEY",
  "value": "my-secret-value",
  "is_production": true,
  "is_preview": false,
  "branch": "main",
  "created_at": "2025-01-30T00:00:00.000Z",
  "updated_at": "2025-01-30T00:00:00.000Z"
}

Authorizations

Authorization
string
header
required

API key authentication. Pass your API key as a Bearer token in the Authorization header.

Path Parameters

id
string<uuid>
required

Static site identifier

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"fb5e5168-4281-4bec-94c5-0d1584e9e657"

Body

application/json
key
string
required

Name of the environment variable. Must be unique within the static site scope.

Required string length: 1 - 255
Example:

"API_BASE_URL"

value
string
required

Value of the environment variable. Will be stored encrypted at rest.

Maximum string length: 32768
Example:

"https://api.example.com"

is_production
boolean

Whether this variable is used in production deployments. Defaults to true.

Example:

true

is_preview
boolean

Whether this variable is used in preview deployments. Defaults to true.

Example:

true

branch
string

Git branch this variable is scoped to. When omitted, the variable applies to all branches.

Example:

"main"

Response

Default Response

id
string<uuid>
required

Unique identifier for the environment variable

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"fb5e5168-4281-4bec-94c5-0d1584e9e657"

static_site_id
string<uuid>
required

Identifier of the static site this environment variable belongs to

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"fb5e5168-4281-4bec-94c5-0d1584e9e657"

key
string
required

Name of the environment variable

Required string length: 1 - 255
Example:

"API_KEY"

value
string
required

Decrypted value of the environment variable

Maximum string length: 32768
Example:

"my-secret-value"

is_production
boolean | null
required

Whether this variable is used in production deployments

Example:

true

is_preview
boolean | null
required

Whether this variable is used in preview deployments

Example:

false

branch
string | null
required

Git branch this variable is scoped to, or null for all branches

Example:

"main"

created_at
string<date-time>
required

Timestamp when the environment variable was created, in ISO 8601 format

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
Example:

"2025-01-30T00:00:00.000Z"

updated_at
string<date-time>
required

Timestamp when the environment variable was last modified, in ISO 8601 format

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
Example:

"2025-01-30T00:00:00.000Z"