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 name | upload_file |
| Permission | media:write |
readOnlyHint | false |
destructiveHint | false |
idempotentHint | true |
openWorldHint | false |
| REST call | POST /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.
| Name | Type | Required | Description |
|---|---|---|---|
file | string | no | The file (multipart/form-data only). up to 104857600 characters; format binary |
url | string | no | Address (https only) SmartChat downloads the file from. Not for internal addresses. |
data_base64 | string | no | The file as base64 text, at most 20 MB before encoding (use multipart or url for larger files). Needs 'filename'. up to 28000000 characters |
filename | string | no | File name with ending, for example terrace.jpg. Needed with data_base64; optional with url. up to 200 characters |
mime | string | no | Media type, for example image/jpeg. Optional; detected from the file if missing. up to 120 characters |
usage | string | no | What 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)
| Name | Type | Required | Description |
|---|---|---|---|
idempotency_key | string | no | Optional. 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.