Quickstart
Create a bucket and upload your first object in two minutes.
1. Get an API key
Sign in to the dashboard,
then create a key. Keys look like sk_live_… and are shown only once.
Store your API key securely and never expose it in client-side code. For browser uploads, use signed URLs instead.
2. Install the SDK
npm install @vault/storage3. Create a bucket and upload
import { Storage } from "@vault/storage";
const storage = new Storage({ apiKey: process.env.VAULT_API_KEY });
await storage.buckets.create({ name: "avatars", visibility: "public" });
const res = await storage.objects.upload({
bucket: "avatars",
key: "users/42.png",
body: file, // string | Blob | ArrayBuffer | stream
contentType: "image/png",
});
console.log(res.key, res.size, res.etag);API=https://storage-saas.manojkumarsahu97.workers.dev
# create a bucket
curl -X POST $API/v1/buckets \
-H "Authorization: Bearer $VAULT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"avatars","visibility":"public"}'
# upload an object (binary body)
curl -X PUT "$API/v1/buckets/avatars/objects/users/42.png" \
-H "Authorization: Bearer $VAULT_API_KEY" \
-H "Content-Type: image/png" \
--data-binary @avatar.png4. Download it back
const res = await storage.objects.download("avatars", "users/42.png");
const bytes = await res.arrayBuffer();