Get unified inbox

GET /api/v1/inbox

Retrieve all swap requests for the user (both sent and received) in a unified inbox sorted by latest messages with optional filtering and sorting

Query parameters

  • userId string Required

    User ID

  • status string

    Filter by status

  • sortBy string

    Sort by field (latest_message, date, book_title, sender_name, status)

Responses

  • 500 */*

    Internal Server Error

    Hide response attribute Show response attribute object
    • error object
      Hide error attributes Show error attributes object
      • code string
      • message string
      • target string
      • details array[object]
        Hide details attributes Show details attributes object
        • code string
        • message string
        • target string
  • 401 */*

    Unauthorized

    Hide response attribute Show response attribute object
    • error object
      Hide error attributes Show error attributes object
      • code string
      • message string
      • target string
      • details array[object]
        Hide details attributes Show details attributes object
        • code string
        • message string
        • target string
  • 404

    User not found

  • 403 */*

    Forbidden

    Hide response attribute Show response attribute object
    • error object
      Hide error attributes Show error attributes object
      • code string
      • message string
      • target string
      • details array[object]
        Hide details attributes Show details attributes object
        • code string
        • message string
        • target string
  • 400

    Invalid status or sort parameter

  • 200 */*

    Unified inbox retrieved successfully

    Hide response attributes Show response attributes object
    • id string
    • swapType string
    • swapStatus string
    • note string
    • requestedAt string(date-time)
    • updatedAt string(date-time)
    • sender object
      Hide sender attributes Show sender attributes object
      • id string
      • name string
    • receiver object
      Hide receiver attributes Show receiver attributes object
      • id string
      • name string
    • bookToSwapWith object
      Hide bookToSwapWith attributes Show bookToSwapWith attributes object
      • id string
      • title string
      • author string
      • condition string
    • swapOffer object
      Hide swapOffer attributes Show swapOffer attributes object
      • offeredBookTitle string
      • offeredGenreName string
    • askForGiveaway boolean
    • unreadMessageCount integer(int64)
    • hasNewMessages boolean
    • conversationType string
    • unread boolean
GET /api/v1/inbox
curl \
 --request GET 'http://localhost:8080/api/v1/inbox?userId=string'
Response examples (500)
{
  "error": {
    "code": "string",
    "message": "string",
    "target": "string",
    "details": [
      {
        "code": "string",
        "message": "string",
        "target": "string"
      }
    ]
  }
}
Response examples (401)
{
  "error": {
    "code": "string",
    "message": "string",
    "target": "string",
    "details": [
      {
        "code": "string",
        "message": "string",
        "target": "string"
      }
    ]
  }
}
Response examples (403)
{
  "error": {
    "code": "string",
    "message": "string",
    "target": "string",
    "details": [
      {
        "code": "string",
        "message": "string",
        "target": "string"
      }
    ]
  }
}
Response examples (200)
[
  {
    "id": "string",
    "swapType": "string",
    "swapStatus": "string",
    "note": "string",
    "requestedAt": "2025-05-04T09:42:00Z",
    "updatedAt": "2025-05-04T09:42:00Z",
    "sender": {
      "id": "string",
      "name": "string"
    },
    "receiver": {
      "id": "string",
      "name": "string"
    },
    "bookToSwapWith": {
      "id": "string",
      "title": "string",
      "author": "string",
      "condition": "string"
    },
    "swapOffer": {
      "offeredBookTitle": "string",
      "offeredGenreName": "string"
    },
    "askForGiveaway": true,
    "unreadMessageCount": 42,
    "hasNewMessages": true,
    "conversationType": "string",
    "unread": true
  }
]