POST /api/upload
Accepts an Excel File upload, stores it in Supabase Storage, and creates the initial job record.
Request
- Content-Type:
multipart/form-data - Headers:
Authorization: Bearer <token> - Body: FormData with field
file
Validation
| Check | Status | Message |
|---|---|---|
| File missing | 400 | No file provided |
| Wrong extension | 400 | Unsupported file type: .pdf |
| Over 10 MB | 413 | File too large. Maximum 10MB. |
| Bad/missing token | 401 | Unauthorized |
Accepted extensions: .xlsx, .xls, .csv
Processing Steps
- Authenticate via
checkAuth() - Parse FormData, extract
filefield - Validate file presence, extension, and size
- Generate UUID job ID via
crypto.randomUUID() - Upload to Supabase Storage at
uploads/{jobId}/{filename} - Insert row into
etl_jobs:status=pendingprogress_pct= 5stage_message="File uploaded successfully"file_size_bytes= file size
Response
Success (200):
{
"job_id": "uuid-string",
"filename": "original_filename.xlsx"
}Error (500):
{
"error": "Storage upload failed: <message>"
}Last updated on