> ## Documentation Index
> Fetch the complete documentation index at: https://docs.knoxcall.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Route Environments

> List, set, and delete environment-specific configuration overrides for a route

## List Route Environments

```text theme={"dark"}
GET /v1/routes/:id/environments
```

Returns all environment-specific configuration overrides for a route.

### Path Parameters

| Parameter | Type | Description  |
| --------- | ---- | ------------ |
| `id`      | uuid | The route ID |

### Response

```json theme={"dark"}
{
  "data": [
    {
      "environment_name": "staging",
      "target_base_url": "https://api-staging.stripe.com/v1",
      "inject_headers_json": {},
      "inject_body_json": {},
      "require_signature": false,
      "signature_tolerance_sec": null,
      "rate_limit_enabled": false,
      "rate_limit_requests": null,
      "rate_limit_window_sec": null,
      "rate_limit_burst": null,
      "allowed_methods": null
    }
  ],
  "meta": { "request_id": "550e8400-e29b-41d4-a716-446655440000" }
}
```

### Errors

| Status | Type        | Description     |
| ------ | ----------- | --------------- |
| 404    | `not_found` | Route not found |

***

## Set Route Environment Override

```text theme={"dark"}
PUT /v1/routes/:id/environments/:env
```

Creates or replaces the environment-specific configuration for a route. This lets you point the same route at a different upstream URL, inject different headers, or apply different rate limits per environment.

### Path Parameters

| Parameter | Type   | Description                                       |
| --------- | ------ | ------------------------------------------------- |
| `id`      | uuid   | The route ID                                      |
| `env`     | string | Environment name (e.g., `staging`, `development`) |

### Request Body

All fields are optional. Only provided fields will override the base route configuration for this environment.

| Field                     | Type      | Description                    |
| ------------------------- | --------- | ------------------------------ |
| `target_base_url`         | string    | Override upstream URL          |
| `inject_headers_json`     | object    | Override injected headers      |
| `inject_body_json`        | object    | Override injected body fields  |
| `require_signature`       | boolean   | Override signature requirement |
| `signature_tolerance_sec` | number    | Override signature tolerance   |
| `rate_limit_enabled`      | boolean   | Override rate limiting         |
| `rate_limit_requests`     | number    | Override max requests          |
| `rate_limit_window_sec`   | number    | Override window duration       |
| `rate_limit_burst`        | number    | Override burst allowance       |
| `allowed_methods`         | string\[] | Override allowed HTTP methods  |

### Response

Returns the environment config object.

### Errors

| Status | Type               | Description              |
| ------ | ------------------ | ------------------------ |
| 400    | `validation_error` | Invalid environment name |
| 404    | `not_found`        | Route not found          |

***

## Delete Route Environment Override

```text theme={"dark"}
DELETE /v1/routes/:id/environments/:env
```

Removes the environment-specific override, reverting the route to its base configuration for that environment.

### Path Parameters

| Parameter | Type   | Description      |
| --------- | ------ | ---------------- |
| `id`      | uuid   | The route ID     |
| `env`     | string | Environment name |

### Response

```json theme={"dark"}
{
  "data": { "deleted": true },
  "meta": { "request_id": "550e8400-e29b-41d4-a716-446655440000" }
}
```

### Errors

| Status | Type        | Description                           |
| ------ | ----------- | ------------------------------------- |
| 404    | `not_found` | Route or environment config not found |
