Three ways to send media, all returning the same asset:
- multipart/form-data with a
filefield (local upload). - JSON with
source_url(import a remote file). - JSON with
file_base64+content_type(Base64 upload).
The returned public_url is what you pass in media_urls when creating a post.
Hosting is temporary: assets are deleted 60 days after upload (expires_at), so
publish before then — see media handling.
/v1/mediaUpload a file or import a remote image/video URL into Dravo media storage.
Body & query parameters
source_urlstring (URL)Remote image or video to fetch when sending JSON. Provide exactly one of source_url or file_base64.
file_base64string (Base64)Base64-encoded file when sending JSON (data: URI prefix allowed). Requires content_type.
content_typestringMIME type of file_base64, e.g. image/png. Required with file_base64.
filenamestringOptional original filename for a Base64 upload.
filebinaryImage or video file when sending multipart/form-data.
Error codes
400Could not fetch source_url.
413File exceeds the upload/import limit.
415Unsupported media type.
502Upload to storage failed.
const response = await fetch("https://api.dravo.dev/v1/media", { method: "POST", headers: { "Authorization": "Bearer " + process.env.DRAVO_API_KEY, "Content-Type": "application/json",}, body: JSON.stringify({ "source_url": "https://example.com/promo.jpg"})});const data = await response.json();console.log(data);{ "id": "media_8f2c1d", "public_url": "https://cdn.dravo.dev/u/abc/2f1c....jpg", "kind": "image", "content_type": "image/jpeg", "size_bytes": 84211, "status": "ready", "created_at": "2026-06-27T10:00:00Z", "expires_at": "2026-08-26T10:00:00Z"}