Skip to main content

Get Message Information

This guide walks through querying historical message information using the Bandwidth Messaging API.

The Request

GET https://messaging.bandwidth.com/api/v2/users/12345/messages?messageId=1589228074636lm4k2je7j7jklbn2 HTTP/1.1
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Bandwidth's Messaging API supplies a GET method to allow you to query historical data regarding messages.

By providing query parameters to your search, you can limit your search by a number of available parameters. For more details on the available parameters, see the Messaging API Reference

note

Bandwidth does not store text message content (the content in the text field). After sending the API request it is inaccessible and will not be returned in subsequent status callbacks or GET requests. If you need this information, it is recommended that you log or store it in your application.

The Response

HTTP/1.1 200 OK
Content-Type: application/json

{
"totalCount":1,
"pageInfo": {},
"messages":[
{
"messageId":"1589228074636lm4k2je7j7jklbn2",
"accountId":"12345",
"sourceTn":"+15554443333",
"destinationTn":"+15554442222",
"messageStatus":"DELIVERED",
"messageDirection":"OUTBOUND",
"messageType":"sms",
"segmentCount":1,
"errorCode":0,
"receiveTime":"2020-04-07T14:03:07.000Z",
"carrierName":"other",
"messageSize": 27,
"messageLength": 18,
"attachmentCount": 1,
"recipientCount": 1,
"campaignClass": "T"
}
]
}

Examples

GET Message Info using MessageId

Request

GET https://messaging.bandwidth.com/api/v2/users/12345/messages?messageId=1589228074636lm4k2je7j7jklbn2 HTTP/1.1
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
"totalCount":1,
"pageInfo": {},
"messages":[
{
"messageId":"1589228074636lm4k2je7j7jklbn2",
"accountId":"12345",
"sourceTn":"+15554443333",
"destinationTn":"+15554442222",
"messageStatus":"DELIVERED",
"messageDirection":"OUTBOUND",
"messageType":"sms",
"segmentCount":1,
"errorCode":0,
"receiveTime":"2020-04-07T14:03:07.000Z",
"carrierName":"other",
"messageSize": 27,
"messageLength": 18,
"attachmentCount": 1,
"recipientCount": 1,
"campaignClass": "T"
}
]
}