POST /api/upload
Uploads an image file to Supabase Storage and returns its public URL. Use this URL when submitting a challenge completion viaPOST /api/completions.
This endpoint requires a valid Bearer token in the
Authorization header.Request
Send the request asmultipart/form-data with the image attached under the field name image.
The image file to upload. Must use the form field name
image. Accepted MIME types: image/jpeg, image/png, image/gif, image/webp, image/heic. Maximum size: 10 MB.Response
200 OKtrue when the upload succeeded.Error responses
| Status | Description |
|---|---|
400 | No file was included in the request, or the file’s MIME type is not an image. |
401 | Missing or invalid Bearer token. |
500 | Supabase Storage upload failed. The response includes the upstream error message. |
Example
Alternative: direct Supabase Storage uploadThe frontend SDK (
frontend/lib/storage.ts) uploads images directly to the same completion-images bucket in Supabase Storage, bypassing this endpoint. Both paths produce a public URL in the same format. Use this API endpoint when uploading from a server-side context or a custom client that does not have direct Supabase Storage access.