Media
Get an API keyImport from a URL
Send JSON with the establishmentId and a public https url. Sofia downloads the file itself, checks it, and stores it in the media library.
curl -X POST https://api.sofia-post.com/api/v1/media \
-H "Authorization: Bearer $SOFIA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"establishmentId":"'$ESTABLISHMENT_ID'","url":"https://images.example.com/tatin.jpg"}'Upload a file
Or send the file itself as multipart/form-data, with a file field.
curl -X POST https://api.sofia-post.com/api/v1/media \
-H "Authorization: Bearer $SOFIA_API_KEY" \
-F establishmentId=$ESTABLISHMENT_ID \
-F file=@tatin.jpg{
"id": "393d5aa4-16f1-430f-b1d8-1fb1473076ef",
"type": "image",
"url": "https://…/393d5aa4-16f1-430f-b1d8-1fb1473076ef.jpg?X-Amz-…"
}What is accepted
- Images and videos, up to 200 MB.
- A URL must be public https: a private address, more than 3 redirects or more than 30 seconds of download are refused.
- The returned
urlis signed and expires: keep theid, and read the media again withGET /v1/media/{id}when you need a fresh URL.
A refused file answers 422 media_import_refused or media_upload_refused, with the reason in details and what to do in message.