Quickstart
1. Get an API key
Section titled “1. Get an API key”Create an API key from your dashboard or via the API. Keys are prefixed with tdp_ and shown once at creation.
2. Create a vault
Section titled “2. Create a vault”Vaults are containers for your files. Every account starts with a default vault, but you can create more.
import { TuskyClient } from '@tuskydp/sdk';
const tusky = new TuskyClient({ apiKey: 'tdp_your_key' });
const vault = await tusky.vaults.create({ name: 'My Project', visibility: 'public',});import requests
headers = {"Authorization": "Bearer tdp_your_key"}resp = requests.post( "https://api.opentusk.ai/api/vaults", headers=headers, json={"name": "My Project", "visibility": "public"},)vault = resp.json()curl -X POST https://api.opentusk.ai/api/vaults \ -H "Authorization: Bearer tdp_your_key" \ -H "Content-Type: application/json" \ -d '{"name": "My Project", "visibility": "public"}'3. Upload a file
Section titled “3. Upload a file”The SDK handles the 3-step upload (presign, PUT, confirm) in a single call.
import { readFile } from 'fs/promises';
const data = await readFile('./photo.jpg');const file = await tusky.files.upload({ name: 'photo.jpg', mimeType: 'image/jpeg', vaultId: vault.id, data,});
console.log(file.id, file.status); // "hot"# Step 1: Request presigned upload URLupload = requests.post( "https://api.opentusk.ai/api/files/upload", headers=headers, json={ "name": "photo.jpg", "mimeType": "image/jpeg", "sizeBytes": 102400, "vaultId": vault["id"], },).json()
# Step 2: PUT file bytes to presigned URLwith open("photo.jpg", "rb") as f: requests.put( upload["uploadUrl"], data=f.read(), headers={"Content-Type": "image/jpeg"}, )
# Step 3: Confirm uploadfile = requests.post( f"https://api.opentusk.ai/api/files/{upload['fileId']}/confirm", headers=headers,).json()4. Download the file
Section titled “4. Download the file”const { downloadUrl } = await tusky.files.getDownloadUrl(file.id);const response = await fetch(downloadUrl);const bytes = await response.arrayBuffer();dl = requests.get( f"https://api.opentusk.ai/api/files/{file['id']}/download", headers=headers,).json()
content = requests.get(dl["downloadUrl"]).contentWhat happens next
Section titled “What happens next”Your file is now in the hot cache and immediately available. In the background, Tusky’s worker will sync it to the Walrus network. Once synced, the file status changes to synced. You can track this via webhooks or polling.
File lifecycle Learn about the full file status lifecycle: uploading → hot → synced → cold.