import_media_from_url
Downloads a publicly reachable image or video into PostMCP storage, adds it to the workspace media library and returns mediaUrl for create_post, update_post or a mediaUrls carousel. The backend checks the source URL, file type and size. Local paths, private-network addresses and links that need a login are refused. It stores media and publishes nothing.
- Access
- write
- Category
- Media
- Endpoint
POST/api/tools/import_media_from_url
Parameters
urlworkspaceIdExample request
curl -X POST "https://mcp.postmcpai.com/api/tools/import_media_from_url" \
-H "Content-Type: application/json" \
-H "x-api-key: $POSTMCPAI_API_KEY" \
-d '{
"url": "https://example.com/launch.png"
}'Response
The stored mediaUrl and its media library entry. librarySaved is false, with a warning, when the file was imported but not saved to the library; mediaUrl is usable either way.
{
"success": true,
"mediaUrl": "https://cdn.postmcpai.com/u66a1f0c2_1763884811000_launch.png",
"asset": {
"_id": "6923a7f0c0f4b2a9d1ea",
"url": "https://cdn.postmcpai.com/u66a1f0c2_1763884811000_launch.png",
"fileName": "u66a1f0c2_1763884811000_launch.png",
"mimeType": "image/png",
"kind": "image",
"source": "link",
"sourceUrl": "https://example.com/launch.png",
"usedCount": 0,
"createdAt": "2026-11-23T08:00:11.000Z"
},
"librarySaved": true
}Credit cost
No credits.
Errors
Over REST these come back as a 500 with the message in error; over MCP as a tool error. See Errors for the shapes.
url must be a public HTTP(S) media URL without embedded credentials.url is not an http(s) URL, or carries a username or password.
Fix: Pass a plain public link to the file itself.
… resolves to a non-public address · … is larger than the …MB limitThe backend refused the link: it points at a private or local address, its host does not resolve, it redirects too often, or the file is over the size limit.
Fix: Host the file somewhere public and within the limit, or upload it with create_media_upload_url.
We could not download that link. Check it opens in a browser, or upload the file instead.The link did not return a usable image or video, for example because it needs a login or is down.
Fix: Use a direct link to the file, or upload it with create_media_upload_url.