Skip to main content
Environments let you maintain separate configurations for the same routes and secrets across stages like production, staging, and development. Each environment can override a route’s target URL, injected headers, rate limits, and more.
Every tenant starts with a default production environment. You can create additional environments based on your subscription plan.

List Environments

GET /v1/environments
Returns all environments for your tenant (not paginated — returns the full list).

Response

{
  "data": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "production",
      "display_name": "Production",
      "description": "Live production environment",
      "color": "#22c55e",
      "is_default": true,
      "created_at": "2026-01-01T00:00:00.000Z"
    },
    {
      "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "name": "staging",
      "display_name": "Staging",
      "description": "Pre-production testing",
      "color": "#f59e0b",
      "is_default": false,
      "created_at": "2026-01-15T10:00:00.000Z"
    }
  ],
  "meta": { "request_id": "550e8400-e29b-41d4-a716-446655440000" }
}
curl https://api.knoxcall.com/v1/environments \
  -H "Authorization: Bearer tk_live_abc123..."

Create Environment

POST /v1/environments
Creates a new environment.

Request Body

FieldTypeRequiredDescription
namestringYesMachine-friendly name. Must match ^[a-z0-9_-]+$ (lowercase alphanumeric, hyphens, underscores)
display_namestringNoHuman-friendly display name
descriptionstringNoDescription of the environment
colorstringNoHex color code for the UI (defaults to #6366f1)
is_defaultbooleanNoWhether this is the default environment (defaults to false)

Response

Returns the created environment object.
curl -X POST https://api.knoxcall.com/v1/environments \
  -H "Authorization: Bearer tk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "staging",
    "display_name": "Staging",
    "description": "Pre-production testing",
    "color": "#f59e0b"
  }'

Errors

StatusTypeDescription
400validation_errorInvalid name format or missing required field
403plan_limitEnvironments not available on your plan, or environment limit reached
409conflictAn environment with this name already exists

Update Environment

PATCH /v1/environments/:id
Updates one or more fields on an existing environment.

Path Parameters

ParameterTypeDescription
iduuidThe environment ID

Request Body

All fields are optional. Only provided fields will be updated.
FieldTypeDescription
namestringMachine-friendly name (must match ^[a-z0-9_-]+$)
display_namestringHuman-friendly display name
descriptionstringDescription
colorstringHex color code
is_defaultbooleanSet as default environment

Response

Returns the updated environment object.

Errors

StatusTypeDescription
400validation_errorInvalid name format
404not_foundEnvironment not found
409conflictAn environment with this name already exists

Delete Environment

DELETE /v1/environments/:id
Permanently deletes an environment. You cannot delete the default environment or an environment that is in use by route configurations.

Path Parameters

ParameterTypeDescription
iduuidThe environment ID

Response

{
  "data": { "deleted": true },
  "meta": { "request_id": "550e8400-e29b-41d4-a716-446655440000" }
}

Errors

StatusTypeDescription
400validation_errorCannot delete the default environment
404not_foundEnvironment not found
409in_useEnvironment is used by one or more route configurations