Skip to main content
The types in this reference are exported from @telnyx/edge-runtime (TypeScript) and require version ≥ 0.2.1. They describe the env binding — the in-function surface. To read or write KV from another language or outside a function, use the REST API.
The KV Runtime API is a single binding type and the small set of option/result types its methods take. A namespace declared as [storage.kv.<NAME>] in func.toml resolves on env.<NAME> as a KvNamespace.
SurfaceWhere it livesWhat it’s for
KvNamespaceenv.<BINDING>The binding handle — get, put, delete, list.
KvGetTextOptions / KvGetJsonOptionsget() optionsSelect the raw-text read or a JSON.parsed read.
KvPutOptionsput() optionsexpirationTtl / metadata — accepted for forward compatibility, not yet applied.
KvListOptions / KvListResult / KvKeyInfolist() options + resultPrefix, pagination cursor, and the returned key entries.

Getting the Binding

import { env } from "@telnyx/edge-runtime";

// env.MY_KV is a KvNamespace, from [storage.kv.MY_KV] in func.toml
await env.MY_KV.put("greeting", "hello");
const greeting = await env.MY_KV.get("greeting"); // "hello"
Declaring the binding is covered in the Quick Start. The binding resolves at runtime from func.toml, but the released CLI doesn’t yet generate KV types — declare env.<NAME> as a KvNamespace yourself with a .d.ts augmentation (shown in the Quick Start) until KV type generation ships.
  • KvNamespace — the method-by-method reference
  • Bindings — how bindings resolve on env
  • REST API — the same operations over HTTP
  • Key Expiration — application-level TTL, since expirationTtl is not yet applied