smartchat

upload_file

Adds a file to the media library from multipart field 'file', from an address ('url') or from base64 data, with the same checks as in the app. Uses no credits. Returns the media object; an identical image that already exists is returned instead.

Tool nameupload_file
Permissionmedia:write
readOnlyHintfalse
destructiveHintfalse
idempotentHinttrue
openWorldHintfalse
REST callPOST /v1/media

#What it does

  • Changes data in your account. It does not send messages to contacts.
  • Safe to repeat with the same idempotency_key.

#Input

The tool takes one flat object. Path, query and body fields of the REST call are merged into it.

NameTypeRequiredDescription
filestringnoThe file (multipart/form-data only). up to 104857600 characters; format binary
urlstringnoAddress (https only) SmartChat downloads the file from. Not for internal addresses.
data_base64stringnoThe file as base64 text, at most 20 MB before encoding (use multipart or url for larger files). Needs 'filename'. up to 28000000 characters
filenamestringnoFile name with ending, for example terrace.jpg. Needed with data_base64; optional with url. up to 200 characters
mimestringnoMedia type, for example image/jpeg. Optional; detected from the file if missing. up to 120 characters
usagestringnoWhat the file is used for. one of: generic, logo, landing, newsletter, template, blog, library; default "generic"

Arguments added by the MCP server (see Special arguments)

NameTypeRequiredDescription
idempotency_keystringnoOptional. Unique key, for example a UUID. Same key and arguments within 24 hours: first result. Without a key only an identical call within 1 minute counts as a repeat. up to 255 characters

#Result

The result has the same content as the REST answer. Lists have at most 50 items per page (default 20); use cursor for the next page.

Errors come back as a tool result with isError: true. The error codes are the ones in Errors.