Skip to content

API Documentation

LibrisLog provides a full REST API with interactive documentation.

Interactive API Docs

Two documentation interfaces are available when the backend is running:

  • Swagger UI: http://localhost:8000/api/docs
  • ReDoc: http://localhost:8000/api/redoc

The OpenAPI schema is also available at:

  • JSON: http://localhost:8000/api/openapi.json

Authentication

All API endpoints (except health check and documentation) require authentication via an API key.

Creating an API Key

  1. Log in to the web application
  2. Go to your Profile page
  3. Scroll to the "API Keys" section
  4. Click "Create API Key"
  5. Enter a description (optional)
  6. Copy the key immediately — it is shown only once

API Keys

Using an API Key

Include the key in the X-API-Key header with every request:

bash
curl -H "X-API-Key: YOUR_KEY_HERE" http://localhost:8000/api/books

Example Request

bash
# List all books
curl -H "X-API-Key: YOUR_KEY_HERE" \
  http://localhost:8000/api/books

# Create a new book
curl -X POST \
  -H "X-API-Key: YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"title": "The Great Gatsby", "author": "F. Scott Fitzgerald"}' \
  http://localhost:8000/api/books

# Update reading status
curl -X POST \
  -H "X-API-Key: YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"new_status": "read"}' \
  http://localhost:8000/api/books/1/transition-status

Key Endpoints

Books

MethodEndpointDescription
GET/api/booksList all books
POST/api/booksCreate a book
GET/api/books/{id}Get book details
PUT/api/books/{id}Update book
DELETE/api/books/{id}Delete book
POST/api/books/{id}/transition-statusChange reading status

Progress

MethodEndpointDescription
GET/api/books/{id}/progressList progress entries
POST/api/books/{id}/progressAdd progress entry
PATCH/api/books/{id}/progress/{entry_id}Update progress date
DELETE/api/books/{id}/progress/{entry_id}Delete progress entry

Statistics

MethodEndpointDescription
GET/api/statisticsFull statistics
GET/api/statistics/pages-per-dayDaily page breakdown

Data Import/Export

MethodEndpointDescription
POST/api/data/exportExport data
POST/api/data/import/parseParse import file
POST/api/data/import/validateValidate import
POST/api/data/import/executeExecute import

Book Import (External Sources)

MethodEndpointDescription
GET/api/import/searchSearch external sources
GET/api/import/search/streamStream search progress
POST/api/importImport a candidate

Error Handling

The API returns standard HTTP status codes:

  • 200 — Success
  • 201 — Created
  • 204 — No content (delete success)
  • 400 — Bad request
  • 401 — Unauthorized (missing or invalid API key)
  • 404 — Not found
  • 409 — Conflict (e.g., duplicate ISBN)
  • 422 — Validation error

Error responses include a JSON body with details:

json
{
  "detail": "Book not found"
}

Released under the MIT License.