Documentation Index
Fetch the complete documentation index at: https://docs.foodsave.kz/llms.txt
Use this file to discover all available pages before exploring further.
File Upload API
Base path: /api/v1/files
Overview
Uploads user and partner assets. Files are converted to WebP where applicable and a thumbnail is generated for image assets.
Files larger than 10MB may be proxied via S3 multipart upload — the endpoint will return an upload policy in that case.
POST /api/v1/files/upload
Upload a file (images, receipts).
curl --request POST \
--url https://api.foodsave.kz/api/v1/files/upload \
-H 'Authorization: Bearer $FOODSAVE_API_KEY' \
-F "file=@./receipt.jpg"
const formData = new FormData()
formData.append('file', fileInput.files[0])
const response = await fetch('https://api.foodsave.kz/api/v1/files/upload', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.FOODSAVE_API_KEY}` },
body: formData
})
console.log(await response.json())
import os
import requests
with open('receipt.jpg', 'rb') as file_handle:
response = requests.post(
'https://api.foodsave.kz/api/v1/files/upload',
headers={'Authorization': f"Bearer {os.environ['FOODSAVE_API_KEY']}"},
files={'file': file_handle}
)
print(response.json())
{
"fileId": "f-321",
"url": "https://cdn.foodsave.kz/files/receipt.jpg",
"contentType": "image/jpeg",
"size": 102400
}
Errors
| Code | Meaning | How to fix |
|---|
| 400 | UNSUPPORTED_MEDIA_TYPE | Ensure file is image/pdf and content-type is correct |
| 413 | PAYLOAD_TOO_LARGE | Split upload or use multi-part S3 flow |