Skip to main content
POST
/
api
/
public
/
v2
/
env-vars
Create Workspace Env Var
curl --request POST \
  --url https://api.promptlayer.com/api/public/v2/env-vars \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "key": "<string>",
  "value": "<string>"
}
'
{
  "success": true,
  "workspace_env_var": {
    "id": 123,
    "key": "<string>",
    "value_suffix": "<string>",
    "is_empty": true,
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "workspace_id": 123,
    "tool_registry_id": 123
  }
}
Create a workspace-scoped environment variable. The key must be a valid identifier (^[A-Za-z_][A-Za-z0-9_]*$). The value may be empty to create a placeholder that the user fills in later via the Settings UI.

Authorizations

X-API-KEY
string
header
required

Body

application/json
key
string
required

Environment variable name. Must start with a letter or underscore and contain only letters, digits, and underscores.

Required string length: 1 - 255
Pattern: ^[A-Za-z_][A-Za-z0-9_]*$
value
string

Value to store. May be empty to create a placeholder that the user will fill in later.

Maximum string length: 8192

Response

Successful Response

success
boolean
workspace_env_var
object