Complete reference of UploadKit error codes, HTTP status codes, and troubleshooting suggestions.
Every error response from the UploadKit API has the same shape:
{ "error": { "type": "invalid_request", "code": "TIER_LIMIT_EXCEEDED", "message": "You have exceeded your file size limit", "suggestion": "Upgrade your plan at app.uploadkit.dev/billing" }}
const response = await fetch('https://api.uploadkit.dev/api/v1/upload/request', { method: 'POST', headers: { Authorization: `Bearer ${process.env.UPLOADKIT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ fileName, fileSize, contentType, routeSlug }),});if (!response.ok) { const { error } = await response.json(); switch (error.code) { case 'VALIDATION_ERROR': throw new Error(`Invalid request: ${JSON.stringify(error.details)}`); case 'INVALID_FILE_TYPE': throw new Error('This file type is not supported.'); case 'TIER_LIMIT_EXCEEDED': throw new Error('Quota reached — upgrade your plan.'); case 'RATE_LIMITED': throw new Error('Too many requests. Try again shortly.'); case 'UNAUTHORIZED': throw new Error('API key missing or invalid.'); default: throw new Error(error.message); }}
When using the @uploadkitdev/core or @uploadkitdev/react SDK, errors are surfaced via the onError callback with the same code values. You do not need to parse the HTTP response manually. Retryable failures (429, 5xx) are automatically retried with exponential backoff up to maxRetries.