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

# handleRpc()

> **handleRpc**(`req`, `method?`): `Promise`\<`Response`>

Dispatch one RPC over POST (see the class doc for the URL contract). The
request body is the argument list: a plain JSON array, or the SDK codec's
encoded form of one (`{"json": […], …}`) when rich values need to
round-trip. The answer is the `result` or `error` frame — the same frame
a WebSocket caller would receive — with the HTTP status mapped from the
error code (the code strings themselves are unchanged).

The call runs through the socket server's own gates, in bootstrap order
— `onConnect`, `authorize` (`Authorization: Bearer` preferred, `token`
query parameter otherwise), `onAttach`, then the `"rpc"` claim gate —
but it holds NO connection: no snapshot source is read for it, it is
never counted as a watcher, and broadcasts never reach it. A gate that
refuses the call answers exactly like a refused connection (see the
class doc's rejection shapes).

**Parameters**

| Parameter | Type | Description |
| - | - | - |
| `req` | `Request` | The inbound POST request. |
| `method?` | `string` | The method name; parsed from a trailing `/rpc/<method>` path segment when omitted. |

**Returns**

`Promise`\<`Response`>

The call's answer frame as JSON.
