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

# API Reference

> The Telnyx API binding is a pre-authenticated client handle — discover its resources and methods through generated types or the client method reference.

`env.MY_TELNYX` is a ready-to-use, authenticated Telnyx client handle — call it like any Telnyx API client, with auth already wired in (no `new Telnyx(...)`, no API key to manage). Calls take the shape `env.MY_TELNYX.<resource>.<method>(...)`, using resource and method names — not raw HTTP paths:

* `<resource>` — a camelCase property: `messages`, `calls`, `balance`, `availablePhoneNumbers`, …
* `<method>` — a method on the resource: `.send`, `.dial`, `.list`, `.retrieve`, …

The names don't always track the HTTP API (`messages.send` is `POST /messages`, but `messages.cancelScheduled` is `DELETE /messages/{id}`), so discover them rather than guessing from endpoints:

* **Autocomplete** — after [`telnyx-edge types`](/docs/edge-compute/telnyx-api/quick-start), your editor completes `env.MY_TELNYX.` with every resource and method.
* **[Client method reference (`api.md`)](https://github.com/team-telnyx/telnyx-node/blob/master/api.md)** — lists every `<resource>.<method>(...)` and the endpoint it maps to.
* **[HTTP API reference](/api-reference)** — endpoint parameters and behavior.

```ts theme={null}
import { env } from "@telnyx/edge-runtime";

await env.MY_TELNYX.messages.send({ from: "+13125550100", to: "+13125550101", text: "Hello" }); // POST /messages
await env.MY_TELNYX.calls.dial({ connection_id: "2985…", from: "+13125550100", to: "+13125550101" }); // POST /calls
await env.MY_TELNYX.availablePhoneNumbers.list({ filter: { country_code: "US" } });               // GET /available_phone_numbers
await env.MY_TELNYX.balance.retrieve();                                                            // GET /balance
```

Each method returns the API response; list and retrieve calls expose the payload on `.data`.

## Errors

Calls reject on API errors. Catch and inspect:

```ts theme={null}
try {
  await env.MY_TELNYX.messages.send({ from: "+13125550100", to: "+13125550101", text: "Hello" });
} catch (err) {
  // err.status (e.g. 400), err.message, err.error (parsed body)
}
```
