client.attachments. You can upload files before embedding them in multipart messages, download attachments by GUID, force-download files not yet cached on the Mac, fetch metadata, generate blur hashes for progressive image loading, and retrieve live photo videos. Each method corresponds to an endpoint on your BlueBubbles Server.
Upload an attachment for multipart messages
When you want to include a file inside a multipart message, you must upload it first. The two-step flow is:Upload the file
Call The response shape looks like:
uploadAttachment() with a multipart form body containing your file. The server stores the file and returns a unique UUID you reference in the next step.This two-step upload flow is only required for multipart messages. If you just want to send a single file to a chat, use
client.messages.sendAttachment() directly instead — no pre-upload needed.Download an attachment
Usedownload() to retrieve the raw file bytes for an attachment you already have the GUID for. This is the standard download path — it works when the attachment is already cached on the Mac.
client.messages.list() with "with": ["attachment"], each message object includes an attachments array with GUIDs you can pass directly to download().
Force-download an attachment
If an attachment exists in the database but hasn’t been downloaded to the Mac yet,download() returns a 404. In that case, use forceDownloadAttachment() to trigger the Mac to fetch the file from iCloud first.
forceDownloadAttachment() requires the Private API to be enabled on your BlueBubbles Server.Fetch attachment metadata
Useget() to retrieve the database record for an attachment without downloading the file. This is useful for checking the MIME type, filename, or size before deciding whether to download.
Generate a blur hash
getAttachmentBlurhash() generates a BlurHash string for an image attachment. You can use the hash to render a blurred placeholder in your UI before the full image loads.
Generating a BlurHash is CPU-intensive on the server. For large images, the server resizes internally before hashing. Expect slightly longer response times compared to other attachment endpoints.
Retrieve a live photo
UsegetAttachmentLivePhoto() to retrieve the video component of a Live Photo. If the attachment is not an image or doesn’t have a live version, the server returns an error.