---
title: Catalog API reference
description: Public book and author reads, buy links, JSON objects, errors, CORS, caching and rate limits.
order: 20
published: 2026-10-02
updated: 2026-10-02
---
## Base URL and discovery

The base URL is `https://thebookmarket.com/api/v1`. All responses are JSON with `content-type: application/json; charset=utf-8`. Keys use `snake_case`. Money is integer cents with an explicit `currency` (`"USD"`); timestamps are ISO-8601 UTC strings.

- [GET /api/v1](/api/v1) returns the API name, version, `docs_url`, `openapi_url` and an `endpoints` list of method, path and summary objects.
- [GET /api/v1/openapi.json](/api/v1/openapi.json) is the OpenAPI 3.1 specification for the v1 routes only.

Within v1, changes are additive: optional fields or new endpoints. Removing or renaming something requires v2. Ignore fields your integration does not use.

These catalog reads need no authentication or API key. There are no public write operations to use today. Agent-created drafts, the embed and the connector are coming soon.

## Read a book

`GET /api/v1/books/{author_slug}/{book_slug}` returns a `Book`. Replace both slugs with a real published book's slugs:

```sh
curl 'https://thebookmarket.com/api/v1/books/YOUR-AUTHOR-SLUG/YOUR-BOOK-SLUG'
```

Unknown, draft or deleted books, and books whose author persona is deleted, return `404 not_found`. A previously published book whose seller is no longer listed, or which an admin locked, returns 200 with `availability: "unavailable"` and `buy_url: null`. A renamed author slug may redirect with 301 or return 404; use the current slug when available.

## Book object

Illustrative values, not a live catalog entry:

```json
{
  "object": "book",
  "id": "book_…",
  "slug": "the-quiet-war",
  "title": "The Quiet War",
  "subtitle": null,
  "description": "Plain text. Paragraphs separated by \n\n. No HTML.",
  "author": { "name": "Jane Doe", "slug": "jane-doe", "url": "https://thebookmarket.com/jane-doe" },
  "url": "https://thebookmarket.com/jane-doe/the-quiet-war",
  "cover": { "url": "https://thebookmarket.com/covers/file_…", "width": 1600, "height": 2400 },
  "price": { "mode": "fixed", "amount_cents": 799, "minimum_cents": null, "currency": "USD", "display": "$7.99" },
  "availability": "on_sale",
  "buy_url": "https://thebookmarket.com/checkout/jane-doe/the-quiet-war",
  "sample_url": "https://thebookmarket.com/reader/jane-doe/the-quiet-war",
  "formats": ["epub", "mobi", "pdf"],
  "genre": "fantasy",
  "series": { "name": "The Ember Cycle", "slug": "ember-cycle", "position": 2 },
  "published_at": "2026-09-01T00:00:00.000Z",
  "is_adult_content": false,
  "drm_free": true
}
```

| Field | Meaning |
| --- | --- |
| `object` | `book`. |
| `id` | The public book identifier. Treat it as opaque. |
| `slug`, `title`, `subtitle` | Book slug, title and optional subtitle (`null` when absent). |
| `description` | Plain text, with paragraphs separated by `\n\n`; no HTML. Render as text. |
| `author` | Author `name`, `slug` and absolute public `url`. |
| `url` | Absolute public book page URL. |
| `cover` | Object with absolute original-image `url`, `width` and `height`; null if absent. Dimensions may be null. |
| `price` | See the price modes below. |
| `availability` | `on_sale` or `unavailable` today. `coming_soon` is reserved in the schema and not emitted today. |
| `buy_url` | Absolute checkout link, non-null only when `on_sale`. Guest checkout lets readers buy without an account. |
| `sample_url` | Absolute sample link, or null if there is no sample. |
| `formats` | Download formats available now. A sellable book includes `epub`; `mobi` and `pdf` appear only after conversion. |
| `genre` | A genre key, or null. |
| `series` | Series `name`, `slug` and `position`, or null if the book is not in a series. |
| `published_at` | Publication timestamp. |
| `is_adult_content` | Whether the book is marked as adult content. |
| `drm_free` | True: the files are DRM-free. |

### Price modes

| `price.mode` | Meaning |
| --- | --- |
| `fixed` | `amount_cents` is the list price in cents. |
| `free` | `amount_cents` is 0. |
| `pay_what_you_want` | `amount_cents` is null; `minimum_cents` is the minimum amount in cents. |

Use `price.display` for the human-readable price and `price.currency` for the currency. Do not render a null amount as a zero-price book. Only create a Buy link when both `availability === "on_sale"` and `buy_url` is non-null.

## Read an author

`GET /api/v1/authors/{author_slug}` returns an `Author`. An unknown or deleted author persona returns 404.

```sh
curl 'https://thebookmarket.com/api/v1/authors/YOUR-AUTHOR-SLUG'
```

### Author object

```json
{
  "object": "author",
  "slug": "jane-doe",
  "name": "Jane Doe",
  "bio": "Plain text or null.",
  "url": "https://thebookmarket.com/jane-doe",
  "portrait": { "url": "https://thebookmarket.com/portraits/file_…" },
  "books": [ { "object": "book", "...": "same Book shape" } ]
}
```

`object` is `author`; `slug` and `name` identify the public persona. `bio` is plain text or null. `url` is the absolute author page URL. `portrait` holds an absolute `url`, or is null when the author has no portrait.

`books` contains full Book objects, newest first, only for books that pass the seller listing gate and have a cover. The `"..."` in this illustrative object is shorthand for those Book fields, not a response field.

## Errors

Every non-2xx response uses this shape:

```json
{
  "error": {
    "code": "not_found",
    "message": "No book at that address.",
    "docs_url": "https://thebookmarket.com/developers/api#errors"
  }
}
```

| HTTP status | `error.code` | What your integration should do |
| --- | --- | --- |
| 400 | `invalid_request` | Check the supplied values. |
| 401 | `unauthorized` | The request is not authenticated; public catalog reads need no credentials. |
| 403 | `forbidden` | Do not retry unchanged. |
| 404 | `not_found` | Check the slugs and whether the book is published; hide the Buy button. |
| 409 | `conflict` | Resolve the conflict before trying again. |
| 429 | `rate_limited` | Wait for the `Retry-After` header's number of seconds. |
| 500 | `internal` | Show a temporary unavailable state and retry later. |

This is the shared v1 error vocabulary; not every code is produced by a public read. `invalid_request` may include `error.fields`, for example `[{ "field": "price.amount_cents", "message": "…" }]`. A 500 never includes a stack trace, SQL or provider text.

## CORS

Public GET responses send `Access-Control-Allow-Origin: *`. The API allows `GET, OPTIONS` and answers OPTIONS with 204. Credentials are never allowed: use an ordinary fetch without cookies or authorization headers.

## Caching and rate limits

Public 200 responses send `Cache-Control: public, max-age=60, stale-while-revalidate=300`. A 404 sends `Cache-Control: max-age=30`.

Public endpoints allow 120 requests per minute per IP. Over the limit, the response is 429 `rate_limited`, with `Retry-After` in seconds. Reuse responses when building a page or shelf; don't poll in a tight loop.

## Public data only

Responses never include emails, user IDs, Stripe IDs, storage keys or bucket names, consent state, sales numbers or internal scoring data.

## Build a page

Copy the working examples for [HTML](/developers/quickstart#render-a-book-from-the-api), [Next.js and React](/developers/nextjs), or [Astro](/developers/astro). The [agent guide](/developers/for-ai-agents) explains the human setup steps.
