curl --request POST \
--url https://bookhub-mock.onrender.com/books \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"title": "The Great Adventure",
"author": "Jane Smith",
"description": "An epic tale of courage and discovery",
"language": "en-US",
"publisher": "Adventure Books Inc",
"publishedDate": "2024-03-15",
"isbn": "978-0-1234-5678-9",
"price": 24.99,
"coverImages": [
"https://covers.bookhub.com/great-adventure-front.jpg",
"https://covers.bookhub.com/great-adventure-back.jpg"
],
"genres": [
"Fiction",
"Adventure"
],
"bookFormat": "Hardcover"
}
'import requests
url = "https://bookhub-mock.onrender.com/books"
payload = {
"title": "The Great Adventure",
"author": "Jane Smith",
"description": "An epic tale of courage and discovery",
"language": "en-US",
"publisher": "Adventure Books Inc",
"publishedDate": "2024-03-15",
"isbn": "978-0-1234-5678-9",
"price": 24.99,
"coverImages": ["https://covers.bookhub.com/great-adventure-front.jpg", "https://covers.bookhub.com/great-adventure-back.jpg"],
"genres": ["Fiction", "Adventure"],
"bookFormat": "Hardcover"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'The Great Adventure',
author: 'Jane Smith',
description: 'An epic tale of courage and discovery',
language: 'en-US',
publisher: 'Adventure Books Inc',
publishedDate: '2024-03-15',
isbn: '978-0-1234-5678-9',
price: 24.99,
coverImages: [
'https://covers.bookhub.com/great-adventure-front.jpg',
'https://covers.bookhub.com/great-adventure-back.jpg'
],
genres: ['Fiction', 'Adventure'],
bookFormat: 'Hardcover'
})
};
fetch('https://bookhub-mock.onrender.com/books', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://bookhub-mock.onrender.com/books",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'The Great Adventure',
'author' => 'Jane Smith',
'description' => 'An epic tale of courage and discovery',
'language' => 'en-US',
'publisher' => 'Adventure Books Inc',
'publishedDate' => '2024-03-15',
'isbn' => '978-0-1234-5678-9',
'price' => 24.99,
'coverImages' => [
'https://covers.bookhub.com/great-adventure-front.jpg',
'https://covers.bookhub.com/great-adventure-back.jpg'
],
'genres' => [
'Fiction',
'Adventure'
],
'bookFormat' => 'Hardcover'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://bookhub-mock.onrender.com/books"
payload := strings.NewReader("{\n \"title\": \"The Great Adventure\",\n \"author\": \"Jane Smith\",\n \"description\": \"An epic tale of courage and discovery\",\n \"language\": \"en-US\",\n \"publisher\": \"Adventure Books Inc\",\n \"publishedDate\": \"2024-03-15\",\n \"isbn\": \"978-0-1234-5678-9\",\n \"price\": 24.99,\n \"coverImages\": [\n \"https://covers.bookhub.com/great-adventure-front.jpg\",\n \"https://covers.bookhub.com/great-adventure-back.jpg\"\n ],\n \"genres\": [\n \"Fiction\",\n \"Adventure\"\n ],\n \"bookFormat\": \"Hardcover\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://bookhub-mock.onrender.com/books")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"The Great Adventure\",\n \"author\": \"Jane Smith\",\n \"description\": \"An epic tale of courage and discovery\",\n \"language\": \"en-US\",\n \"publisher\": \"Adventure Books Inc\",\n \"publishedDate\": \"2024-03-15\",\n \"isbn\": \"978-0-1234-5678-9\",\n \"price\": 24.99,\n \"coverImages\": [\n \"https://covers.bookhub.com/great-adventure-front.jpg\",\n \"https://covers.bookhub.com/great-adventure-back.jpg\"\n ],\n \"genres\": [\n \"Fiction\",\n \"Adventure\"\n ],\n \"bookFormat\": \"Hardcover\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://bookhub-mock.onrender.com/books")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"The Great Adventure\",\n \"author\": \"Jane Smith\",\n \"description\": \"An epic tale of courage and discovery\",\n \"language\": \"en-US\",\n \"publisher\": \"Adventure Books Inc\",\n \"publishedDate\": \"2024-03-15\",\n \"isbn\": \"978-0-1234-5678-9\",\n \"price\": 24.99,\n \"coverImages\": [\n \"https://covers.bookhub.com/great-adventure-front.jpg\",\n \"https://covers.bookhub.com/great-adventure-back.jpg\"\n ],\n \"genres\": [\n \"Fiction\",\n \"Adventure\"\n ],\n \"bookFormat\": \"Hardcover\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Book already created",
"data": {
"bookId": "123e4567-e89b-41d4-a716-426614174000",
"title": "The Great Adventure",
"author": "Jane Smith",
"description": "An epic tale of courage and discovery",
"language": "en-US",
"publisher": "Adventure Books Inc",
"publishedDate": "2024-03-15",
"isbn": "978-0-1234-5678-9",
"price": 24.99,
"status": "PENDING",
"coverImages": [
"https://covers.bookhub.com/great-adventure-front.jpg"
],
"genres": [
"Fiction",
"Adventure"
],
"bookFormat": "Hardcover",
"createdDate": "2024-12-25T10:30:00Z",
"updatedDate": "2024-12-25T10:30:00Z"
}
}Create a new book
Creates a new book with PENDING status. The book will not be visible to customers
until it is finalized using the finalize endpoint.
Workflow
- Create book with
PENDINGstatus - Review and verify book details
- Finalize book to make it
ACTIVE
curl --request POST \
--url https://bookhub-mock.onrender.com/books \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"title": "The Great Adventure",
"author": "Jane Smith",
"description": "An epic tale of courage and discovery",
"language": "en-US",
"publisher": "Adventure Books Inc",
"publishedDate": "2024-03-15",
"isbn": "978-0-1234-5678-9",
"price": 24.99,
"coverImages": [
"https://covers.bookhub.com/great-adventure-front.jpg",
"https://covers.bookhub.com/great-adventure-back.jpg"
],
"genres": [
"Fiction",
"Adventure"
],
"bookFormat": "Hardcover"
}
'import requests
url = "https://bookhub-mock.onrender.com/books"
payload = {
"title": "The Great Adventure",
"author": "Jane Smith",
"description": "An epic tale of courage and discovery",
"language": "en-US",
"publisher": "Adventure Books Inc",
"publishedDate": "2024-03-15",
"isbn": "978-0-1234-5678-9",
"price": 24.99,
"coverImages": ["https://covers.bookhub.com/great-adventure-front.jpg", "https://covers.bookhub.com/great-adventure-back.jpg"],
"genres": ["Fiction", "Adventure"],
"bookFormat": "Hardcover"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'The Great Adventure',
author: 'Jane Smith',
description: 'An epic tale of courage and discovery',
language: 'en-US',
publisher: 'Adventure Books Inc',
publishedDate: '2024-03-15',
isbn: '978-0-1234-5678-9',
price: 24.99,
coverImages: [
'https://covers.bookhub.com/great-adventure-front.jpg',
'https://covers.bookhub.com/great-adventure-back.jpg'
],
genres: ['Fiction', 'Adventure'],
bookFormat: 'Hardcover'
})
};
fetch('https://bookhub-mock.onrender.com/books', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://bookhub-mock.onrender.com/books",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'The Great Adventure',
'author' => 'Jane Smith',
'description' => 'An epic tale of courage and discovery',
'language' => 'en-US',
'publisher' => 'Adventure Books Inc',
'publishedDate' => '2024-03-15',
'isbn' => '978-0-1234-5678-9',
'price' => 24.99,
'coverImages' => [
'https://covers.bookhub.com/great-adventure-front.jpg',
'https://covers.bookhub.com/great-adventure-back.jpg'
],
'genres' => [
'Fiction',
'Adventure'
],
'bookFormat' => 'Hardcover'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://bookhub-mock.onrender.com/books"
payload := strings.NewReader("{\n \"title\": \"The Great Adventure\",\n \"author\": \"Jane Smith\",\n \"description\": \"An epic tale of courage and discovery\",\n \"language\": \"en-US\",\n \"publisher\": \"Adventure Books Inc\",\n \"publishedDate\": \"2024-03-15\",\n \"isbn\": \"978-0-1234-5678-9\",\n \"price\": 24.99,\n \"coverImages\": [\n \"https://covers.bookhub.com/great-adventure-front.jpg\",\n \"https://covers.bookhub.com/great-adventure-back.jpg\"\n ],\n \"genres\": [\n \"Fiction\",\n \"Adventure\"\n ],\n \"bookFormat\": \"Hardcover\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://bookhub-mock.onrender.com/books")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"The Great Adventure\",\n \"author\": \"Jane Smith\",\n \"description\": \"An epic tale of courage and discovery\",\n \"language\": \"en-US\",\n \"publisher\": \"Adventure Books Inc\",\n \"publishedDate\": \"2024-03-15\",\n \"isbn\": \"978-0-1234-5678-9\",\n \"price\": 24.99,\n \"coverImages\": [\n \"https://covers.bookhub.com/great-adventure-front.jpg\",\n \"https://covers.bookhub.com/great-adventure-back.jpg\"\n ],\n \"genres\": [\n \"Fiction\",\n \"Adventure\"\n ],\n \"bookFormat\": \"Hardcover\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://bookhub-mock.onrender.com/books")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"The Great Adventure\",\n \"author\": \"Jane Smith\",\n \"description\": \"An epic tale of courage and discovery\",\n \"language\": \"en-US\",\n \"publisher\": \"Adventure Books Inc\",\n \"publishedDate\": \"2024-03-15\",\n \"isbn\": \"978-0-1234-5678-9\",\n \"price\": 24.99,\n \"coverImages\": [\n \"https://covers.bookhub.com/great-adventure-front.jpg\",\n \"https://covers.bookhub.com/great-adventure-back.jpg\"\n ],\n \"genres\": [\n \"Fiction\",\n \"Adventure\"\n ],\n \"bookFormat\": \"Hardcover\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Book already created",
"data": {
"bookId": "123e4567-e89b-41d4-a716-426614174000",
"title": "The Great Adventure",
"author": "Jane Smith",
"description": "An epic tale of courage and discovery",
"language": "en-US",
"publisher": "Adventure Books Inc",
"publishedDate": "2024-03-15",
"isbn": "978-0-1234-5678-9",
"price": 24.99,
"status": "PENDING",
"coverImages": [
"https://covers.bookhub.com/great-adventure-front.jpg"
],
"genres": [
"Fiction",
"Adventure"
],
"bookFormat": "Hardcover",
"createdDate": "2024-12-25T10:30:00Z",
"updatedDate": "2024-12-25T10:30:00Z"
}
}Authorizations
JWT obtained from the authentication endpoint
Headers
Unique key (UUID) for request deduplication. Reusing a key within its 24-hour validity window returns the original response instead of creating a duplicate resource. Keys match on the key value only, not the request body.
"550e8400-e29b-41d4-a716-446655440000"
Request tracking identifier
Publisher identifier
Body
Book title
255"The Great Adventure"
Primary author name
255"Jane Smith"
Book description or synopsis
5000"An epic tale of courage and discovery"
Publisher name
255"Adventure Books Inc"
Original publication date
"2024-01-15"
ISBN-10 or ISBN-13 identifier. Must be unique across the publisher's catalog. Duplicate ISBNs return 409 Conflict.
^(?:ISBN(?:-1[03])?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]$"978-0-1234-5678-9"
Base price in USD
x >= 0.0124.99
Book genres or categories
1 - 5 elements["Fiction", "Mystery", "Thriller"]
Physical or digital format
Paperback, Hardcover, eBook URLs to book cover images
1 - 5 elements