Update swap request status.

PUT /api/v1/swap-requests/{id}/status

Update the status of a swap request. Only the receiver can change the status.

Headers

  • X-User-Id string Required

Path parameters

  • id string Required

    SwapRequest ID.

application/json

Body Required

  • status string Required

    The new status for the swap request

    Minimum length is 1. Values are Pending, Accepted, Reserved, Rejected, or Expired.

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

    Swap request 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 transition or user not authorized.

  • 200 */*

    Swap request status updated successfully.

    Hide response attributes Show response attributes object
    • id string
    • senderId string
    • receiverId string
    • bookToSwapWith object
      Hide bookToSwapWith attributes Show bookToSwapWith attributes object
      • id string
      • title string
      • author string
      • genres array[string]
      • language string
      • description string
      • condition string
      • coverPhotoUrls array[string]
      • owner object
        Hide owner attributes Show owner attributes object
        • id string
        • name string
      • swapCondition object
        Hide swapCondition attributes Show swapCondition attributes object
        • swapType string
        • giveAway boolean
        • openForOffers boolean
        • swappableGenres array[object]
          Hide swappableGenres attributes Show swappableGenres attributes object
          • id string
          • name string
        • swappableBooks array[object]
          Hide swappableBooks attributes Show swappableBooks attributes object
          • id string
          • title string
          • author string
          • coverPhotoUrl string
    • swapType string
    • swapOffer object
      Hide swapOffer attributes Show swapOffer attributes object
      • offeredBook object
        Hide offeredBook attributes Show offeredBook attributes object
        • id string
        • title string
        • author string
        • coverPhotoUrl string
      • offeredGenre object
        Hide offeredGenre attributes Show offeredGenre attributes object
        • id string
        • name string
    • askForGiveaway boolean
    • swapStatus string
    • note string
    • requestedAt string(date-time)
    • updatedAt string(date-time)
PUT /api/v1/swap-requests/{id}/status
curl \
 --request PUT 'http://localhost:8080/api/v1/swap-requests/{id}/status' \
 --header "Content-Type: application/json" \
 --header "X-User-Id: string" \
 --data '{"status":"Accepted"}'
Request examples
# Headers
X-User-Id: string

# Payload
{
  "status": "Accepted"
}
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",
  "senderId": "string",
  "receiverId": "string",
  "bookToSwapWith": {
    "id": "string",
    "title": "string",
    "author": "string",
    "genres": [
      "string"
    ],
    "language": "string",
    "description": "string",
    "condition": "string",
    "coverPhotoUrls": [
      "string"
    ],
    "owner": {
      "id": "string",
      "name": "string"
    },
    "swapCondition": {
      "swapType": "string",
      "giveAway": true,
      "openForOffers": true,
      "swappableGenres": [
        {
          "id": "string",
          "name": "string"
        }
      ],
      "swappableBooks": [
        {
          "id": "string",
          "title": "string",
          "author": "string",
          "coverPhotoUrl": "string"
        }
      ]
    }
  },
  "swapType": "string",
  "swapOffer": {
    "offeredBook": {
      "id": "string",
      "title": "string",
      "author": "string",
      "coverPhotoUrl": "string"
    },
    "offeredGenre": {
      "id": "string",
      "name": "string"
    }
  },
  "askForGiveaway": true,
  "swapStatus": "string",
  "note": "string",
  "requestedAt": "2025-05-04T09:42:00Z",
  "updatedAt": "2025-05-04T09:42:00Z"
}