Skip to main content
GET
/
api
/
ui
/
workspaces
/
{workspaceId}
/
messages
curl "https://api.example.com/api/ui/workspaces/workspace_123/messages?page=1&limit=50&direction=outbound" \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"
{
  "messages": [
    {
      "id": "msg_abc123",
      "direction": "outbound",
      "to": "+15551234567",
      "from": "+15559876543",
      "body": "Hello, this is a test message",
      "status": "delivered",
      "provider_sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalMessages": 234,
    "hasNext": true
  }
}

Authentication

This endpoint requires user authentication. You must be a member of the workspace to access its messages.

Path Parameters

workspaceId
string
required
The unique identifier of the workspace

Query Parameters

page
number
The page number for pagination (default: 1)
limit
number
The number of messages per page (default: 50, max: 100)
direction
string
Filter by message direction: “inbound” or “outbound”
status
string
Filter by message status: “queued”, “sent”, “delivered”, “failed”, etc.
from
string
Filter by sender phone number
to
string
Filter by recipient phone number
startDate
string
Filter messages after this date (ISO 8601 format)
endDate
string
Filter messages before this date (ISO 8601 format)

Response

messages
array
Array of message objects
messages[].id
string
Unique identifier of the message
messages[].direction
string
Direction of the message: “inbound” or “outbound”
messages[].to
string
Recipient phone number
messages[].from
string
Sender phone number
messages[].body
string
Content of the message
messages[].status
string
Current status of the message
messages[].provider_sid
string
Provider’s unique identifier for the message
messages[].created_at
string
Timestamp when the message was created
pagination
object
Pagination information
pagination.currentPage
number
Current page number
pagination.totalPages
number
Total number of pages
pagination.totalMessages
number
Total number of messages
pagination.hasNext
boolean
Whether there are more pages
{
  "messages": [
    {
      "id": "msg_abc123",
      "direction": "outbound",
      "to": "+15551234567",
      "from": "+15559876543",
      "body": "Hello, this is a test message",
      "status": "delivered",
      "provider_sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalMessages": 234,
    "hasNext": true
  }
}
curl "https://api.example.com/api/ui/workspaces/workspace_123/messages?page=1&limit=50&direction=outbound" \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"