Returns the environment variables configured in the project.
Parameter Type Description idstring Project ID (ObjectId)
Header Required Description x-api-keyYes Project API Key x-organization-idYes Active project organization Content-Type: application/jsonConditional Required only for PATCH calls
Environment variable values can include sensitive data. Treat this response as sensitive because values returned by the API may be available in plain text to callers with a valid project API key.
{
"status" : "success" ,
"message" : "get envs with success" ,
"data" : [
{
"name" : "DATABASE_URL" ,
"value" : "postgres://user:pass@host:5432/db"
},
{
"name" : "NODE_ENV" ,
"value" : "production"
}
]
}
Updates the environment variables of the project.
Parameter Type Description idstring Project ID (ObjectId)
Field Type Required Description envsarray Yes Array of objects with name and value (maximum 50 variables, each name up to 120 characters, each value up to 32760 characters)
{
"envs" : [
{
"name" : "DATABASE_URL" ,
"value" : "postgres://user:pass@host:5432/db"
},
{
"name" : "API_KEY" ,
"value" : "new-api-key"
}
]
}
{
"status" : "success" ,
"message" : "updated with success"
}
curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/envs" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id"
curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/envs" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id" \
-H "Content-Type: application/json" \
-d '{"envs": [{"name": "NODE_ENV", "value": "production"}]}'
import requests
API_KEY = "your-api-key"
ORGANIZATION_ID = "your-organization-id"
PROJECT_ID = "507f1f77bcf86cd799439011"
headers = { "x-api-key" : API_KEY , "x-organization-id" : ORGANIZATION_ID }
# Get environment variables
envs = requests.get(
f "https://api.zenifra.com/v1/project/ {PROJECT_ID} /envs" ,
headers = headers
).json()
print (envs)
# Update environment variables
requests.patch(
f "https://api.zenifra.com/v1/project/ {PROJECT_ID} /envs" ,
headers = headers,
json = {
"envs" : [
{ "name" : "NODE_ENV" , "value" : "production" },
{ "name" : "DATABASE_URL" , "value" : "postgres://user:pass@host:5432/db" }
]
}
)
Maximum of 50 environment variables per project
Each name can have up to 120 characters
Each value can have up to 32760 characters