> ## 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 Addresses

> Updates routing addresses (backend endpoints) for an API proxy. Routing addresses define where API requests are forwarded.

## Endpoint

```
PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/addresses/
```

## 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}
{
  "routingAddressList": [
    {
      "address": "https://backend1.example.com",
      "description": "Primary backend server",
      "weight": 100,
      "addressType": "PRIMARY",
      "healthCheckPath": "/health",
      "healthMonitoringEnabled": true
    },
    {
      "address": "https://backend2.example.com",
      "description": "Secondary backend server",
      "weight": 50,
      "addressType": "PRIMARY",
      "healthCheckPath": "/health",
      "healthMonitoringEnabled": true
    },
    {
      "address": "https://failover.example.com",
      "description": "Failover backend",
      "addressType": "FAILOVER_ONLY"
    }
  ],
  "deploy": false,
  "deployTargetEnvironmentNameList": []
}
```

#### Request Body Fields

The request body is an object containing an array of routing address objects.

### Routing Address Object

| Field                   | Type    | Required | Default | Description                                                                     |
| ----------------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------- |
| address                 | string  | Yes      | -       | Backend address URL                                                             |
| description             | string  | No       | -       | Description for this backend address                                            |
| weight                  | integer | No       | 1       | Load balancing weight (required if loadBalanceAlgorithm=WEIGHTED)               |
| soapType                | string  | No\*     | SOAP11  | SOAP version (required if API type is SOAP)                                     |
| addressType             | string  | No       | PRIMARY | Address type. See [EnumRoutingAddressType](#enumroutingaddresstype)             |
| healthCheckPath         | string  | No       | -       | Active health check path for this backend (only for PRIMARY and FAILOVER\_ONLY) |
| healthMonitoringEnabled | boolean | No       | -       | Enable per-address health monitoring (only for HTTP type)                       |

### EnumRoutingAddressType

* `PRIMARY` - Primary backend address (default, used for normal traffic)
* `CANARY` - Canary release address (receives a percentage of traffic)
* `MIRROR` - Mirror address (receives a copy of traffic for testing)
* `FAILOVER_ONLY` - Failover-only address (used only when primary backends are unavailable)

### EnumSoapApiPortType

* `SOAP11` - SOAP 1.1
* `SOAP12` - SOAP 1.2

### Request Body Object

| Field                           | Type           | Required | Description                                                         |
| ------------------------------- | -------------- | -------- | ------------------------------------------------------------------- |
| routingAddressList              | array          | Yes      | Array of routing address objects                                    |
| deploy                          | boolean        | No       | If true, deploy the API proxy after saving changes (default: false) |
| deployTargetEnvironmentNameList | array\[string] | No       | List of environment names to deploy to (required when deploy=true)  |

### Note

* Request body must be an object with `routingAddressList` array
* For REST APIs, `soapType` is not required
* For SOAP APIs, `soapType` defaults to `SOAP11` if not provided
* Weight is used when load balancing algorithm is `WEIGHTED`

## 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 | Overall deployment success status  |
| deploymentResult.deploymentResults | array   | Per-environment deployment results |

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Address is required"
}
```

### 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: Update REST API Backend Addresses

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/addresses/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingAddressList": [
      {
        "address": "https://backend1.example.com",
        "description": "Primary datacenter",
        "weight": 100
      },
      {
        "address": "https://backend2.example.com",
        "description": "Secondary datacenter",
        "weight": 50
      }
    ]
  }'
```

### Example 2: Configure Primary and Failover Addresses with Health Check

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/addresses/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingAddressList": [
      {
        "address": "https://primary.example.com",
        "description": "Primary backend",
        "addressType": "PRIMARY",
        "healthCheckPath": "/actuator/health",
        "healthMonitoringEnabled": true
      },
      {
        "address": "https://failover.example.com",
        "description": "Failover backend",
        "addressType": "FAILOVER_ONLY",
        "healthCheckPath": "/actuator/health",
        "healthMonitoringEnabled": true
      }
    ]
  }'
```

### Example 3: Configure Mirror Address for Traffic Testing

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/addresses/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingAddressList": [
      {
        "address": "https://production.example.com",
        "addressType": "PRIMARY"
      },
      {
        "address": "https://staging.example.com",
        "description": "Mirror for testing",
        "addressType": "MIRROR"
      }
    ]
  }'
```

### Example 4: Update SOAP API Backend Addresses

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/addresses/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingAddressList": [
      {
        "address": "https://soap-backend.example.com/Service",
        "weight": 100,
        "soapType": "SOAP11"
      },
      {
        "address": "https://soap-backend2.example.com/Service",
        "weight": 50,
        "soapType": "SOAP12"
      }
    ]
  }'
```

### Example 5: Save and Deploy

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/addresses/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "routingAddressList": [
      {
        "address": "https://backend.example.com",
        "description": "Primary backend",
        "addressType": "PRIMARY"
      }
    ],
    "deploy": true,
    "deployTargetEnvironmentNameList": ["production"]
  }'
```

## Notes and Warnings

* **Request Body Format**: Request body must be an object with `routingAddressList` array
* **Address Format**: Must be a valid URL (http\:// or https\://)
* **Weight**: Used for weighted load balancing (higher weight = more traffic)
* **SOAP Type**: Required for SOAP APIs, defaults to `SOAP11` if not provided
* **Empty Array**: Empty array removes all routing addresses (routing will fail)
* **Load Balancing**: Configure load balancing algorithm separately (via routing settings)
* **Address Types**: Use `FAILOVER_ONLY` for disaster recovery backends, `MIRROR` for shadow traffic testing, `CANARY` for gradual rollout
* **Health Check**: `healthCheckPath` defines the endpoint the gateway calls to verify backend health. Only applicable for `PRIMARY` and `FAILOVER_ONLY` addresses.
* **Description**: Use `description` to document the purpose of each backend address
* **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 Connection Settings](/api-reference/api-proxies/settings/update-connection-settings) - Update connection settings
* [Update Routing Status](/api-reference/api-proxies/settings/update-routing-status) - Update routing status
* [Get API Proxy](/api-reference/api-proxies/crud/get-api-proxy) - Get API proxy details
