Skip to main content
A binding maps a name you declare in func.toml to an authenticated resource handle, resolved by the runtime — the credential is injected for you and never appears in your code, bundle, or logs. Each binding resolves on the env object (from @telnyx/edge-runtime) — env.MY_TELNYX, env.SECRETS, and so on.
The [telnyx] API binding and telnyx-edge types are TypeScript-only. They rely on the telnyx Node SDK and a generated .d.ts; other runtimes (js, go, python, quarkus) don’t get a typed env handle.

Every binding works the same way

# func.toml — 1. declare
[telnyx]
binding = "MY_TELNYX"
# 2. generate types
telnyx-edge types
// 3. use it — typed and authenticated
import { env } from "@telnyx/edge-runtime";
const { data } = await env.MY_TELNYX.availablePhoneNumbers.list({
  filter: { country_code: "US" },
});
The binding name (MY_TELNYX) is yours to choose; it becomes the property on env.
The SDK types .data as T | undefined for list calls. Under tsc --strict, indexing into data (e.g. data.length) fails with TS18048: 'data' is possibly 'undefined'. Coalesce before use: const arr = list.data ?? [];.

Manifest: func.toml or telnyx.toml

Bindings are declared in your project manifest. telnyx-edge types reads either form and writes telnyx-env.d.ts, typing env.<binding> for each declared binding.
  • func.toml (classic) — the standard [edge_compute] project file. Declare [telnyx] and [[secrets]] bindings in it.
  • telnyx.toml (umbrella) — a manifest with top-level name and main that declares the same [telnyx] and [[secrets]] bindings.
# telnyx.toml — umbrella manifest
name = "my-app"
main = "src/index.ts"

[telnyx]
binding = "MY_TELNYX"

[[secrets]]
binding = "GREETING"
name    = "DEMO_GREETING"

Catalogue

BindingDeclareFor
Telnyx API[telnyx]Voice, Messaging, Numbers — the Telnyx API
Secrets[[secrets]]Your own credentials and config
Key-Value[storage.kv.<name>]Low-latency key/value storage

Bindings vs secrets

  • Binding — a Telnyx or platform resource, authenticated for you (env.MY_TELNYX).
  • Secret — a value you supply (env.SECRETS.get("STRIPE_KEY")).
Use a binding for platform resources; use a secret for your own third-party credentials.