> ## 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 Configuration Guide

> Configure routes with headers, methods, environments, and rate limiting. Intermediate guide.

# Route Configuration Guide

Learn how to configure routes with custom headers, method filtering, and environment-specific settings.

## HTTP Methods

Control which HTTP methods are allowed:

### Allow All Methods

By default, all methods (GET, POST, PUT, PATCH, DELETE) are allowed.

### Restrict Methods

1. Edit your route
2. Under **Allowed Methods**, uncheck methods you want to block
3. Example: Only allow GET and POST

**Use case:** Prevent clients from deleting data (block DELETE)

## Header Injection

Add custom headers to requests sent to your backend:

### Example: Add API Key

```json theme={"dark"}
{
  "X-API-Key": "your-backend-api-key",
  "X-Source": "knoxcall"
}
```

### Example: Add Authentication

```json theme={"dark"}
{
  "Authorization": "Bearer {{secret:stripe_api_key}}"
}
```

*Use `{{secret:secret_name}}` to inject secrets*

## Body Injection

Add data to the request body:

### Example: Add Tenant ID

```json theme={"dark"}
{
  "tenant_id": "12345",
  "source": "knoxcall"
}
```

**Note:** Only works with POST, PUT, PATCH requests

## Path Handling

The request path is **appended verbatim** to the route's target base URL. KnoxCall does not rewrite, strip, or remove any path prefix.

For example, if your target base URL is `https://api.example.com` and a client requests `/api/v1/users/123`, the request is forwarded to:

```text theme={"dark"}
https://api.example.com/api/v1/users/123
```

If the target base URL already includes a path (for example `https://api.example.com/backend`), the client path is appended to it (`https://api.example.com/backend/api/v1/users/123`). Query parameters from the incoming request are preserved.

## Environment Configuration

Set different target URLs per environment:

1. Edit route
2. Scroll to **Environment Configuration**
3. For each environment:
   * **Development**: `http://localhost:3000`
   * **Staging**: `https://staging-api.example.com`
   * **Production**: `https://api.example.com`

Clients specify environment via header:

```http theme={"dark"}
x-knoxcall-environment: production
```

## Rate Limiting

Limit requests per client:

1. Enable **Rate Limiting**
2. Set limits:
   * **Requests**: 100
   * **Window**: 60 (seconds)
   * **Burst**: 120

This allows 100 requests per minute, with bursts up to 120.

## Timeout Settings

Default timeout is 30 seconds. Contact support to adjust.

## Testing Configuration

After making changes:

1. Click **Test Route**
2. Select environment
3. Enter sample request
4. View response

## Need More Help?

* See the Quick Start Guide for basics
* Learn about secrets for secure credential injection
* Check troubleshooting guides for common issues

***

<CardGroup cols={2}>
  <Card title="📊 Statistics" icon="chart-line">
    * **Level**: intermediate
    * **Time**: 10 minutes
  </Card>

  <Card title="🏷️ Tags" icon="tags">
    `routes`, `configuration`, `intermediate`
  </Card>
</CardGroup>
