Environment Variables API Documentation
Base Path
/envs
Endpoints
Get Environment Variables List
Query Parameters
{
searchValue?: string // Search keyword
}
Create Environment Variables
Request Body
[
{
name: string, // Variable name (must start with letter or underscore, can only contain letters, numbers and underscores)
value: string, // Variable value
remarks?: string // Remarks (optional)
}
]
Update Environment Variable
Request Body
{
id: number, // Environment variable ID
name: string, // Variable name
value: string, // Variable value
remarks?: string // Remarks (optional)
}
Delete Environment Variables
Request Body
number[] // Array of environment variable IDs
Move Environment Variable Position
Request Body
{
fromIndex: number, // Original position
toIndex: number // Target position
}
Disable Environment Variables
Request Body
number[] // Array of environment variable IDs
Enable Environment Variables
Request Body
number[] // Array of environment variable IDs
Batch Update Variable Names
Request Body
{
ids: number[], // Array of environment variable IDs
name: string // New variable name
}
Get Single Environment Variable
Get details of specified environment variable ID.
Upload Environment Variables File
Request
- Content-Type:
multipart/form-data
- Field:
env (file)
File Format Requirements
- JSON format
- Each record must contain name and value fields
Accepts a single JSON object or an array of objects with non-empty name and value. Optional remarks and labels are preserved. Import creates new variables; it does not update existing variables by an id in the file. Example:
[{"name":"EXAMPLE","value":"demo","remarks":"Example","labels":["demo"]}]
Error Handling
- All endpoints follow unified error handling mechanism
- Successful responses return
{ code: 200, data: ... }
- Error logging is handled by Winston logger
Notes
- Parameter validation using celebrate/Joi
- Variable names must follow naming conventions
- Supports batch operations (delete, enable, disable, etc.)
- File upload handled by multer
Permissions, labels and pinning
The full base path is /open/envs; applications need the envs scope. Create and update also accept labels?: string[]. Updates require id/name/value together, even when only changing labels.
| Method |
Path |
Request body |
| PUT |
/pin |
Environment variable ID array, e.g. [1,2] |
| PUT |
/unpin |
Environment variable ID array |
| POST |
/labels |
{ "ids": [1,2], "labels": ["demo"] } |
| DELETE |
/labels |
{ "ids": [1,2], "labels": ["demo"] } |
Label operations require non-empty ids and labels arrays. Labels are trimmed and cannot be empty strings. These endpoints add/remove specific labels without resubmitting variable values.
ql env pin 1 2 --json
ql env labels-create --data '{"ids":[1,2],"labels":["demo"]}' --json
ql env list --query '{"searchValue":"EXAMPLE"}' --json
Example successful list response (additional fields depend on the panel version):
{
"code": 200,
"data": [
{ "id": 1, "name": "EXAMPLE", "value": "demo", "remarks": "", "labels": ["demo"] }
]
}