> ## 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 gRPC Settings

> Updates gRPC routing settings for a gRPC API proxy. These settings control gRPC channel behavior including message size limits, keep-alive, and retry configuration.

## Endpoint

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

## 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}
{
  "grpcSettings": {
    "maxInboundMessageSize": 4194304,
    "maxInboundMetadataSize": 8192,
    "keepAliveTime": 60,
    "keepAliveTimeout": 20,
    "keepAliveWithoutCalls": false,
    "channelIdleTimeout": 300,
    "perRpcBufferLimit": 1048576,
    "maxRetryAttempts": 5,
    "maxHedgedAttempts": 2,
    "maxTraceEvents": 24
  },
  "deploy": false,
  "deployTargetEnvironmentNameList": []
}
```

#### Request Body Fields

| Field                           | Type           | Required | Default | Description                                                        |
| ------------------------------- | -------------- | -------- | ------- | ------------------------------------------------------------------ |
| grpcSettings                    | object         | Yes      | -       | gRPC 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) |

#### grpcSettings Fields

| Field                  | Type    | Required | Default        | Description                                             |
| ---------------------- | ------- | -------- | -------------- | ------------------------------------------------------- |
| maxInboundMessageSize  | integer | No       | System default | Maximum size of inbound gRPC messages in bytes          |
| maxInboundMetadataSize | integer | No       | System default | Maximum size of inbound metadata (headers) in bytes     |
| keepAliveTime          | integer | No       | System default | Interval in seconds between keep-alive pings            |
| keepAliveTimeout       | integer | No       | System default | Timeout in seconds for keep-alive ping response         |
| keepAliveWithoutCalls  | boolean | No       | System default | Send keep-alive pings even without active RPCs          |
| channelIdleTimeout     | integer | No       | System default | Close channel after this idle period in seconds         |
| perRpcBufferLimit      | integer | No       | System default | Per-RPC buffer size limit in bytes                      |
| maxRetryAttempts       | integer | No       | System default | Maximum number of retry attempts per RPC                |
| maxHedgedAttempts      | integer | No       | System default | Maximum number of hedged attempts per RPC               |
| maxTraceEvents         | integer | No       | System default | Maximum number of trace events to keep in channel trace |

**Note:** All fields are optional. Only provided fields are updated. Default values are inherited from system settings.

## Response

### Success Response (200 OK)

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

When `deploy=true` is specified:

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

#### Response Fields

| Field                              | Type    | Description                                       |
| ---------------------------------- | ------- | ------------------------------------------------- |
| success                            | boolean | Indicates if the request was successful           |
| deploymentResult                   | object  | Deployment result (only present when deploy=true) |
| deploymentResult.success           | boolean | Overall deployment success                        |
| deploymentResult.deploymentResults | array   | Individual environment deployment results         |

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "API Proxy type is not GRPC"
}
```

### 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: MyGrpcAPI) was not found!"
}
```

## cURL Example

### Example 1: Configure Message Size and Keep-Alive

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyGrpcAPI/settings/grpc/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "grpcSettings": {
      "maxInboundMessageSize": 8388608,
      "maxInboundMetadataSize": 16384,
      "keepAliveTime": 30,
      "keepAliveTimeout": 10,
      "keepAliveWithoutCalls": true
    }
  }'
```

### Example 2: Configure Retry and Hedging

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyGrpcAPI/settings/grpc/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "grpcSettings": {
      "maxRetryAttempts": 3,
      "maxHedgedAttempts": 2,
      "perRpcBufferLimit": 2097152
    }
  }'
```

### Example 3: Configure Channel Idle Timeout

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyGrpcAPI/settings/grpc/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "grpcSettings": {
      "channelIdleTimeout": 600,
      "maxTraceEvents": 48
    }
  }'
```

### Example 4: Save and Deploy

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyGrpcAPI/settings/grpc/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "grpcSettings": {
      "maxInboundMessageSize": 8388608,
      "keepAliveTime": 30
    },
    "deploy": true,
    "deployTargetEnvironmentNameList": ["production"]
  }'
```

## Notes and Warnings

* **gRPC Only**: This endpoint is only applicable to API Proxies with gRPC type. Using it on HTTP/REST proxies will result in an error.
* **Message Size**: `maxInboundMessageSize` limits the size of individual gRPC messages. Increase for large payloads (e.g., file uploads).
* **Keep-Alive**: Keep-alive pings maintain the connection to the backend. `keepAliveWithoutCalls=true` keeps the connection alive even when no RPCs are active.
* **Retry vs Hedging**: Retry attempts are sequential (retry after failure), hedged attempts are parallel (send multiple copies simultaneously).
* **Buffer Limit**: `perRpcBufferLimit` controls how much data can be buffered per RPC — relevant for retries and hedging.
* **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](/api-reference/api-proxies/settings/update-connection-settings) - Update HTTP connection settings
* [Update Routing Addresses](/api-reference/api-proxies/settings/update-routing-addresses) - Update backend routing addresses
* [Get API Proxy](/api-reference/api-proxies/crud/get-api-proxy) - Get API proxy details
