Skip to main content
Upload a file, then reference its attachment_id in a media or media part on a message with is_audio_message.

Upload

Send the raw bytes as the request body (up to 100 MB):
201 Created:
A presigned two-step flow is tracked on API availability.
Set the real Content-Type when uploading video, such as video/mp4 or video/quicktime. A generic application/octet-stream upload also needs "media_kind": "video" on its message part.

Send it

Reference the attachment in a part. Relay stores its download URL on the part so clients and history reads can render it directly. Text and media commit as separate messages: the send below commits a text message, then a media message. Contiguous media parts in one send stay together as one media message:
Set "is_audio_message": true on the message for native inline playback. The uploaded attachment needs an audio/* content type. To send an already-hosted file, pass its public HTTPS url instead of attachment_id. For a video uploaded with Content-Type: video/mp4, send the attachment ID:
For an already-hosted video, declare the MIME type so an extensionless URL remains playable:
Relay rejects a media_kind that conflicts with a specific image/*, video/*, or audio/* MIME type. Media parts accept optional width and height in pixels, always together.
  • Declare the pair when you know the size. Clients reserve the aspect ratio before the bytes download.
  • Omit the pair on an uploaded image/* attachment. Relay derives both from the stored bytes (PNG, JPEG, GIF, and WebP) and includes them on the delivered part.

Who can use an attachment

Attachments belong to their uploader.

Check an upload

Only available attachments can be sent.

Receiving media

Incoming media parts carry content_type, media_kind, and a capability url you can download directly.
  • Use media_kind to pick the presentation.
  • Pass content_type to the media framework when the URL has no file extension.
  • Read width and height on image parts, present when the sender declared them or Relay derived them at send time.

Next steps