Getting Started
Quickstart Guide
Learn how to generate an API key, install the TypeScript SDK, and upload your first asset in less than 3 minutes.
1
Generate an API Key
Before interacting with Cloudizero APIs or the SDK, you need an API key. Navigate to the API Keys Console and create a new key.
Keep API Keys Confidential
API keys prefixed with
cz_live_ grant access to manage your storage. Never expose secret keys in client-side bundles or public GitHub repositories.2
Install @cloudizero/sdk
Install the official package using your preferred package manager:
pnpm add @cloudizero/sdk3
Upload Your First Asset
Create an upload script (e.g., upload.ts) and execute it:
upload.ts
import { Cloudizero } from "@cloudizero/sdk";
import fs from "fs";
// 1. Initialize Cloudizero Client
const cz = new Cloudizero({
apiKey: process.env.CLOUDIZERO_API_KEY!, // e.g. "cz_live_9f8a..."
baseUrl: "https://cloudizero.wismannur.pro",
cdnUrl: "https://cdn-cloudizero.wismannur.pro", // Optional public CDN domain
});
async function main() {
// 2. Read file to upload
const fileBuffer = fs.readFileSync("./sample.png");
// 3. Upload directly to Cloudflare R2
const asset = await cz.storage.upload({
file: fileBuffer,
fileName: "sample.png",
projectId: "your-project-id", // found in /projects dashboard
mimeType: "image/png",
});
console.log("Upload Success!");
console.log("Asset ID:", asset.id);
console.log("Public CDN URL:", asset.url);
}
main().catch(console.error);What's Next?
Check out the detailed Uploads Guide to learn about browser uploads with real-time progress callbacks, or explore Storage Explorer API to organize folders.