Skip to navigation
REST ClientLogsMessage Logs

list

View as MarkdownOpen in Claude

List message log entries.

Query parameters

created_beforestringOptional
Return logs created at or before this time. Accepts a date (`YYYY-MM-DD`), an ISO 8601 timestamp, or Unix time in seconds. A date is read as midnight UTC at the start of that day, so logs from that day are left out. A timestamp without `Z` or a UTC offset is read as UTC.
created_onstringOptional
Return logs created during this UTC day. Accepts the same formats as `created_before`. A timestamp selects the whole UTC day that contains it.
created_afterstringOptional
Return logs created at or after this time. Accepts the same formats as `created_before`. A date is read as midnight UTC at the start of that day, so logs from that day are included.
page_numberintegerOptional>=0Defaults to 0
The page index, starting at `0`. Any value above `0` also requires `page_token`.
page_sizeintegerOptional1-1000Defaults to 50
The number of results per page. The default is `50` and the maximum is `1000`.
page_tokenstringOptional
The cursor for any page after the first. Take it from the `links.next` or `links.prev` URL of the previous response.

Response

datalist of objectsRequired
Array of message log entries

Response Example

Response
{
"links": {
"self": "https://example.signalwire.com/api/messaging/logs?page_number=0&page_size=50",
"first": "https://example.signalwire.com/api/messaging/logs?page_size=50",
"next": "https://example.signalwire.com/api/messaging/logs?page_number=1&page_size=50&page_token=PA6ad4c839-9329-43fe-83c6-fbe7c38583ff",
"prev": "https://example.signalwire.com/api/messaging/logs?page_number=0&page_size=50&page_token=PA6ad4c839-9329-43fe-83c6-fbe7c38583ff"
},
"data": [
{
"id": "string",
"from": "+12077447397",
"to": "+12029921413",
"status": "failed",
"direction": "inbound",
"kind": "sms",
"source": "laml",
"type": "relay_message",
"url": "https://example.signalwire.com/api/laml/2010-04-01/Accounts/c38dacad-2f6c-4de1-93d6-cc732e0c70c5/Messages/9ee38635-899a-490a-bfd1-9e72f5eea53c",
"number_of_segments": 1,
"charge": 0,
"charge_details": [
{
"description": "Inbound SMS",
"charge": 0.00415
}
],
"created_at": "2024-05-06T12:20:00Z",
"error_message": "From number is not a SMS-capable phone number.",
"error_code": "21601"
}
]
}

Example

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
messages = client.logs.messages.list(page_size=20)
for msg in messages.get("data", []):
print(msg.get("from"), "->", msg.get("to"), msg.get("status"))