RealTimeX
Sign inStart for free
RealTimeXAPI Documentationv1
IntroductionAuthenticationBase URLHeadersError codes
GETListGETGet infoGETAttachmentsGETAttachments summaryPOSTCreate groupPATCHGroup adminsPATCHGroup permissionsPATCHGroup informationPATCHGroup participants
Sample requestsSample responsesStatus codesAppendixChangelog
API ReferenceAPI endpointsConversation

Conversation Attachments

Overview

List paginated file and media attachments shared in a conversation — for the shared media gallery, document browser, and attachment search inside the chat UI.

Filter by type, sender, date range, or free-text search. Each item includes download URL, dimensions, size, and sender info for grid or list rendering.

When to use this endpoint?

Use Conversation Attachments when:

  • Opening the shared media panel from a group or DM info sheet.
  • Showing image thumbnails, PDFs, or other files sent in the thread.
  • Filtering the gallery to images only via type=image, or narrowing by sender and date range.
  • Paginating through a long attachment history as the user scrolls.

Part of the Chat Conversation APIs for the chat package/SDK (not Platform → Conversations). Requires a chat user Access Token for the signed-in messaging participant.

Response Data

Each item in data.list typically includes:

FieldDescription
_idAttachment record id.
messageIdSource message id - use to jump to the message in the thread.
conversationIdParent conversation id (matches query conversationId).
senderUploader with _id, name, and optional profileImage.
url / filename / fileTypeDownload URL, original filename, and MIME type for preview or download.
sizeFile size in bytes.
width / height / durationImage/video dimensions and media duration where applicable; null for documents.
uploadedAt / createdAtISO timestamps for when the file was uploaded.
GET{baseUrl}/api/{apiVersion}/conversation/attachments?conversationId={conversationId}&type=image&page=1&limit=20
Authentication
Required (Bearer token)
Tenant-scoped
Yes (tenant DB - requires x-client-id)

Request Headers

HeaderValueDescription
AuthorizationBearer <access_token>Chat user Access Token (Bearer) for the signed-in messaging participant.
is-tenanttrueTargets the tenant DB ("true", needs x-client-id).
x-client-id{{clientId}}Tenant (client) id. Required when is-tenant=true.

Query Parameters

ParameterRequiredExampleDescription
conversationIdRequired{{conversationId}}Conversation _id to scope results to (24-char Mongo ObjectId).
typeOptionalimageFilter by type (message type: text / image / file).
searchOptional—Case-insensitive text search (input is regex-escaped, safe). Matches this endpoint's searchable fields.
senderIdOptional—Filter by sender userId (24-char Mongo ObjectId).
startDateOptional—Range start date, ISO 8601 (e.g. "2026-06-01"). UTC.
endDateOptional—Range end date, ISO 8601 (e.g. "2026-06-30"). UTC.
pageOptional1Page number, 1-based. Default 1.
limitOptional20Page size - items per page. Default 10.

Success Response (HTTP 200 OK)

On success, the API returns a paginated list of attachments. The example includes one image and one PDF from the same conversation.

json
1{2  "success": true,3  "message": "Attachments fetched successfully",4  "data": {5    "list": [6      {7        "_id": "665f...0001",8        "messageId": "665f...0001",9        "conversationId": "699fe...645c",10        "sender": {11          "_id": "665f...34cd",12          "name": "Smith William",13          "profileImage": null14        },15        "url": "https://example.com/profile-image.png",16        "filename": "profile-photo.png",17        "fileType": "image/png",18        "size": 20480,19        "width": 800,20        "height": 600,21        "duration": null,22        "uploadedAt": "2026-06-19T08:58:00.000Z",23        "createdAt": "2026-06-19T08:58:00.000Z"24      },25      {26        "_id": "665f...0001",27        "messageId": "665f...0001",28        "conversationId": "699fe...645c",29        "sender": {30          "_id": "665f...34cd",31          "name": "Smith William",32          "profileImage": null33        },34        "url": "https://example.com/report.pdf",35        "filename": "report.pdf",36        "fileType": "application/pdf",37        "size": 20480,38        "width": null,39        "height": null,40        "duration": null,41        "uploadedAt": "2026-06-19T08:58:00.000Z",42        "createdAt": "2026-06-19T08:58:00.000Z"43      }44    ],45    "pagination": {46      "currentPage": 1,47      "totalCount": 2,48      "hasNextPage": false,49      "hasPreviousPage": false,50      "pageSize": 2051    }52  },53  "error": null54}

Common Errors

Attachments fail when the token is missing, the conversation does not exist, or the user is not allowed to view it.

HTTP 401 Unauthorized - No token

json
1{2  "success": false,3  "message": "No token, authorization denied",4  "data": null,5  "error": "Unauthorized"6}

HTTP 404 Not Found - Conversation missing

json
1{2  "success": false,3  "message": "Conversation not found",4  "data": null,5  "error": null6}

HTTP 403 Forbidden - Access denied

json
1{2  "success": false,3  "message": "Access denied: insufficient permissions",4  "data": null,5  "error": null6}
CodeReason
401 UnauthorizedAccess Token is missing, invalid, or expired.
404 Not FoundNo conversation exists for the given conversationId.
403 ForbiddenSigned-in user is not a participant or lacks permission to view attachments in this conversation.
500 Internal Server ErrorAn unexpected error occurred while fetching attachments.

Best Practices

  • Call Attachments Summary first for tab counts, then load this endpoint when the user opens a specific category.
  • Use type filters in the gallery UI instead of filtering large lists client-side.
  • Lazy-load thumbnails; open full-size previews or downloads via url on user action.
  • Link each attachment to its messageId so users can jump to the original message in the thread.
  • Always send tenant headers with the chat user Bearer token over HTTPS.

Media gallery ready

Render the attachment grid or list from this response. Pair with Attachments Summary for category tabs and counts in the shared media panel.

PreviousGet infoNextAttachments summary

On this page

OverviewWhen to use this endpoint?Response DataRequest HeadersQuery ParametersSuccess ResponseCommon ErrorsBest Practices
Back to top