Skip to Content
API ReferencePOST /api/upload

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

CheckStatusMessage
File missing400No file provided
Wrong extension400Unsupported file type: .pdf
Over 10 MB413File too large. Maximum 10MB.
Bad/missing token401Unauthorized

Accepted extensions: .xlsx, .xls, .csv

Processing Steps

  1. Authenticate via checkAuth()
  2. Parse FormData, extract file field
  3. Validate file presence, extension, and size
  4. Generate UUID job ID via crypto.randomUUID()
  5. Upload to Supabase Storage at uploads/{jobId}/{filename}
  6. Insert row into etl_jobs:
    • status = pending
    • progress_pct = 5
    • stage_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