This page documents
@squarecloud/blob v4. Upgrading from v3? Read the v3 → v4 migration guide.@squarecloud/blob is the official JavaScript SDK for Square Cloud Blob Storage. It covers every Blob API endpoint plus the S3 gateway.
Requirements
- Node.js 20 or newer, or any modern browser. The SDK only uses
fetch,FormDataandBlob. - Ships as ESM and CommonJS, with zero runtime dependencies.
@aws-sdk/client-s3is an optional peer dependency, only needed if you calls3().
Installation
- npm
- yarn
- pnpm
- bun
Creating the client
The examples read the key from theSQUARECLOUD_API_KEY environment variable. Set it in the terminal where you run them:
- macOS / Linux
- Windows (PowerShell)
- ESM / TypeScript
- CommonJS
stats() reads your usage:
Constructor
Credentials
The credential is sent as-is in theAuthorization header, with no Bearer prefix.
What you cannot configure
maxRetries is the only option. The client does not accept:
- A base URL. It is fixed at
https://blob.squarecloud.app/v1/. - A custom
fetch. Requests use the globalfetch. - A timeout or an
AbortSignal. A call lasts as long asfetchwaits, and there is no way to cancel it. - Custom headers.
Methods
Every method returns plain data (no classes), excepts3(), which returns an S3Client. Options and results use the API’s own field names, mostly snake_case (security_hash, expires_at), so the Blob API reference applies as-is.
The package also exports
SquareCloudBlobError, the BlobErrorCode type and every option and result type (PutOptions, PutResult, ListedObject, ObjectInfo, Share, Rule, …). See Errors.
Object ids
Every object is identified by an opaque id, such aspub/... for a public object or prv/... for a private one.
- Store the id exactly as returned. Never build one by hand and never parse it.
- Changing
privateorexpirechanges the id. Always replace your stored id with the oneupdate()returns. - Use the
urlfrom the response instead of building URLs. Private objects haveurl: null: get a link withdownloadUrl()or a share.
Next steps
Uploads
Upload files and mint upload tokens.
Blob API quickstart
Base URL and a first upload with curl.
Blob Storage plans
What each plan includes.

