Media

Upload file

POST /api/media/upload

Upload a file attachment. Uses multipart form data.

FieldTypeRequiredDescription
fileFileYesThe file to upload
messageIdstringNoLink attachment to a message

Response:

{
  "id": "attachment-uuid",
  "url": "https://cdn.shadow.app/...",
  "filename": "photo.png",
  "contentType": "image/png",
  "size": 102400
}
const formData = new FormData()
formData.append('file', blob, 'photo.png')
const attachment = await client.uploadFile(formData)
attachment = client.upload_file(open("photo.png", "rb"))

Get file

GET /api/media/:id

Redirects to a presigned download URL for the file.

const url = `${client.baseUrl}/api/media/${attachmentId}`
// Redirect — use in <img> or <a> tags directly
url = f"{client.base_url}/api/media/{attachment_id}"
# Redirect — follow to download