variable_set
Create or update environment variables in Railway.app services to configure applications, manage secrets, and set connection strings for deployments.
Instructions
[API] Create or update an environment variable
⚡️ Best for: ✓ Setting configuration values ✓ Updating connection strings ✓ Managing service secrets
⚠️ Not for: × Bulk variable updates (use variable_bulk_set) × Temporary configuration changes
→ Prerequisites: service_list
→ Alternatives: variable_bulk_set
→ Next steps: deployment_trigger, service_restart
→ Related: variable_list, variable_delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project containing the service | |
| environmentId | Yes | ID of the environment for the variable (usually obtained from service_list) | |
| name | Yes | Name of the environment variable | |
| value | Yes | Value to set for the variable | |
| serviceId | No | Optional: ID of the service for the variable, if omitted creates/updates a shared variable |