Skip to content

Attachments and thumbnails

Customers attach invoices, photos and documents to their messages. These operations give you those files for one message at a time: as download links to the original files, as their content inside the response, or as small thumbnails for a preview. The message id you need is the id of a message from GET /openapi/message/pagedthreadmessages/{threadId} (see Messages).

Field Meaning
fileName The file’s name, with its extension.
url A link to the original, full-size file. Open it with a plain GET, without the Authorization header. null when no link is available.
mimeType The file type, worked out from the extension, such as application/pdf.
sizeInKiloBytes The file’s size, when it is known.
previewId The id of the attachment’s thumbnail, for GET /openapi/bytefiles/{id}. null when it has none.
Operation What you get When to use it
GET /openapi/bytefiles/messageattachments/{messageId}/links A download link per attachment. Usually: you fetch only the files you need, straight from the link.
GET /openapi/bytefiles/messageattachments/{messageId} Every attachment’s whole content, base64-encoded in fileData. You need every file at once and they are small. The response grows with every file.
GET /openapi/bytefiles/{id} A thumbnail, base64-encoded in base64. You show a preview next to the message.
Terminal window
curl https://open-api.replyco.com/openapi/bytefiles/messageattachments/9a4e1c7b-2d3f-4b8a-8e6c-1f0a2b3c4d5e/links \
-H "Authorization: Bearer $ACCESS_TOKEN"
[
{
"fileName": "invoice-10423.pdf",
"url": "https://files.example.com/invoice-10423.pdf?signature=abc123",
"mimeType": "application/pdf",
"sizeInKiloBytes": 182,
"previewId": null
},
{
"fileName": "damaged-parcel.jpg",
"url": "https://files.example.com/damaged-parcel.jpg?signature=def456",
"mimeType": "image/jpeg",
"sizeInKiloBytes": 2310,
"previewId": "c7e2a4f1-9b3d-4a6e-8f20-3d1b5c7a9e64"
}
]

Links to files Replyco stores are valid for about a day. Ask for fresh links when you are about to download, rather than saving them. Files hosted by eBay come back with eBay’s own link. A message without attachments gives an empty list, and an id that matches no message is answered with 404.

GET /openapi/bytefiles/messageattachments/{messageId} returns fileName and fileData for every attachment. A message without attachments, or an id that matches no message, is answered with 204 and no body. An attachment stored somewhere Replyco cannot read from is answered with 400.

Replyco makes a thumbnail for image attachments (jpg, jpeg, png, gif and bmp) when it receives them: a 180 × 120 pixel image, cropped to fit. Other files, and files that come only as an eBay link, have no thumbnail. Pass the attachment’s previewId to GET /openapi/bytefiles/{id}. An id that matches no thumbnail is answered with 204.

Method Path Summary Scopes
GET /openapi/bytefiles/messageattachments/{messageId} Get the content of all attachments of a message —
GET /openapi/bytefiles/messageattachments/{messageId}/links Get download links to the original files of a message’s attachments —
GET /openapi/bytefiles/paged Get all records with paging —
GET /openapi/bytefiles/{id} Get an attachment thumbnail by its preview ID —

GET /openapi/bytefiles/paged lists stored thumbnails across the company, without any link to their messages; use the per-message operations above instead.

Status Meaning Returned by
400 An attachment of the message is stored in an unsupported location GET /openapi/bytefiles/messageattachments/{messageId}
401 User is not authenticated or authorized; Unauthorized GET /openapi/bytefiles/messageattachments/{messageId}, GET /openapi/bytefiles/messageattachments/{messageId}/links, GET /openapi/bytefiles/paged, GET /openapi/bytefiles/{id}
404 Message with the specified ID was not found GET /openapi/bytefiles/messageattachments/{messageId}/links