Upload file
POSTUpload a file to decentralized storage on Walrus Protocol.
Endpoint
POST https://api.tuskr.dev/v1/filesRequest Headers
| Header | Type | Description |
|---|---|---|
| Authorization | string | Bearer token with your API key |
| Content-Type | string | multipart/form-data |
Request Body
| Field | Type | Description |
|---|---|---|
| file | File | The file to upload (required) |
| tag | string | Optional tag for organization |
| category | string | Optional category for grouping |
| epochs | number | Storage duration in epochs (default: 1) |
Example Request
const formData = new FormData()formData.append('file', file)formData.append('tag', 'avatar')formData.append('category', 'images') const response = await fetch('https://api.tuskr.dev/v1/files', { method: 'POST', headers: { 'Authorization': 'Bearer tsk_live_xxxx' }, body: formData})Response
{ "id": "file_abc123", "blob_id": "0x1a2b3c4d5e6f...", "url": "https://cdn.tuskr.dev/abc123", "size": 1048576, "mime_type": "image/png", "tag": "avatar", "category": "images", "created_at": "2024-01-15T10:30:00Z", "expires_at": "2024-02-15T10:30:00Z"}