Skip to main content
This page covers creating the bucket client from its token, how it retries, what it sends as telemetry, and reaching storage through an S3 client.
Client options and their types: TypeScript, Python, Go. Create a bucket in the Upstash Console and put its token in your environment:
.env
Every SDK reads UPSTASH_BLOB_TOKEN by default and also takes a token directly, for a token under another variable or a platform without environment variables, such as Cloudflare Workers. The token is a bearer secret. Anything holding it can read and write the whole bucket. Keep it server side, never in NEXT_PUBLIC_, VITE_, or any other variable your bundler inlines into client code.

Options

Constructing a client per request is fine. Credentials are cached per token, so two clients built from the same token share one.

Public or private

Whether the bucket is public or private is a console setting, not an option: the SDK learns it from the backend on the first request. See Private buckets.

Retries

A request that fails with a 5xx, a 429 or a dropped connection is sent again if it can be: reads, deletes, copies, multipart parts and signing calls. A put that goes up as one PUT with a streamed body is sent once, since a stream cannot be read twice. In TypeScript every body is streamed; in Python a body held in memory is retried: bytes, a str, or one buffered under max_size. In Go a body that can be read again is retried: a *bytes.Reader, a *strings.Reader, a regular file, or one buffered under MaxSize; see Bodies. The POSTs that create and complete a multipart upload and a batch delete are sent once. When the credential service asks the SDK to wait, it waits up to 10 seconds and asks again, three times. Clients built from the same token share one credential cache, so a credential fetch already in progress keeps the retry setting of the client that started it. An expired temporary credential is not a failure: the SDK fetches a new one and sends the request once more, even with retries off, unless its body was a stream. Browser uploads retry on their own budget; see Retries.

Telemetry

The SDK sends its version, runtime and platform as headers on credential and signing requests to Upstash. Turn it off with UPSTASH_DISABLE_TELEMETRY in the environment, set to anything but an empty string, false, 0, no or off, or with the telemetry option on the client.

Using an S3 client

Buckets are backed by Cloudflare R2 and are S3-compatible. The client’s s3() returns a config for an S3 client, for anything the SDK does not wrap: byte ranges, conditional GETs, delimiters and common prefixes, object tagging. The credentials in it are short-lived; see Minting temporary credentials. Wiring it into an S3 client: TypeScript, Python, Go.
Do not presign URLs with this client. A presigned URL carries the credential, which reads and writes the whole bucket until it expires. Use signed read URLs and signed upload URLs, which Upstash signs for one object; see Who signs a URL.

Next steps

Writing

put, metadata, conditional writes and multipart from the server.

Reading

get, info, exists, list and signed read URLs.