Skip to main content

File Upload

1 API call in this section.

Upload File to Storage​

Platform & Access / File Upload
POST/upload-file

Uploads a file to Supabase Storage and returns information about the uploaded file including its public URL.

Path within the bucket (subfolder)

Business Rules

  • Content-Type must be 'multipart/form-data'

  • The file field is required and must be a valid file

  • The bucket must exist in Supabase Storage

  • Filename is automatically generated with timestamp prefix to avoid conflicts

Query parameters

ParameterTypeDescription
languageOptionalstring

Language code for response localization (Optional, default: en) Language code for localized response messages (optional, default: en)

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Body parameters

ParameterTypeDescription
fileRequiredfile

The file to upload

Example: /path/to/file.jpg

bucketRequiredtext

Storage bucket name (defaults to 'public')

Example: public

pathtext

Path within the bucket (subfolder)

Example: uploads

Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/upload-file?language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --form 'file=@/path/to/file.jpg' \4  --form-string 'bucket=public' \5  --form-string 'path=uploads'

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "File uploaded successfully",4  "data": {5    "path": "uploads/1625097600000-example.jpg",6    "fullPath": "public/uploads/1625097600000-example.jpg",7    "publicUrl": "https://example.supabase.co/storage/v1/object/public/public/uploads/1625097600000-example.jpg",8    "fileName": "1625097600000-example.jpg",9    "originalName": "example.jpg",10    "contentType": "image/jpeg",11    "size": 10240012  }13}