Skip to main content
PUT
/
rentals
/
{rental_id}
/
return
curl -X PUT https://api.example.com/rentals/123/return \
  -u "username:password" \
  -H "Content-Type: application/json"
{
  "id": 123,
  "user": {
    "id": 42,
    "firstname": "John",
    "lastname": "Doe",
    "email": "[email protected]",
    "displayPicture": "https://example.com/photos/john.jpg"
  },
  "book": {
    "isbn": "978-0-12345-678-9",
    "title": "The Great Adventure",
    "stock": 5,
    "coverImage": "https://example.com/covers/great-adventure.jpg",
    "author": {
      "id": 7,
      "name": "Jane Smith",
      "age": 45
    }
  },
  "loanDate": "2026-03-04T10:30:00Z",
  "returnDate": "2026-03-18T10:30:00Z",
  "returned": true
}

Authentication

This endpoint requires HTTP Basic Authentication.

Path Parameters

rental_id
integer
required
The unique identifier of the rental to mark as returned

Response

id
integer
Unique identifier for the rental
user
object
User who rented the book
id
integer
User ID
firstname
string
User’s first name
lastname
string
User’s last name
email
string
User’s email address
displayPicture
string
URL to user’s display picture
book
object
Book that was returned
isbn
string
Book ISBN
title
string
Book title
stock
integer
Current stock count (incremented by 1 after return)
coverImage
string
URL to book cover image
author
object
Book author details
id
integer
Author ID
name
string
Author name
age
integer
Author age
loanDate
string
ISO 8601 timestamp when the book was originally rented
returnDate
string
ISO 8601 timestamp when the book was due
returned
boolean
Whether the book has been returned (always true after this operation)

Error Responses

404
error
Rental with the specified ID not found

Automatic Stock Management

When a book is returned, the associated book’s stock is automatically incremented by 1. This makes the book available for other users to rent.
curl -X PUT https://api.example.com/rentals/123/return \
  -u "username:password" \
  -H "Content-Type: application/json"
{
  "id": 123,
  "user": {
    "id": 42,
    "firstname": "John",
    "lastname": "Doe",
    "email": "[email protected]",
    "displayPicture": "https://example.com/photos/john.jpg"
  },
  "book": {
    "isbn": "978-0-12345-678-9",
    "title": "The Great Adventure",
    "stock": 5,
    "coverImage": "https://example.com/covers/great-adventure.jpg",
    "author": {
      "id": 7,
      "name": "Jane Smith",
      "age": 45
    }
  },
  "loanDate": "2026-03-04T10:30:00Z",
  "returnDate": "2026-03-18T10:30:00Z",
  "returned": true
}

Build docs developers (and LLMs) love