> ## 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 API Proxy from File

> Updates an existing API proxy by re-parsing an OpenAPI (Swagger), WSDL specification from an uploaded file, or updates a reverse proxy. The API proxy can be automatically deployed to specified environments after update. For WSDLs with many XSDs, use a ZIP file.

## Endpoint

```
PUT /apiops/projects/{projectName}/apiProxies/file/
```

## Authentication

Requires a Personal API Access Token.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value               | Required |
| ------------- | ------------------- | -------- |
| Authorization | Bearer {token}      | Yes      |
| Content-Type  | multipart/form-data | Yes      |

### Path Parameters

| Parameter   | Type   | Required | Description  |
| ----------- | ------ | -------- | ------------ |
| projectName | string | Yes      | Project name |

### Form Data

| Field    | Type          | Required | Description                                                                    |
| -------- | ------------- | -------- | ------------------------------------------------------------------------------ |
| metadata | string (JSON) | Yes      | JSON string containing API proxy metadata                                      |
| specFile | file          | Yes      | Specification file (OpenAPI/Swagger/WSDL) or ZIP file for WSDLs with many XSDs |

### Request Body (metadata JSON)

#### Full JSON Body Example - Update OpenAPI

```json theme={null}
{
  "apiProxyName": "petstore-api",
  "apiProxyDescription": "Updated Petstore API Proxy",
  "apiProxyCreationType": "OPEN_API",
  "clientRoute": {
    "relativePathList": ["/api/v1"],
    "hostList": ["api.example.com"],
    "methodList": ["GET", "POST", "PUT", "DELETE"],
    "headerList": [],
    "bufferRequest": true,
    "bufferResponse": true
  },
  "routingInfo": {
    "routingAddressList": [
      {
        "address": "https://backend.example.com",
        "weight": 100,
        "soapType": "SOAP11"
      }
    ],
    "loadBalanceAlgorithm": "ROUND_ROBIN",
    "connectTimeout": 30,
    "readTimeout": 60,
    "retryCount": 3,
    "failoverRetryCount": 2,
    "ignoreRoutingError": false
  },
  "deploy": false,
  "deployTargetEnvironmentNameList": ["production"],
  "reParse": true,
  "soapToRest": false,
  "enableWSA": false,
  "enableWSRM": false,
  "backendApiVersion": "v2",
  "maintenanceModeSetting": {
    "enabled": false,
    "httpStatusCode": 503,
    "contentType": "application/json",
    "message": "Service is under maintenance"
  }
}
```

#### Full JSON Body Example - Update WSDL

```json theme={null}
{
  "apiProxyName": "soap-service",
  "apiProxyDescription": "Updated SOAP Service",
  "apiProxyCreationType": "WSDL",
  "clientRoute": {
    "relativePathList": ["/soap"],
    "hostList": ["soap.example.com"],
    "methodList": [],
    "headerList": [],
    "bufferRequest": true,
    "bufferResponse": true
  },
  "routingInfo": {
    "routingAddressList": [
      {
        "address": "https://backend.example.com/soap",
        "weight": 100,
        "soapType": "SOAP11"
      }
    ],
    "loadBalanceAlgorithm": "ROUND_ROBIN",
    "connectTimeout": 30,
    "readTimeout": 60,
    "retryCount": 3,
    "failoverRetryCount": 2,
    "ignoreRoutingError": false
  },
  "deploy": false,
  "deployTargetEnvironmentNameList": ["production"],
  "reParse": true,
  "soapToRest": false,
  "enableWSA": true,
  "enableWSRM": false,
  "backendApiVersion": null,
  "maintenanceModeSetting": {
    "enabled": false,
    "httpStatusCode": 503,
    "contentType": "text/xml",
    "message": "Service is under maintenance"
  }
}
```

#### Request Body Fields

| Field                           | Type    | Required | Default | Description                                                                                                                   |
| ------------------------------- | ------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
| apiProxyName                    | string  | Yes      | -       | API Proxy name (must exist for update)                                                                                        |
| apiProxyDescription             | string  | No       | -       | API Proxy description (if empty, keeps existing description)                                                                  |
| apiProxyCreationType            | string  | Yes      | -       | API creation type. Must match existing API Proxy type. See [EnumApiProxySpecType](#enumapiproxyspectype-apiproxycreationtype) |
| clientRoute                     | object  | Yes      | -       | Client route configuration. See [ClientRoute](#clientroute-clientroute)                                                       |
| routingInfo                     | object  | No       | -       | Routing configuration. See [RoutingInfo](#routinginfo-routinginfo)                                                            |
| deploy                          | boolean | No       | false   | Whether to deploy after update                                                                                                |
| deployTargetEnvironmentNameList | array   | No       | \[]     | List of environment names to deploy to                                                                                        |
| reParse                         | boolean | No       | true    | Whether to reparse API proxy (should be true for update)                                                                      |
| soapToRest                      | boolean | No       | false   | Enable SOAP to REST transformation (cannot be changed if not set initially)                                                   |
| enableWSA                       | boolean | No       | false   | Enable WS-Addressing (SOAP only)                                                                                              |
| enableWSRM                      | boolean | No       | false   | Enable WS-ReliableMessaging (SOAP only)                                                                                       |
| backendApiVersion               | string  | No       | -       | Backend API version                                                                                                           |
| maintenanceModeSetting          | object  | No       | -       | Maintenance mode settings. See [MaintenanceModeSetting](#maintenancemodesetting-maintenancemodesetting)                       |

### EnumApiProxySpecType (apiProxyCreationType)

* `OPEN_API` - OpenAPI 3.0 specification
* `SWAGGER` - Swagger 2.0 specification
* `WSDL` - WSDL specification (SOAP)
* `REVERSE_PROXY` - Reverse proxy (no specification)

### ClientRoute (clientRoute)

| Field            | Type    | Required | Description                                                           |
| ---------------- | ------- | -------- | --------------------------------------------------------------------- |
| relativePathList | array   | Yes      | List of relative paths (at least one required, first cannot be empty) |
| hostList         | array   | No       | List of host names                                                    |
| methodList       | array   | No       | List of HTTP methods (for REST)                                       |
| headerList       | array   | No       | List of headers                                                       |
| bufferRequest    | boolean | No       | Buffer request body                                                   |
| bufferResponse   | boolean | No       | Buffer response body                                                  |

### RoutingInfo (routingInfo)

| Field                | Type    | Required | Description                                                                                                 |
| -------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| routingAddressList   | array   | No       | List of routing addresses. See [RoutingAddress](#routingaddress-routinginforoutingaddresslist-item)         |
| loadBalanceAlgorithm | string  | No       | Load balancing algorithm. See [EnumRoutingAlgorithm](#enumroutingalgorithm-routinginfoloadbalancealgorithm) |
| connectTimeout       | integer | No       | Connection timeout in seconds                                                                               |
| readTimeout          | integer | No       | Read timeout in seconds                                                                                     |
| retryCount           | integer | No       | Number of retries                                                                                           |
| failoverRetryCount   | integer | No       | Number of failover retries                                                                                  |
| ignoreRoutingError   | boolean | No       | Ignore routing errors                                                                                       |

### RoutingAddress (routingInfo.routingAddressList item)

| Field    | Type    | Required | Description                              |
| -------- | ------- | -------- | ---------------------------------------- |
| address  | string  | Yes      | Backend server address                   |
| weight   | integer | No       | Routing weight (for load balancing)      |
| soapType | string  | No       | SOAP type (SOAP11, SOAP12) for SOAP APIs |

### EnumRoutingAlgorithm (routingInfo.loadBalanceAlgorithm)

* `ROUND_ROBIN` - Round-robin load balancing
* `WEIGHTED_ROUND_ROBIN` - Weighted round-robin
* `LEAST_CONNECTIONS` - Least connections
* `RANDOM` - Random selection

### MaintenanceModeSetting (maintenanceModeSetting)

| Field          | Type    | Required | Description                               |
| -------------- | ------- | -------- | ----------------------------------------- |
| enabled        | boolean | No       | Whether maintenance mode is enabled       |
| httpStatusCode | integer | No       | HTTP status code for maintenance response |
| contentType    | string  | No       | Content type for maintenance response     |
| message        | string  | No       | Maintenance message                       |

### Notes

* `apiProxyName` must exist (API Proxy will be updated, not created).
* `apiProxyCreationType` must match the existing API Proxy type (cannot change type).
* `specFile` must be provided (multipart file upload).
* For WSDLs with many XSDs, use a ZIP file containing all files.
* `clientRoute.relativePathList` must contain at least one path, and the first path cannot be empty.
* `reParse: true` is recommended for updates to reparse the specification.
* `soapToRest` cannot be enabled if the API Proxy was not created with this option initially.
* If `apiProxyDescription` is empty, the existing description is preserved.
* `routingInfo` is optional; if not provided, existing routing settings are preserved.

## Response

### Success Response (200 OK)

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

## cURL Example

```bash theme={null}
curl -X PUT \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/file/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "metadata={\"apiProxyName\":\"petstore-api\",\"apiProxyCreationType\":\"OPEN_API\",\"clientRoute\":{\"relativePathList\":[\"/api/v1\"]},\"reParse\":true};type=application/json" \
  -F "specFile=@swagger.json"
```

## Notes and Warnings

* **Update vs Create**:
  * This endpoint updates an existing API Proxy (identified by `apiProxyName`)
  * If API Proxy does not exist, it will be created
  * Use this endpoint to reparse and update API Proxy from specification file
* **Type Restrictions**:
  * `apiProxyCreationType` must match the existing API Proxy type
  * Cannot change from SOAP to REST or vice versa
  * Cannot enable `soapToRest` if not enabled initially
* **File Upload**:
  * Use `multipart/form-data` content type
  * `specFile` parameter contains the specification file
  * For WSDLs with many XSDs, use ZIP file containing all files
  * Supported formats: JSON (OpenAPI/Swagger), XML (WSDL), ZIP (WSDL with XSDs)
* **Reparsing**:
  * `reParse: true` re-parses the specification and updates endpoints
  * Existing endpoints may be modified or removed if specification changes
  * Policies and settings are preserved during reparse
* **Client Route**:
  * `clientRoute.relativePathList` must contain at least one path
  * First path in the list cannot be empty
  * Hosts, methods, and headers are optional
* **Routing**:
  * `routingInfo` is optional
  * If not provided, existing routing settings are preserved
  * Can update routing addresses, load balancing, and timeouts
* **Deployment**:
  * Set `deploy: true` to automatically deploy after update
  * Specify `deployTargetEnvironmentNameList` for target environments
  * Requires `API_MANAGEMENT` + `DEPLOY_UNDEPLOY` permission if deploying

## Permissions

User must have **`API_MANAGEMENT` + `MANAGE`** permission in the project. For deployment operations (when `deploy: true` is set), user must also have **`API_MANAGEMENT` + `DEPLOY_UNDEPLOY`** permission.

## Related Documentation

* [Create API Proxy from File](/api-reference/api-proxies/crud/create-api-proxy-from-file) - Create new API Proxy from file
* [Update API Proxy](/api-reference/api-proxies/crud/update-api-proxy) - Update API Proxy metadata
* [Deploy API Proxy](/api-reference/api-proxies/deployment/deploy-api-proxy) - Deploy API Proxy to environments
