Upload or import

View .md

Upload a local file or import a remote URL into Dravo media storage.


Three ways to send media, all returning the same asset:

  • multipart/form-data with a file field (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.

POST/v1/media
API key (dra_…) or dashboard JWT

Upload 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_typestring

MIME type of file_base64, e.g. image/png. Required with file_base64.

filenamestring

Optional original filename for a Base64 upload.

filebinary

Image or video file when sending multipart/form-data.

Error codes

400

Could not fetch source_url.

413

File exceeds the upload/import limit.

415

Unsupported media type.

502

Upload 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"}