---
title: "Update Hardcover sync preferences"
method: PATCH
path: "/api/hardcover"
tags: ["books"]
---

# Update Hardcover sync preferences

`PATCH /api/hardcover`

## Request

- Base URL: `https://leafle.org` (the document declares no server; this is the origin it was published from)
- URL: `https://leafle.org/api/hardcover`
- Auth: HTTP bearer

**Access: write token.**

Change writing-back preferences and sync frequency. The connection must already exist (404 otherwise). Enabling writes requires suitable Hardcover permission; a missing permission is reported by the next sync. `reader_id` is a query parameter.

## Query parameters

- `reader_id` integer, nullable

## Request body

- PreferencesRequest: Both settings are optional: sending one must not reset the other.
  - `push_enabled` boolean, nullable
  - `sync_frequency` 'manual' | 'daily' | 'weekly', nullable

## Response `200`

Successful Response

- HardcoverConnection: GET/PATCH/DELETE /api/hardcover — the reader's Hardcover connection. Never carries a token. Connecting is not here at all: it is a browser redirect through Hardcover's approval screen (`/api/hardcover/authorize`), not something a JSON body can express.
  - `connected` boolean, required
  - `username` string
  - `push_enabled` boolean
  - `needs_reconnect` boolean
  - `connected_at` string, nullable
  - `last_sync_at` string, nullable
  - `last_sync_error` string, nullable
  - `books_synced` integer
  - `sync_frequency` string
  - `next_sync_at` string, nullable
  - `account_url` string, required
  - `available` boolean

## Other responses

- `401`: Missing or unusable credential.
- `403`: Insufficient token scope or the reader is outside your account.
- `404`: No such resource for this reader, or the requested daily find is unavailable.
- `422`: Validation Error

---

[API](https://skmtc.dev/leafle/apis/leafle-api.md) · [All operations](https://skmtc.dev/leafle/apis/leafle-api/llms.txt) · [OpenAPI document](https://skmtc.dev/leafle/apis/leafle-api/revisions/f2e56cb74495?raw)
