complete_media_upload
Adds a file you just uploaded to the workspace media library and returns the mediaUrl to pass to create_post or update_post. Call it only after the PUT to the uploadUrl from create_media_upload_url succeeds, with that response’s publicUrl as url, its key, the original file metadata and the same workspaceId. It registers the file; it does not transfer bytes or check that the PUT worked, and it publishes nothing.
- Access
- write
- Category
- Media
- Endpoint
POST/api/tools/complete_media_upload
Parameters
urlkeyfileNamecontentTypefileSizeworkspaceIdExample request
curl -X POST "https://mcp.postmcpai.com/api/tools/complete_media_upload" \
-H "Content-Type: application/json" \
-H "x-api-key: $POSTMCPAI_API_KEY" \
-d '{
"url": "https://cdn.postmcpai.com/u66a1f0c2_1763884800000_launch.png",
"key": "u66a1f0c2_1763884800000_launch.png",
"fileName": "launch.png",
"contentType": "image/png",
"fileSize": 245760
}'Response
mediaUrl, ready for create_post, update_post or a mediaUrls carousel, plus the media library entry. librarySaved is false, with a warning, when the file is usable but did not make it into the library.
{
"success": true,
"asset": {
"_id": "6923a7e1c0f4b2a9d1e8",
"url": "https://cdn.postmcpai.com/u66a1f0c2_1763884800000_launch.png",
"key": "u66a1f0c2_1763884800000_launch.png",
"fileName": "launch.png",
"mimeType": "image/png",
"kind": "image",
"size": 245760,
"source": "upload",
"usedCount": 0,
"createdAt": "2026-11-23T08:00:04.000Z"
},
"mediaUrl": "https://cdn.postmcpai.com/u66a1f0c2_1763884800000_launch.png",
"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.
key is required from create_media_upload_url.key is missing or empty.
Fix: Pass the key from the create_media_upload_url response unchanged.
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 the publicUrl from create_media_upload_url as it was returned.
Only files uploaded to this workspace can be added to the library.url does not point at PostMCP storage.
Fix: For a file hosted elsewhere, call import_media_from_url instead.