On by default

Uploads

Upload File

discourse_upload_file

Upload an image or file to Discourse. Provide either: image_data (base64 with filename), a remote HTTP(S) URL, or an absolute local file path. user_id is required for avatar/background uploads. Returns upload_id for use in avatar/profile updates. Use short_url to embed images in posts.

Parameters

upload_typestringavatarprofile_backgroundcard_backgroundcomposerrequired

Type of upload

image_datastring

Base64 image data (with or without data URI prefix)

urlstring

Remote HTTP(S) URL for Discourse to fetch, or file:// URL / absolute local path

filenamestring

Filename (required with image_data, optional for file paths)

user_idinteger

User ID (required for avatar/profile_background/card_background uploads)