# List messages This operation lists all messages sent or received via particular Processing Modes. Setting the messages_source parameter to CONVERSATION_SOURCE allows for querying messages in CONVERSATION mode, and setting it to DISPATCH_SOURCE will allow for queries of messages in DISPATCH mode. Note that conversation_id and contact_id are only supported as query parameters if messages_source is set to CONVERSATION_SOURCE. Combining multiple parameters is supported for more detailed filtering of messages, but some of them are not supported depending on the value specified for messages_source. The description for each field will inform if that field may not be supported. The messages are ordered by their accept_time property in descending order, where accept_time is a timestamp of when the message was enqueued by the Conversation API. This means messages received most recently will be listed first. Endpoint: GET /v1/projects/{project_id}/messages Version: 1.0 Security: Basic, oAuth2 ## Path parameters: - `project_id` (string, required) The unique ID of the project. You can find this on the Sinch Dashboard. ## Query parameters: - `conversation_id` (string) Resource name (ID) of the conversation. - `contact_id` (string) Resource name (ID) of the contact. - `app_id` (string) Id of the app. - `channel_identity` (string) Channel identity of the contact. - `start_time` (string) Filter messages with accept_time after this timestamp. Must be before end_time if that is specified. - `end_time` (string) Filter messages with accept_time before this timestamp. - `page_size` (integer) Maximum number of messages to fetch. Defaults to 10 and the maximum is 1000. - `page_token` (string) Next page token previously returned if any. When specifying this token, make sure to use the same values for the other parameters from the request that originated the token, otherwise the paged results may be inconsistent. - `view` (string) Enum: "WITH_METADATA", "WITHOUT_METADATA" - `messages_source` (string) Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. For more information, see Processing Modes. Enum: "CONVERSATION_SOURCE", "DISPATCH_SOURCE" - `only_recipient_originated` (boolean) If true, fetch only recipient originated messages. - `channel` (string) Only fetch messages from the channel. Enum: "WHATSAPP", "RCS", "SMS", "MESSENGER", "VIBERBM", "MMS", "INSTAGRAM", "TELEGRAM", "KAKAOTALK", "KAKAOTALKCHAT", "LINE", "WECHAT", "APPLEBC" - `direction` (string) Optional. Only fetch messages with the specified direction. If direction is not specified, it will list both TO_APP and TO_CONTACT messages. Enum: "TO_APP", "TO_CONTACT" ## Response 200 fields (application/json): - `messages` (array) List of messages associated to the referenced conversation. - `messages.accept_time` (string) The time Conversation API processed the message. - `messages.channel_identity` (object) A unique identity of message recipient on a particular channel. For example, the channel identity on SMS, WHATSAPP or VIBERBM is a MSISDN phone number. - `messages.channel_identity.identity` (string, required) The channel identity. This will differ from channel to channel. For example, a phone number for SMS, WhatsApp, and Viber Business. - `messages.channel_identity.channel` (string, required) The identifier of the channel you want to include. Must be one of the enum values. Enum: "WHATSAPP", "RCS", "SMS", "MESSENGER", "VIBERBM", "MMS", "INSTAGRAM", "TELEGRAM", "KAKAOTALK", "KAKAOTALKCHAT", "LINE", "WECHAT", "APPLEBC" - `messages.channel_identity.app_id` (string) Required if using a channel that uses app-scoped channel identities. Currently, FB Messenger, Instagram, LINE, and WeChat use app-scoped channel identities, which means contacts will have different channel identities on different Conversation API apps. These can be thought of as virtual identities that are app-specific and, therefore, the app_id must be included in the API call. - `messages.contact_id` (string) The ID of the contact. - `messages.conversation_id` (string) The ID of the conversation. - `messages.direction` (string) The direction of the message flow, indicating whether the message was sent to or from the Conversation API app. Enum: "TO_APP", "TO_CONTACT" - `messages.id` (string) The ID of the message. - `messages.metadata` (string) Optional. Metadata associated with the contact. Up to 1024 characters long. - `messages.injected` (boolean) Flag for whether this message was injected. - `messages.sender_id` (string) For Contact Messages (MO messages), the sender ID represents the recipient to which the message was sent. This may be a phone number (in the case of SMS and MMS) or a unique ID (in the case of WhatsApp). This is field is not supported on all channels, nor is it supported for MT messages. - `messages.processing_mode` (string) Whether or not Conversation API should store contacts and conversations for the app. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). Enum: "CONVERSATION", "DISPATCH" - `next_page_token` (string) Token that should be included in the next request to fetch the next page. ## Response 400 fields (application/json): - `error` (object) - `error.code` (integer) - `error.details` (array) - `error.details.type_url` (string) - `error.details.value` (string) - `error.message` (string) - `error.status` (string) ## Response 403 fields (application/json): - `error` (object) - `error.code` (integer) - `error.details` (array) - `error.details.type_url` (string) - `error.details.value` (string) - `error.message` (string) - `error.status` (string) ## Response 500 fields (application/json): - `error` (object) - `error.code` (integer) - `error.details` (array) - `error.details.type_url` (string) - `error.details.value` (string) - `error.message` (string) - `error.status` (string) ## Response 501 fields (application/json): - `error` (object) - `error.code` (integer) - `error.details` (array) - `error.details.type_url` (string) - `error.details.value` (string) - `error.message` (string) - `error.status` (string)