Skip to main content
POST
/
api
/
v1
/
books
/
create
curl -X POST "https://api.example.com/api/v1/books/create" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "gender": "Fantasy",
    "author": "J.R.R. Tolkien",
    "image": "https://example.com/covers/lotr.jpg",
    "title": "The Lord of the Rings",
    "subtitle": "The Fellowship of the Ring",
    "publisher": "Allen & Unwin",
    "year": "1954",
    "pages": 423,
    "isbn": "978-0-618-00222-1"
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "gender": "Fantasy",
  "author": "J.R.R. Tolkien",
  "image": "https://example.com/covers/lotr.jpg",
  "title": "The Lord of the Rings",
  "subtitle": "The Fellowship of the Ring",
  "publisher": "Allen & Unwin",
  "year": "1954",
  "pages": 423,
  "isbn": "978-0-618-00222-1"
}

Authentication

This endpoint requires a valid JWT token in the Authorization header.
Authorization: Bearer <your_jwt_token>

Request Body

gender
string
required
The genre or category of the book (e.g., “Fantasy”, “Science Fiction”, “Mystery”).
author
string
required
The author’s name.
image
string
required
URL or path to the book’s cover image.
title
string
required
The main title of the book.
subtitle
string
The subtitle of the book.
publisher
string
required
The name of the publisher.
year
string
required
The publication year of the book.
pages
integer
required
The number of pages in the book.
isbn
string
required
The International Standard Book Number (ISBN). Must be unique in the system.

Response

id
string
Unique identifier of the newly created book.
gender
string
The genre or category of the book.
author
string
The author’s name.
image
string
URL or path to the book’s cover image.
title
string
The main title of the book.
subtitle
string
The subtitle of the book.
publisher
string
The name of the publisher.
year
string
The publication year of the book.
pages
integer
The number of pages in the book.
isbn
string
The International Standard Book Number (ISBN).
curl -X POST "https://api.example.com/api/v1/books/create" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "gender": "Fantasy",
    "author": "J.R.R. Tolkien",
    "image": "https://example.com/covers/lotr.jpg",
    "title": "The Lord of the Rings",
    "subtitle": "The Fellowship of the Ring",
    "publisher": "Allen & Unwin",
    "year": "1954",
    "pages": 423,
    "isbn": "978-0-618-00222-1"
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "gender": "Fantasy",
  "author": "J.R.R. Tolkien",
  "image": "https://example.com/covers/lotr.jpg",
  "title": "The Lord of the Rings",
  "subtitle": "The Fellowship of the Ring",
  "publisher": "Allen & Unwin",
  "year": "1954",
  "pages": 423,
  "isbn": "978-0-618-00222-1"
}

Status Codes

201
Created
Book created successfully.
400
Bad Request
Invalid request body or validation errors (e.g., missing required fields, duplicate ISBN).
401
Unauthorized
Missing or invalid JWT token.
403
Forbidden
Valid token but insufficient permissions to create books.

Build docs developers (and LLMs) love