Update WebSocket Settings
Endpoint
PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/websocket/
This endpoint returns HTTP 400 for API proxies with type=AI. In earlier releases it returned 200 OK but had no effect (a silent no-op) — this is a behavior change and existing CI/CD pipelines that call this endpoint against AI proxies may be affected.
The AI proxy runtime does not read the classic routing object; the equivalent configuration lives under aiRouting. Use Update AI Routing instead.
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
{
"websocketSettings": {
"connectionLostTimeout": 60,
"reuseAddr": true,
"connectTimeout": 30,
"maxRetries": 3,
"retryDelay": 1000,
"autoReconnect": true,
"autoReconnectMaxRetries": 5,
"autoReconnectRetryDelay": 2000
},
"deploy": false,
"deployTargetEnvironmentNameList": []
}
Request Body Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| websocketSettings | object | Yes | - | WebSocket settings object (see fields below) |
| 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) |
websocketSettings Fields
Only the fields present in websocketSettings are applied. An omitted field (or one sent as null) keeps its stored value, so a call that lengthens the connect timeout never resets the seven others — auto-reconnect included. The Default column below is what these settings start with the first time they are saved — inherited from system settings — not what an omitted field falls back to on update. An explicit 0 or false is applied as sent. Unrecognised fields are ignored, so a client that reads the object and posts the whole thing back keeps working unchanged.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| connectionLostTimeout | integer | No | System default | Timeout in seconds before a connection is considered lost |
| reuseAddr | boolean | No | System default | Enable socket address reuse (SO_REUSEADDR) |
| connectTimeout | integer | No | System default | WebSocket connection timeout in seconds |
| maxRetries | integer | No | System default | Maximum number of initial connection retry attempts |
| retryDelay | integer | No | System default | Delay between initial connection retries in milliseconds |
| autoReconnect | boolean | No | System default | Enable automatic reconnection after connection loss |
| autoReconnectMaxRetries | integer | No | System default | Maximum number of auto-reconnect attempts |
| autoReconnectRetryDelay | integer | No | System default | Delay between auto-reconnect attempts in milliseconds |
Note: All fields are optional. Only the fields you send are updated; every field you leave out keeps its stored value. The defaults above are inherited from system settings and apply the first time these settings are saved.
Response
Success Response (200 OK)
{
"success": true
}
When deploy=true is specified:
{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the settings update was successful |
| deploymentResult | object | Deployment result (only present when deploy=true) |
| deploymentResult.success | boolean | Whether all deployments were successful |
| deploymentResult.deploymentResults | array | Per-environment deployment results |
| deploymentResult.deploymentResults[].environmentName | string | Name of the target environment |
| deploymentResult.deploymentResults[].success | boolean | Whether deployment to this environment succeeded |
| deploymentResult.deploymentResults[].message | string | Deployment status message |
Error Response (400 Bad Request)
{
"status": "FAILURE",
"resultMessage": "API Proxy type is not WEBSOCKET"
}
Error Response (401 Unauthorized)
{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}
cURL Example
Example 1: Configure Connection and Auto-Reconnect
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyWebSocketAPI/settings/websocket/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"websocketSettings": {
"connectionLostTimeout": 120,
"connectTimeout": 30,
"autoReconnect": true,
"autoReconnectMaxRetries": 10,
"autoReconnectRetryDelay": 3000
}
}'
Example 2: Configure Retry Settings
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyWebSocketAPI/settings/websocket/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"websocketSettings": {
"maxRetries": 5,
"retryDelay": 2000,
"reuseAddr": true
}
}'
Example 3: Disable Auto-Reconnect
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyWebSocketAPI/settings/websocket/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"websocketSettings": {
"autoReconnect": false
}
}'
Example 4: Save and Deploy
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyWebSocketAPI/settings/websocket/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"websocketSettings": {
"connectionLostTimeout": 120,
"connectTimeout": 30,
"autoReconnect": true
},
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
}'
Example 5: Change One Field (Partial Update)
Only the field in the body is written. autoReconnect, the retry counters and
connectionLostTimeout are left exactly as they were.
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/websocket/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"websocketSettings": {
"connectTimeout": 30
}
}'
Notes and Warnings
- WebSocket Only: This endpoint is only applicable to API Proxies with WebSocket type. Using it on HTTP/REST proxies will result in an error.
- Connection Lost Timeout: If no data is received within this timeout, the connection is considered lost. Set higher for long-lived idle connections.
- Initial Retries vs Auto-Reconnect:
maxRetriesandretryDelaycontrol the initial connection attempt.autoReconnect*settings control reconnection after an established connection is lost. - Retry Delay: Both
retryDelayandautoReconnectRetryDelayare in milliseconds. - Socket Reuse:
reuseAddr=trueallows reusing the socket address, which is useful in high-connection environments. - System Defaults: When a field is not set, the value is inherited from system-level settings.
- 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 - Update HTTP connection settings
- Update Routing Addresses - Update backend routing addresses
- Get API Proxy - Get API proxy details