Skip to main content
A rate limiter binding caps how many requests a key can make during a fixed window. Your function chooses the key—for example, an authenticated user ID, tenant ID, or hashed API-key identifier—and decides how to respond when the budget is exhausted. Rate limiters are available to JavaScript and TypeScript functions in either project shape. In a telnyx.toml project the binding arrives on the handler’s env argument as env.<NAME>; in a func.toml project reach it with import { env } from "@telnyx/edge-runtime". You don’t create a KV namespace or manage counter storage. Start with the Quick Start to add a rate limiter to a function and test it in production.

Configuration reference

The period is an integer, not a duration string: use period = 60, not period = "60s". Configuration changes take effect after the next telnyx-edge ship.

Multiple rate limiters

Each [[ratelimits]] block has an independent counter namespace. This lets one function apply different budgets to different plans or operations:
Derive both userId and tier from authenticated, trusted application state. A caller-controlled header or query parameter lets a client choose a fresh key and bypass its intended budget.

Choose keys carefully

Avoid putting secrets or other sensitive values directly in a key.

Behavior and limitations

  • Quick Start — Configure, deploy, and test a rate limiter
  • API reference — Runtime method inputs, return values, and failure behavior
  • Bindings — How runtime resource handles are declared and resolved
  • Configuration — The complete telnyx.toml reference
  • Deploy a function — Ship configuration and code changes