Skip to main content
A Cloud Storage binding gives a Telnyx Edge Function a pre-authenticated handle to one of your buckets. You declare the binding in func.toml; the runtime resolves it to env.<BINDING> and injects the credential — your code holds no access key or secret key, and nothing sensitive appears in your bundle or logs. The handle is a small, focused surface — get, put, head, delete, list. It is the in-function counterpart of the S3-compatible API: same buckets, same objects, reached from inside a function instead of over HTTP.
Cloud Storage bindings are TypeScript-only — the typed env handle comes from the @telnyx/edge-runtime SDK (≥ 0.5.0). Other runtimes (JS, Go, Python) don’t get a typed binding.
This guide builds one complete function end to end: a small file API backed by a bucket — PUT, GET, and DELETE an object by key, and list objects by prefix.

1. Scaffold the function

Create a TypeScript function. You also need an existing bucket for it to use — the binding points at a bucket, it doesn’t create one. If you don’t have one, create it first via the Mission Control portal, the AWS CLI, or an S3 SDK.

2. Declare the binding

Add a [storage.cloudstorage.<name>] block to the generated func.toml. The block key is a name you choose — it becomes the property on env. Here it’s ASSETS, reached as env.ASSETS:
Declare more than one bucket by adding more blocks — each [storage.cloudstorage.<name>] becomes env.<name>.

3. Install and generate types

new-func already lists @telnyx/edge-runtime and @aws-sdk/client-s3 in package.json. Install them, then generate the typed env:
telnyx-edge types writes telnyx-env.d.ts, which types env.ASSETS as CloudStorageBucket so the calls below type-check.

4. Write the function

Replace index.ts with the complete file API. Every bucket operation — list, put, get, delete — goes through env.ASSETS; there are no credentials anywhere in the code.

5. Ship it

When the deploy finishes, get the function’s invoke URL:

6. Try it

With URL set to your function’s invoke URL:

Beyond the basics

This file API sticks to the core get/put/delete/list calls. The same binding also does ranged and conditional reads, batch delete, hierarchical (folder) listing, multipart uploads for objects past the request/response size cap, and SSE‑C customer-key encryption — all on env.<BINDING>. See the Binding API reference for every method, option, and object type.