Images and videos

Upload, import from a link or use a one time upload link.

Formats and limits

KindTypesLimitsStored as
image, posterPNG, JPEG, WebPUp to 5 MB, at least 600 by 300 pxWebP, largest side 1600 px
videoMP4, WebM, MOVUp to 90 MB and 90 secondsH.264 MP4 up to 1280 px wide, with a poster

Every file is checked, optionally virus scanned and rebuilt on Drefly's servers before it can be used, so nothing is served as uploaded. A file can only be used by the account that uploaded it.

Send the file

upload_image takes a PNG, JPEG or WebP as base64. It is the simplest way for chat apps that can pass file bytes.

curl https://ads.drefly.pro/api/ads/mcp \
  -H "Authorization: Bearer $DREFLY_ADS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "upload_image", "arguments": {"kind": "image", "content_type": "image/png", "filename": "banner.png", "data_base64": "iVBORw0KGgo..."}}}' 

Import from a link

import_media fetches a file from a public https link. Private addresses, plain http, other types and files over the limit are refused. Each import counts as an upload.

curl https://ads.drefly.pro/api/ads/mcp \
  -H "Authorization: Bearer $DREFLY_ADS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "import_media", "arguments": {"kind": "video", "url": "https://cdn.nova.example/spot.mp4"}}}' 
Response
{
  "video_key": "sponsor/users/4b1d.../a71f....mp4",
  "poster_key": "sponsor/users/4b1d.../a71f....webp"
}

create_upload_link returns a link that accepts one multipart upload in the field file and expires after 15 minutes. Use it from code that can send files.

Shell
curl -X POST "https://ads.drefly.pro/api/ads/agent/uploads/one_time_token" \
  -F "file=@spot.mp4;type=video/mp4"

Next steps

Was this page helpful?