Endpoints
Get All Environment Variables
Copy
GET {sandbox_public_host}/env
Copy
{
"env_vars": {
"PATH": "/usr/local/bin:/usr/bin:/bin",
"HOME": "/root",
"API_KEY": "sk-test-123"
}
}
Set All Environment Variables
Copy
PUT {sandbox_public_host}/env
Copy
{
"env_vars": {
"API_KEY": "sk-prod-xyz",
"NODE_ENV": "production"
}
}
Update Environment Variables
Copy
PATCH {sandbox_public_host}/env
Copy
{
"env_vars": {
"DEBUG": "true"
}
}
Delete Environment Variable
Copy
DELETE {sandbox_public_host}/env/{key}
Examples
cURL
Copy
# Get all
curl -H "Authorization: Bearer {auth_token}" \
https://1761048129dsaqav4n.hopx.dev/env
# Set all
curl -X PUT https://1761048129dsaqav4n.hopx.dev/env \
-H "Authorization: Bearer {auth_token}" \
-H "Content-Type: application/json" \
-d '{"env_vars": {"API_KEY": "sk-prod-xyz"}}'
# Update
curl -X PATCH https://1761048129dsaqav4n.hopx.dev/env \
-H "Authorization: Bearer {auth_token}" \
-H "Content-Type: application/json" \
-d '{"env_vars": {"DEBUG": "true"}}'
# Delete
curl -X DELETE \
-H "Authorization: Bearer {auth_token}" \
https://1761048129dsaqav4n.hopx.dev/env/DEBUG
Python
Copy
# Get all
response = requests.get(
f"{sandbox_public_host}/env",
headers={"Authorization": f"Bearer {auth_token}"}
)
env_vars = response.json()["env_vars"]
# Set all
requests.put(
f"{sandbox_public_host}/env",
headers={"Authorization": f"Bearer {auth_token}"},
json={"env_vars": {"API_KEY": "sk-prod-xyz"}}
)
# Update
requests.patch(
f"{sandbox_public_host}/env",
headers={"Authorization": f"Bearer {auth_token}"},
json={"env_vars": {"DEBUG": "true"}}
)
# Delete
requests.delete(
f"{sandbox_public_host}/env/DEBUG",
headers={"Authorization": f"Bearer {auth_token}"}
)
JavaScript
Copy
// Get all
const response = await fetch(`${sandboxPublicHost}/env`, {
headers: {
'Authorization': `Bearer ${authToken}`
}
});
const data = await response.json();
const envVars = data.env_vars;
// Set all
await fetch(`${sandboxPublicHost}/env`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${authToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
env_vars: { API_KEY: 'sk-prod-xyz' }
})
});
// Update
await fetch(`${sandboxPublicHost}/env`, {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${authToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
env_vars: { DEBUG: 'true' }
})
});
// Delete
await fetch(`${sandboxPublicHost}/env/DEBUG`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${authToken}`
}
});
Related
- Code Execution - Execute code with env vars

