Files
bookhoard/docs/developer/api/libraries/get_library_stats.md
T
John O'Keefe b77eab7ffd docs(libraries): Beam WO5 batch 5 — 11 endpoints backfilled + pilot recovery
Beam backfilled 11 library docs (CRUD, folders, visibility, browse, stats,
media-items) and re-attached frontmatter to create_collection.md — which had
silently lost its pilot version in cc893f75: the negative-test
'git checkout --' restored the OLD file because the pilot was never staged,
and a frontmatter-less doc is invisible to the gate. Claude restored the full
corrected pilot content (priority higher-wins, time.String() note, 409).

Claude registry: 11 entries + one inverted catch — DELETE /:id/folders DOES
bind {folder_path} (handler reuses AddLibraryFolderRequest); registry first
draft said bodyless. GET /:id/visibility returns joined
GetUserVisibleLibrariesRow (type_name etc.), not bare Libraries.

Gate-driven merges fixed create/get library response shapes (sqlc row keys:
created_by_admin_id, library_type_id, updated_at; dropped invented type/
folders/is_visible). Fixed invented request fields (user_id in
set-visibility; library_type_id in update). make test 9/9.
2026-10-24 16:18:48 -04:00

55 lines
1.3 KiB
Markdown

---
method: GET
path: /api/libraries/:id/stats
auth: jwt+admin
area: libraries
---
<!-- source: internal/handlers/library.go:303 LibraryHandler.GetLibraryStats -->
# Get Library Statistics
Get statistics for a specific library.
**Endpoint**: `GET /api/libraries/:id/stats`
**Auth**: Required (Admin only)
## Path Parameters
| Parameter | Type | Required | Description |
| --------- | ------------- | -------- | ------------ |
| id | string (UUID) | Yes | Library UUID |
## Request Headers
| Header | Type | Required | Description |
| ------------- | ------ | -------- | ----------------------------------- |
| Authorization | string | Yes | Bearer token (must have admin role) |
### Example Request
```http
GET /api/libraries/550e8400-e29b-41d4-a716-446655440000/stats
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
```
## Response (200 OK)
```json example-response
{
"library_id": "uuid",
"books": null,
"minutes": null,
"name": null,
"pages": null,
"sessions": null
}
```
## Error Responses
| Code | Description |
| ---- | ----------------------------------- |
| 401 | Invalid or expired token |
| 403 | User does not have admin privileges |
| 404 | Library not found |