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

# Overview

> The KV Runtime API — the KvNamespace binding surface exported from @telnyx/edge-runtime, plus its get/put/list option and result types.

<Note>
  The types in this reference are exported from `@telnyx/edge-runtime` (TypeScript) and describe version **≥ 0.2.2** — the first release where `expirationTtl` is applied and `list()` entries carry `sizeBytes`/`updatedAt`. They describe the [`env` binding](/docs/edge-compute/kv/quick-start#path-a-the-function-binding) — the in-function surface. To read or write KV from another language or outside a function, use the [REST API](/docs/edge-compute/kv/quick-start#path-b-the-rest-api).
</Note>

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

| Surface                                                                                                     | Where it lives            | What it's for                                                                        |
| ----------------------------------------------------------------------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------ |
| [`KvNamespace`](/docs/edge-compute/kv/reference/kv-namespace)                                               | `env.<BINDING>`           | The binding handle — `get`, `put`, `delete`, `list`.                                 |
| [`KvGetTextOptions` / `KvGetJsonOptions`](/docs/edge-compute/kv/reference/kv-namespace#get-key-options)     | `get()` options           | Select the raw-text read or a `JSON.parse`d read.                                    |
| [`KvPutOptions`](/docs/edge-compute/kv/reference/kv-namespace#put-key-value-options)                        | `put()` options           | `expirationTtl` — server-side TTL in seconds (`metadata` is deprecated and ignored). |
| [`KvListOptions` / `KvListResult` / `KvKeyInfo`](/docs/edge-compute/kv/reference/kv-namespace#list-options) | `list()` options + result | Prefix, pagination cursor, and the returned key entries.                             |

## Getting the Binding

```ts theme={null}
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](/docs/edge-compute/kv/quick-start#path-a-the-function-binding). 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.

## Related Resources

* [`KvNamespace`](/docs/edge-compute/kv/reference/kv-namespace) — the method-by-method reference
* [Bindings](/docs/edge-compute/runtime/bindings) — how bindings resolve on `env`
* [REST API](/docs/edge-compute/kv/quick-start#path-b-the-rest-api) — the same operations over HTTP
* [Key Expiration](/docs/edge-compute/kv/ttl-and-metadata) — server-side TTL via `expirationTtl`, `ttl_secs`, or `--ttl`
