Skip to main content
GET
/
api
/
inbox
Get Messages
curl --request GET \
  --url https://api.example.com/api/inbox \
  --header 'Authorization: <authorization>'
{
  "200": {},
  "401": {},
  "messages": [
    {
      "id": 123,
      "sender": "<string>",
      "recipient": "<string>",
      "message": "<string>",
      "created_at": "<string>",
      "avatar_url": "<string>"
    }
  ]
}
Retrieves all direct messages where the authenticated user is either the sender or recipient.

Request

Headers

Authorization
string
required
User authentication token

Response

messages
array
Array of message objects sorted by creation date (newest first)

Success Response

{
  "messages": [
    {
      "id": 1,
      "sender": "jane_smith",
      "recipient": "john_doe",
      "message": "Hello, how are you?",
      "created_at": "2026-03-03T10:30:00Z",
      "avatar_url": "https://example.com/avatars/jane.jpg"
    },
    {
      "id": 2,
      "sender": "john_doe",
      "recipient": "jane_smith",
      "message": "I'm doing great, thanks!",
      "created_at": "2026-03-03T10:25:00Z",
      "avatar_url": "https://i.pinimg.com/736x/20/da/fa/20dafa83d38f2277472e132bf1f21c22.jpg"
    }
  ]
}

Status Codes

200
Success
Messages retrieved successfully
401
Unauthorized
Invalid or missing authentication token
{
  "error": "invalid token , please re-login"
}
or
{
  "error": "unauthorized"
}

Example

curl -X GET https://api.example.com/api/inbox \
  -H "Authorization: your-auth-token"

Build docs developers (and LLMs) love