Upload a file for a block to show
Keeps a file as the brand's media and answers the public URL it is served from: what a
send_media message takes as its url, or an ask block as its mediaSrc. A file that is
already at a public URL needs none of this, because a block takes that URL as it is.
A send_media message becomes an image, a video, an audio or a document by the extension at
the end of its URL, so the URL answered here ends in the file's own extension, lowercased, and a
file named without one gets the one its content says.
Up to 30 MB. An extension a browser opens as a page or runs as a script is refused: .html,
.htm, .xhtml, .xht, .shtml, .js, .mjs, .xml and .swf, with .exe and the few
others the builder refuses too. An .svg is kept, as the builder keeps it: the chat shows it as
an image. With channel_family set to whatsapp, the file is also checked against what
WhatsApp sends: its type has to be one WhatsApp takes, and its size within WhatsApp's limit for
that type.
Needs the permission to edit bots. Counted per brand, on top of the limit every call has: 60 uploads an hour, shared by every member.
Body
Responses
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
curl https://api.landbot.io/v0-alpha/media \
--request POST \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Token YOUR_AGENT_TOKEN' \
--form 'channel_family=landbot'
{
"data": {
"url": "https://storage.googleapis.com/media.landbot.io/1234/ronin/f3c1e0b7a9d24c6e8b5a7d2c1e0f9a8b.png",
"content_type": "image/png",
"size": 48213
}
}