# buzz.bookhive.getPersonalLibrary

> Get the authenticated user's personal ebook library.

- Kind: query
- Authority: bookhive.buzz
- Lexicon: 1
- Published by [bookhive.buzz](https://lexicon.garden/identity/did:plc:enu2j5xjlqsjaylv3du4myh4), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:enu2j5xjlqsjaylv3du4myh4/buzz.bookhive.getPersonalLibrary)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:enu2j5xjlqsjaylv3du4myh4/buzz.bookhive.getPersonalLibrary/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:enu2j5xjlqsjaylv3du4myh4/buzz.bookhive.getPersonalLibrary/analytics)

## Query (`buzz.bookhive.getPersonalLibrary`)

Type: query · GET

### Parameters (query string)

- `cursor` (string): Pagination cursor
- `limit` (integer): Maximum number of books to return
  - Constraints: minimum: 1, maximum: 100, default: 24
- `q` (string): Case-insensitive substring match against title or authors. Mirrors the OPDS search feed.
  - Constraints: minLength: 1, maxLength: 256
- `shelfId` (integer): Filter by personal shelf ID
- `sort` (string): Result ordering. `recent` is newest-added first (the default, matching the library page and the OPDS /all feed); `title` and `author` are ascending alphabetical, matching the OPDS search results feed. Not switched implicitly when `q` is set — pass it explicitly.
  - Constraints: default: "recent", knownValues: recent | title | author

### Output (application/json)

- `books` (array, required)
  - `items` (ref)
    - Reference: `#personalBookView`
- `cursor` (string): Pagination cursor for the next page
- `storage` (ref): This user's storage usage against their quota
  - Reference: `#storageView`
- `total` (integer): Total number of books matching the query, across all pages

## #personalBookView (`buzz.bookhive.getPersonalLibrary#personalBookView`)

Type: object

### Properties

- `authors` (string): Authors of the book (tab-separated)
- `contentHash` (string, required): SHA-256 hash of the file content, used as stable identifier
- `coverUrl` (string): URL of the book cover image. When it points at the public catalog image proxy it needs no authentication; the `/library/covers/...` form is session-authenticated, so a client using service auth should use `hasLocalCover` and getPersonalBookCover instead.
- `createdAt` (string · datetime, required): When the book was added to the library
- `description` (string): Synopsis from the linked BookHive catalog entry. Deliberately unbounded: this is scraped catalog copy, not user input, and 125 of the 367k descriptions in production already exceed 5000 bytes (longest 10386). A maxLength here would be a contract the data violates, and enforcing it would mean truncating a synopsis mid-sentence.
- `filename` (string): Original uploaded file name. A sync client needs this to correlate the book with what is on the device.
- `format` (string, required): File format (e.g. epub, pdf, mobi, fb2, cbz)
- `hasLocalCover` (boolean): Whether a cover extracted from the uploaded file is stored. Fetch it with getPersonalBookCover, which works under any supported authentication.
- `hiveId` (string): Linked BookHive catalog entry ID
- `language` (string): Language of the book
- `mime` (string, required): MIME type of the file
- `progress` (ref): E-reader reading progress, when this book has been synced
  - Reference: `#syncProgressView`
- `shelfIds` (array): IDs of the personal shelves this book belongs to
  - `items` (integer)
- `sizeBytes` (integer, required): File size in bytes
- `title` (string, required): Title of the book
- `updatedAt` (string · datetime, required): When the book record was last updated

## #storageView (`buzz.bookhive.getPersonalLibrary#storageView`)

Type: object

### Properties

- `quotaBytes` (integer, required): Total bytes this user is allowed to store
  - Constraints: minimum: 0
- `usedBytes` (integer, required): Total bytes currently stored for this user
  - Constraints: minimum: 0

## #syncProgressView (`buzz.bookhive.getPersonalLibrary#syncProgressView`)

Type: object

### Properties

- `device` (string): Name of the device that last reported progress
- `percentage` (string, required): Reading progress as a fraction between 0 and 1
- `updatedAt` (string · datetime, required): When progress was last synced

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Get the authenticated user's personal ebook library.",
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "books": {
              "items": {
                "ref": "#personalBookView",
                "type": "ref"
              },
              "type": "array"
            },
            "cursor": {
              "description": "Pagination cursor for the next page",
              "type": "string"
            },
            "storage": {
              "description": "This user's storage usage against their quota",
              "ref": "#storageView",
              "type": "ref"
            },
            "total": {
              "description": "Total number of books matching the query, across all pages",
              "type": "integer"
            }
          },
          "required": [
            "books"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "cursor": {
            "description": "Pagination cursor",
            "type": "string"
          },
          "limit": {
            "default": 24,
            "description": "Maximum number of books to return",
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "q": {
            "description": "Case-insensitive substring match against title or authors. Mirrors the OPDS search feed.",
            "maxLength": 256,
            "minLength": 1,
            "type": "string"
          },
          "shelfId": {
            "description": "Filter by personal shelf ID",
            "type": "integer"
          },
          "sort": {
            "default": "recent",
            "description": "Result ordering. `recent` is newest-added first (the default, matching the library page and the OPDS /all feed); `title` and `author` are ascending alphabetical, matching the OPDS search results feed. Not switched implicitly when `q` is set — pass it explicitly.",
            "knownValues": [
              "recent",
              "title",
              "author"
            ],
            "type": "string"
          }
        },
        "type": "params"
      },
      "type": "query"
    },
    "personalBookView": {
      "properties": {
        "authors": {
          "description": "Authors of the book (tab-separated)",
          "type": "string"
        },
        "contentHash": {
          "description": "SHA-256 hash of the file content, used as stable identifier",
          "type": "string"
        },
        "coverUrl": {
          "description": "URL of the book cover image. When it points at the public catalog image proxy it needs no authentication; the `/library/covers/...` form is session-authenticated, so a client using service auth should use `hasLocalCover` and getPersonalBookCover instead.",
          "type": "string"
        },
        "createdAt": {
          "description": "When the book was added to the library",
          "format": "datetime",
          "type": "string"
        },
        "description": {
          "description": "Synopsis from the linked BookHive catalog entry. Deliberately unbounded: this is scraped catalog copy, not user input, and 125 of the 367k descriptions in production already exceed 5000 bytes (longest 10386). A maxLength here would be a contract the data violates, and enforcing it would mean truncating a synopsis mid-sentence.",
          "type": "string"
        },
        "filename": {
          "description": "Original uploaded file name. A sync client needs this to correlate the book with what is on the device.",
          "type": "string"
        },
        "format": {
          "description": "File format (e.g. epub, pdf, mobi, fb2, cbz)",
          "type": "string"
        },
        "hasLocalCover": {
          "description": "Whether a cover extracted from the uploaded file is stored. Fetch it with getPersonalBookCover, which works under any supported authentication.",
          "type": "boolean"
        },
        "hiveId": {
          "description": "Linked BookHive catalog entry ID",
          "type": "string"
        },
        "language": {
          "description": "Language of the book",
          "type": "string"
        },
        "mime": {
          "description": "MIME type of the file",
          "type": "string"
        },
        "progress": {
          "description": "E-reader reading progress, when this book has been synced",
          "ref": "#syncProgressView",
          "type": "ref"
        },
        "shelfIds": {
          "description": "IDs of the personal shelves this book belongs to",
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "sizeBytes": {
          "description": "File size in bytes",
          "type": "integer"
        },
        "title": {
          "description": "Title of the book",
          "type": "string"
        },
        "updatedAt": {
          "description": "When the book record was last updated",
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "contentHash",
        "title",
        "format",
        "mime",
        "sizeBytes",
        "createdAt",
        "updatedAt"
      ],
      "type": "object"
    },
    "storageView": {
      "properties": {
        "quotaBytes": {
          "description": "Total bytes this user is allowed to store",
          "minimum": 0,
          "type": "integer"
        },
        "usedBytes": {
          "description": "Total bytes currently stored for this user",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "usedBytes",
        "quotaBytes"
      ],
      "type": "object"
    },
    "syncProgressView": {
      "properties": {
        "device": {
          "description": "Name of the device that last reported progress",
          "type": "string"
        },
        "percentage": {
          "description": "Reading progress as a fraction between 0 and 1",
          "type": "string"
        },
        "updatedAt": {
          "description": "When progress was last synced",
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "percentage",
        "updatedAt"
      ],
      "type": "object"
    }
  },
  "id": "buzz.bookhive.getPersonalLibrary",
  "lexicon": 1
}
```
