Images and videos
Upload, import from a link or use a one time upload link.
Formats and limits
| Kind | Types | Limits | Stored as |
|---|---|---|---|
image, poster | PNG, JPEG, WebP | Up to 5 MB, at least 600 by 300 px | WebP, largest side 1600 px |
video | MP4, WebM, MOV | Up to 90 MB and 90 seconds | H.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..."}}}' result = await session.call_tool(
"upload_image",
{
"kind": "image",
"content_type": "image/png",
"filename": "banner.png",
"data_base64": "iVBORw0KGgo..."
},
)
print(result.structuredContent)const result = await client.callTool({
name: "upload_image",
arguments: {
"kind": "image",
"content_type": "image/png",
"filename": "banner.png",
"data_base64": "iVBORw0KGgo..."
},
});
console.log(result.structuredContent);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"}}}' result = await session.call_tool(
"import_media",
{
"kind": "video",
"url": "https://cdn.nova.example/spot.mp4"
},
)
print(result.structuredContent)const result = await client.callTool({
name: "import_media",
arguments: {
"kind": "video",
"url": "https://cdn.nova.example/spot.mp4"
},
});
console.log(result.structuredContent);{
"video_key": "sponsor/users/4b1d.../a71f....mp4",
"poster_key": "sponsor/users/4b1d.../a71f....webp"
}Upload link
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.
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?
Thanks for the feedback. Tell us what was missing