SDK reference
import { upload } from '@dropkit/upload';
const { data, error } = await upload(file, { key: 'pk_live_...', // required endpoint: 'https://api.dropkit.app', // optional metadata: { user: '123' }, // optional onProgress: (bytes, total) => {}, // optional signal: controller.signal, // optional});Response shape
// success{ data: { id, url, name, size, type }, error: null }
// failure{ data: null, error: { code, message, fix? } }Error codes
| code | meaning |
|---|---|
missing_key | The key option was not provided |
missing_auth | The bearer header was missing on the API call |
invalid_key | Key was not recognized |
origin_not_allowed | The browser’s origin isn’t in the project allowlist |
size_out_of_range | File size is 0 or exceeds 5 GiB |
upload_failed | The file upload PUT request failed |
needs_secret_key | Operation requires sk_live_ |
Aborting
const ctrl = new AbortController();upload(file, { key, signal: ctrl.signal });ctrl.abort();