Skip to main content

Storage - TypeScript


We now require you to authenticate using your API key which you can obtain from the Dashboard.

The ThirdwebSDK class includes storage out of the box, available by using

The @thirdweb-dev/storage Package

Storage is also available as its own package, separate from the @thirdweb-dev/sdk package.

This is useful if you want to use storage without the rest of the SDK.

npm install @thirdweb-dev/storage

Once installed, import and instantiate the ThirdwebStorage class:

import { ThirdwebStorage } from "@thirdweb-dev/storage";

const storage = new ThirdwebStorage({
secretKey: "YOUR_SECRET_KEY", // You can get one from dashboard settings


Customize the behavior of the ThirdwebStorage class by passing in a custom ThirdwebStorageConfig object.


Provide your own IPFS gateway URLs to use to retrieve files from IPFS.

When calling download or downloadJSON, the SDK will try to download the file from the first gateway URL in the list. If that fails, it will try the next URL in the list, and so on.

const storage = new ThirdwebStorage({
gatewayUrls: ["", ""],

The default value provides three gateways for IPFS:

"ipfs://": [

Provide your own implementation of how to handle downloading from all schemes specified in the gatewayUrls configuration.

// Can instantiate the downloader with the default gateway URLs
const downloader = new StorageDownloader();
const storage = new ThirdwebStorage({ downloader });
Specify the default upload behavior.
// Instantiate the uploader with default configuration
const uploader = new StorageUploader();
const storage = new ThirdwebStorage({ uploader });

Optionally, provide configuration:

const options = {
// Upload objects with resolvable URLs
uploadWithGatewayUrl: true,

const uploader = new StorageUploader(options);
const storage = new ThirdwebStorage({ uploader });