---
title: "Import reading history"
method: POST
path: "/api/import"
tags: ["books"]
---

# Import reading history

`POST /api/import`

## Request

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

**Access: write token.**

Upload a Goodreads or StoryGraph `.csv` export in multipart field `file`. It merges reading history with existing records. Taste updates continue in the background. Pass `reader_id` in the query string.

## Query parameters

- `reader_id` integer, nullable

## Response `200`

Successful Response

- ImportResult: POST /api/import — the summary + greeting (the full book list stays server-side).
  - `source` 'goodreads' | 'storygraph', required
  - `total_read` integer, required
  - `top_rated` ImportTopRated[], required
    - `title` string, required
    - `author` string, required
    - `rating` union, required
      - integer
      - number
  - `did_not_finish` BookRef[], required
    - `title` string, required
    - `author` string, required
  - `shelves` string[], required
  - `greeting` string, nullable, required

## Other responses

- `400`: Invalid input; see detail for the reason.
- `401`: Missing or unusable credential.
- `403`: Insufficient token scope or the reader is outside your account.
- `413`: The uploaded file exceeds this deployment's size limit.
- `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)
