Create Environment Variables API
Use this API to add environment variables to an environment. This endpoint supports multiple variable types including plain text, AWS Parameter Store, AWS Secrets Manager, and values linked from other services.
API Description
| Method | Path |
|---|---|
| POST | /v1/environments/{environmentId}/env-variables |
| Headers | |
|---|---|
| Authorization | Bearer: [API key] |
| Content-Type | application/json |
Full Endpoint URL https://api.flightcontrol.dev/v1/environments/{environmentId}/env-variables
Path Parameters
| Parameter | Type | Description |
|---|---|---|
environmentId | string | The unique ID of the environment |
Request Body
All fields are optional. You can send any combination of these groups:
| Parameter | Type | Description |
|---|---|---|
plainText | object | Plain text environment variables stored in the database. Key-value pairs where both are strings. |
parameterStore | object | FC-managed secrets stored in AWS Parameter Store. Flightcontrol creates and manages the parameter. Key is the variable name, value is the secret value. |
secretsManager | object | FC-managed secrets stored in AWS Secrets Manager. Flightcontrol creates and manages the secret. Key is the variable name, value is the secret value. |
fromParameterStore | object | Reference existing AWS Parameter Store parameters you manage. Key is the variable name, value is the parameter path. Saved immediately. |
fromSecretsManager | object | Reference existing AWS Secrets Manager secrets you manage. Key is the variable name, value is the secret ARN. Saved immediately. |
fromService | object | Reference values from other services in your environment. Key is the variable name, value is an object with id (service ID) and value (property to reference). |
Environment Variable Types
Plain Text
Simple string values stored in the database.
{
"plainText": {
"NODE_ENV": "production",
"LOG_LEVEL": "info"
}
}AWS Parameter Store (FC-Managed)
Store a secret value in AWS Systems Manager Parameter Store. Flightcontrol creates and manages the parameter.
{
"parameterStore": {
"DATABASE_PASSWORD": "my-secret-password"
}
}AWS Secrets Manager (FC-Managed)
Store a secret value in AWS Secrets Manager. Flightcontrol creates and manages the secret.
{
"secretsManager": {
"API_SECRET": "super-secret-api-key"
}
}Linked Service Value
Reference a value from another service in your environment (e.g., database connection string).
{
"fromService": {
"DATABASE_URL": {
"id": "my-database-service-id",
"value": "dbConnectionString"
}
}
}User-Managed AWS Parameter Store
Reference existing AWS Parameter Store parameters that you manage directly. These are saved immediately.
{
"fromParameterStore": {
"EXISTING_PARAM": "/my-org/existing-parameter"
}
}User-Managed AWS Secrets Manager
Reference existing AWS Secrets Manager secrets that you manage directly. These are saved immediately.
{
"fromSecretsManager": {
"EXISTING_SECRET": "arn:aws:secretsmanager:us-east-1:123456789:secret:my-secret"
}
}Request Example
curl -X POST "https://api.flightcontrol.dev/v1/environments/env-123/env-variables" \
-H "Authorization: Bearer: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"plainText": {
"NODE_ENV": "production"
},
"parameterStore": {
"DATABASE_PASSWORD": "db-password-123"
},
"secretsManager": {
"API_SECRET": "api-secret-456"
},
"fromParameterStore": {
"EXTERNAL_API_KEY": "/external/api-key"
},
"fromService": {
"DATABASE_URL": {
"id": "rds-service-id",
"value": "dbConnectionString"
}
}
}'Response
The response depends on the types of environment variables being saved.
Variables using plainText, fromService, fromParameterStore, and fromSecretsManager are
saved immediately. Only FC-managed secrets (parameterStore and secretsManager) require async
processing.
Synchronous Response (No FC-Managed Secrets)
When no parameterStore or secretsManager values are included:
HTTP/1.1 200 OK
{
"status": "completed",
"savedCount": 3
}| Field | Type | Description |
|---|---|---|
status | string | "completed" when all variables are saved |
savedCount | number | Count of environment variables saved synchronously |
Asynchronous Response (With FC-Managed Secrets)
When parameterStore or secretsManager values are included, a runId is returned to track the workflow:
HTTP/1.1 202 Accepted
{
"status": "processing",
"runId": "abc123-workflow-run-id",
"savedCount": 2,
"processingCount": 1
}| Field | Type | Description |
|---|---|---|
status | string | "processing" when FC-managed secrets are being stored |
runId | string | Workflow ID to check status |
savedCount | number | Count of environment variables saved synchronously |
processingCount | number | Count of FC-managed secrets being processed asynchronously |
Checking Workflow Status
When you receive a runId, use the status endpoint to check progress:
| Method | Path |
|---|---|
| GET | /v1/environments/{environmentId}/env-variables/status?runId={runId} |
Status Request Example
curl "https://api.flightcontrol.dev/v1/environments/env-123/env-variables/status?runId=abc123" \
-H "Authorization: Bearer: YOUR_API_KEY"Status Response
{
"isFinished": true,
"processedEnvVariables": 2,
"totalExpectedEnvVars": 2,
"storedEnvVariables": {
"DATABASE_PASSWORD": {"fromParameterStore": "/fc/..."},
"API_SECRET": {"fromSecretsManager": "arn:aws:secretsmanager:..."}
},
"failedEnvVariables": {}
}| Field | Type | Description |
|---|---|---|
isFinished | boolean | Whether processing is complete |
processedEnvVariables | number | Variables processed so far |
totalExpectedEnvVars | number | Total variables to process |
storedEnvVariables | object | Successfully stored variables with their AWS references |
failedEnvVariables | object | Variables that failed to store |
Response Conditions
Errors
FC-managed secrets (parameterStore and secretsManager) are stored securely in your AWS
account. Flightcontrol never stores your secret values.