API & Developers
Manage project environments with the API
Use the project environments API to discover environment slugs or create environments before tagging project logs and maintenance records.
Before you begin
Send an API token as a bearer token and request JSON. Listing or viewing environments requires project_environments:read. Creating one requires project_environments:create, plus a Developer or Administrator role on the project.
Authorization: Bearer YOUR_TOKEN
Accept: application/json
Content-Type: application/jsonEndpoints
Action | Method and endpoint |
|---|---|
List environments |
|
Create an environment |
|
View an environment |
|
The {environment} route value is the environment slug. Environments are scoped to the project in the URL.
List environments
The list is paginated, with Production first and other environments ordered by name. The default page size is 15 and the maximum is 100.
Each environment resource includes:
{
"name": "Staging",
"slug": "staging",
"url": "https://staging.example.com",
"is_primary": false
}Create an environment
Send the name and URL:
{
"name": "Staging",
"url": "https://staging.example.com"
}DeployMonitor generates the slug. You cannot set slug, is_primary, or project_id. The name, generated slug, and normalized URL must be unique among active environments in the project.
The API does not currently provide update or delete endpoints for environments. Administrators can delete a non-primary environment from Project > Settings > Environments.
Troubleshooting
401 Unauthorized: confirm that the token is valid.403 Forbidden: check the token ability and your project role. Members cannot create environments.404 Not Found: confirm the project ID and environment slug. Deleted and cross-project environments are not returned.422 Unprocessable Entity: check the name and URL, and do not send server-managed fields.