Skip to content

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
On this page
  1. Parameters
  2. Example request
  3. Response
  4. Credit cost
  5. Errors

Parameters

url
stringrequired
The publicUrl returned by create_media_upload_url, after a successful upload.
key
stringrequired
The storage key returned by create_media_upload_url.
fileName
stringrequired
The same filename sent to create_media_upload_url.
contentType
stringrequired
The same MIME type sent to create_media_upload_url.
fileSize
integerrequired
The same size in bytes sent to create_media_upload_url.
workspaceId
string
Workspace to act on, from list_workspaces. Omit to use the default workspace on the key.

Example 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.

200 · application/json
{
  "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.