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

# Update Routing Status

> Updates routing status (enable/disable routing and echo mode) for an API proxy.

## Endpoint

```
PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/routing-status/
```

## Authentication

Requires a Personal API Access Token.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value            | Required |
| ------------- | ---------------- | -------- |
| Authorization | Bearer {token}   | Yes      |
| Content-Type  | application/json | Yes      |

### Path Parameters

| Parameter    | Type   | Required | Description    |
| ------------ | ------ | -------- | -------------- |
| projectName  | string | Yes      | Project name   |
| apiProxyName | string | Yes      | API Proxy name |

### Request Body

#### Full JSON Body Example

```json theme={null}
{
  "routingEnabled": true,
  "echoEnabled": false,
  "deploy": false,
  "deployTargetEnvironmentNameList": []
}
```

#### Request Body Fields

| Field                           | Type           | Required | Default | Description                                                                               |
| ------------------------------- | -------------- | -------- | ------- | ----------------------------------------------------------------------------------------- |
| routingEnabled                  | boolean        | No       | -       | Enable/disable routing to backend                                                         |
| echoEnabled                     | boolean        | No       | -       | Enable/disable echo mode (returns the request as the response without routing to backend) |
| deploy                          | boolean        | No       | false   | If true, deploy the API proxy after saving changes                                        |
| deployTargetEnvironmentNameList | array\[string] | No       | -       | List of environment names to deploy to (required when deploy=true)                        |

**Note:** All fields are optional. Only provided fields are updated.

### Routing

* When `routingEnabled=true`, requests are forwarded to backend
* When `routingEnabled=false`, requests are not forwarded (useful for testing/maintenance)

### Echo Mode

* When `echoEnabled=true`, the gateway returns the incoming request as the response without forwarding to the backend
* Useful for debugging, testing API Proxy policies, and verifying request transformations

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true
}
```

#### Response Fields

| Field   | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| success | boolean | Indicates if the request was successful |

When `deploy=true` is specified:

```json theme={null}
{
  "success": true,
  "deploymentResult": {
    "success": true,
    "deploymentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployment successful"
      }
    ]
  }
}
```

| Field                              | Type    | Description                                        |
| ---------------------------------- | ------- | -------------------------------------------------- |
| deploymentResult                   | object  | Only present when deploy=true                      |
| deploymentResult.success           | boolean | Indicates if the overall deployment was successful |
| deploymentResult.deploymentResults | array   | List of deployment results per environment         |

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Invalid routing status"
}
```

### Error Response (401 Unauthorized)

```json theme={null}
{
  "error": "unauthorized_client",
  "error_description": "Invalid token"
}
```

### Error Response (404 Not Found)

```json theme={null}
{
  "error": "not_found",
  "error_description": "ApiProxy (name: MyAPI) was not found!"
}
```

## cURL Example

### Example 1: Enable Routing

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/routing-status/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingEnabled": true
  }'
```

### Example 2: Enable Echo Mode

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/routing-status/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "echoEnabled": true
  }'
```

### Example 3: Disable Echo Mode and Enable Routing

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/routing-status/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingEnabled": true,
    "echoEnabled": false
  }'
```

### Example 4: Save and Deploy

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/routing-status/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingEnabled": true,
    "echoEnabled": false,
    "deploy": true,
    "deployTargetEnvironmentNameList": ["production"]
  }'
```

## Notes and Warnings

* **Routing Disabled**: When `routingEnabled=false`, requests are not forwarded to backend
* **Echo Mode**: When `echoEnabled=true`, the request is returned as-is as the response — no backend communication occurs
* **Use Cases**:
  * Disable routing for maintenance/testing
  * Enable echo mode for debugging request transformations and policy effects
* **Deploy**: When `deploy=true`, the API proxy is automatically deployed to the specified environments after saving

## Permissions

User must have **`API_MANAGEMENT` + `MANAGE`** permission in the project.

## Related Documentation

* [Update Routing Addresses](/api-reference/api-proxies/settings/update-routing-addresses) - Update routing addresses
* [Update Connection Settings](/api-reference/api-proxies/settings/update-connection-settings) - Update connection settings
* [Get API Proxy](/api-reference/api-proxies/crud/get-api-proxy) - Get API proxy details
