Environments
Every /v1 route for environments. This page is generated from the API's OpenAPI contract, so it always matches what the API accepts and returns.
Authentication, pagination, errors and idempotency work the same on every route. They are described once, in the API overview.
Get an environment, with its project and tier
GET /v1/environments/{environmentId}
The same membership and project-scope check as listing the project. kind is DEV, UAT or PROD when the name is exactly that tier.
Key scopes: READ and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
environmentId | string | yes | The environment's id. |
Returns
200withV1EnvironmentDetail.
curl "https://api.naijacloud.com/v1/environments/$ENVIRONMENT_ID" \
-H "Authorization: Bearer $NC_API_KEY"Delete an environment and everything in it
DELETE /v1/environments/{environmentId}
Irreversible: tears down every service in it, data included. Requires ADMIN.
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
environmentId | string | yes | The environment's id. |
Returns
204with no body.
curl -X DELETE "https://api.naijacloud.com/v1/environments/$ENVIRONMENT_ID" \
-H "Authorization: Bearer $NC_API_KEY"Create an environment in a project
POST /v1/projects/{projectId}/environments
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
projectId | string | yes | The project's id. |
Headers
| Name | Type | Required | Notes |
|---|---|---|---|
Idempotency-Key | string | no | Any unique string (1–255 printable characters). A retry with the same key and body returns the first response instead of acting twice, for 24 hours. |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | yes | e.g. staging |
Returns
201withV1Environment.
curl -X POST "https://api.naijacloud.com/v1/projects/$PROJECT_ID/environments" \
-H "Authorization: Bearer $NC_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name":"staging"}'Types
V1Environment
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
projectId | string (uuid) | |
name | string | e.g. production |
isPreview | boolean | True for a pull-request preview environment. |
paused | boolean | True while this environment is paused on its own. A paused project stops it too without setting this. |
pausedAt | string (date-time), or null | |
createdAt | string (date-time) | |
updatedAt | string (date-time) |
V1EnvironmentDetail
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
projectId | string (uuid) | |
name | string | e.g. production |
isPreview | boolean | True for a pull-request preview environment. |
paused | boolean | True while this environment is paused on its own. A paused project stops it too without setting this. |
pausedAt | string (date-time), or null | |
createdAt | string (date-time) | |
updatedAt | string (date-time) | |
kind | DEV, UAT, PROD, or null | DEV, UAT or PROD when the name is exactly that tier (any case); null for a custom name such as "staging". The tier decides which scoped variables apply. |
project | V1EnvironmentProject |
V1EnvironmentProject
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
workspaceId | string (uuid) | |
name | string |