https://api.telnyx.com/v2/storage/kvs
Namespace Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /v2/storage/kvs | Create a new namespace |
| GET | /v2/storage/kvs | List all namespaces |
| GET | /v2/storage/kvs/{id} | Get namespace details |
| DELETE | /v2/storage/kvs/{id} | Delete a namespace |
Key-Value Endpoints
| Method | Endpoint | Description |
|---|---|---|
| PUT | /v2/storage/kvs/{id}/keys/{key} | Write a value |
| GET | /v2/storage/kvs/{id}/keys/{key} | Read a value |
| DELETE | /v2/storage/kvs/{id}/keys/{key} | Delete a key |
| GET | /v2/storage/kvs/{id}/keys | List keys |
Namespace Operations
Create Namespace
Thename may contain only lowercase letters, numbers, and hyphens.
Namespace Status
Poll the namespace until status isprovision_ok:
| Status | Description |
|---|---|
pending | Provisioning in progress |
provision_ok | Ready to use |
provision_failed | Provisioning failed |
deleting | Deletion in progress |
delete_failed | Deletion failed |
deleted | Fully removed (returns 404) |
Key-Value Operations
Keys
A key is a path-like string. Allowed characters:a-z, A-Z, 0-9, and - _ / = .. Use / to group related keys (for example user/123). A key with any other character (such as :) is rejected with 400 (error code 10015).
Write a Value
The request body is the value — KV stores the raw bytes you send, verbatim. There is no base64 encoding and no JSON envelope.201 when the key is created and 200 when an existing key is updated; the response body is empty.
KV has no server-side TTL or per-key metadata. To expire keys, store an expiry timestamp inside the value and check it on read — see Key expiration.
Read a Value
Content-Type: application/octet-stream):
404.
Delete a Key
List Keys
prefix— Filter keys by prefixcursor— Pagination cursor from a previous response’smeta.cursorlimit— Maximum keys to return,1–1000(default1000)
meta.has_more is true, the response includes meta.cursor; pass it back as the cursor query parameter to fetch the next page.
Bindings Configuration
Connect your function to a KV namespace using bindings infunc.toml:
MY_CACHE) is surfaced to your function as an environment variable:
KV_MY_CACHE_ID— The namespace ID