Overview
Creates a single environment variable for a specific project and environment. When called from inside a task, theprojectRef and env arguments can be omitted and are inferred from the task’s runtime context.
To create or update multiple variables in one request, use the upload (bulk import) endpoint instead.
Endpoint
Path parameters
string
required
The project reference (e.g.
proj_yubjwjsfkxnylobaqvqz).string
required
The target environment:
dev, staging, prod, or preview.Request body
string
required
The name of the environment variable (e.g.
SLACK_API_KEY).string
required
The value to assign.
Response
boolean
true when the variable was created successfully.Examples
Response example
Related operations
Preview branches
To create a variable scoped to a specific preview branch, include thex-trigger-branch header or set previewBranch in the SDK configuration.
- SDK
- cURL