---
title: "Add a new book"
method: POST
path: "/books"
tags: ["Books"]
---

# Add a new book

`POST /books`

Adds a new book to the bookstore

## Request body

- union
  - ProgrammingBook
    - `id` integer
    - `title` string, required
    - `description` string, required
    - `price` integer, required — Price in USD cents
    - `category` 'Programming', required
    - `author` union, required
      - object
        - `id` integer
        - `name` string, required
        - `photo` string
        - `biography` string
      - object
        - `id` integer, required
        - `name` string
        - `photo` string
        - `biography` string
    - `cover_image` string
  - FantasyBook
    - `id` integer
    - `title` string, required
    - `description` string, required
    - `price` integer, required — Price in USD cents
    - `category` 'Fantasy', required
    - `author` union, required
      - object
        - `id` integer
        - `name` string, required
        - `photo` string
        - `biography` string
      - object
        - `id` integer, required
        - `name` string
        - `photo` string
        - `biography` string
    - `cover_image` string
  - SciFiBook
    - `id` integer
    - `title` string, required
    - `description` string, required
    - `price` integer, required — Price in USD cents
    - `category` 'Sci-fi', required
    - `author` union, required
      - object
        - `id` integer
        - `name` string, required
        - `photo` string
        - `biography` string
      - object
        - `id` integer, required
        - `name` string
        - `photo` string
        - `biography` string
    - `cover_image` string

## Response `201`

Book created successfully

- union
  - ProgrammingBook
    - `id` integer
    - `title` string, required
    - `description` string, required
    - `price` integer, required — Price in USD cents
    - `category` 'Programming', required
    - `author` union, required
      - object
        - `id` integer
        - `name` string, required
        - `photo` string
        - `biography` string
      - object
        - `id` integer, required
        - `name` string
        - `photo` string
        - `biography` string
    - `cover_image` string
  - FantasyBook
    - `id` integer
    - `title` string, required
    - `description` string, required
    - `price` integer, required — Price in USD cents
    - `category` 'Fantasy', required
    - `author` union, required
      - object
        - `id` integer
        - `name` string, required
        - `photo` string
        - `biography` string
      - object
        - `id` integer, required
        - `name` string
        - `photo` string
        - `biography` string
    - `cover_image` string
  - SciFiBook
    - `id` integer
    - `title` string, required
    - `description` string, required
    - `price` integer, required — Price in USD cents
    - `category` 'Sci-fi', required
    - `author` union, required
      - object
        - `id` integer
        - `name` string, required
        - `photo` string
        - `biography` string
      - object
        - `id` integer, required
        - `name` string
        - `photo` string
        - `biography` string
    - `cover_image` string

---

[API](https://skmtc.dev/speakeasy-api/apis/bookstore-api.md) · [All operations](https://skmtc.dev/speakeasy-api/apis/bookstore-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/speakeasy-api/bookstore-api/revisions/b46c8a1b9720/schema)
