BookWish API
RESTful API for the BookWish platform.
Base URL
Production: https://api.bookwish.io/v1
Development: http://localhost:3000/v1
Authentication
BookWish uses JWT tokens for authentication.
Getting Tokens
POST /auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
Response:
{
"accessToken": "eyJ...",
"refreshToken": "eyJ...",
"user": { ... }
}
Using Tokens
Include the access token in the Authorization header:
Authorization: Bearer eyJ...
Refreshing Tokens
POST /auth/refresh
Content-Type: application/json
{
"refreshToken": "eyJ..."
}
API Structure
Core Endpoints
| Category | Base Path | Description |
|---|---|---|
| Auth | /auth | Authentication and account |
| Users | /users | User profiles and settings |
| Books | /books | Book catalog and search |
| Wishlists | /wishlists | Wishlist management |
| Orders | /orders | Order processing |
| Stores | /stores | Store profiles |
Social Endpoints
| Category | Base Path | Description |
|---|---|---|
| Lines | /lines | Short posts about books |
| Reviews | /reviews | Book reviews |
| Notes | /notes | Private reading notes |
| Follows | /follows | User/store following |
Store Operations
| Category | Base Path | Description |
|---|---|---|
| Inventory | /inventory | Store inventory |
| POS | /pos | Point of sale |
| Trade Credit | /trade-credit | Trade-in system |
Programs
| Category | Base Path | Description |
|---|---|---|
| Clubs | /clubs | Book clubs |
| Challenges | /challenges | Reading challenges |
Common Patterns
Pagination
List endpoints support cursor-based pagination:
GET /books?cursor=abc123&limit=20
Response includes:
{
"data": [...],
"nextCursor": "def456",
"hasMore": true
}
Filtering
Many endpoints support filtering:
GET /inventory?condition=used&category=fiction
Sorting
Specify sort order:
GET /books?sort=title&order=asc
Response Format
Success Response
{
"data": { ... },
"meta": {
"timestamp": "2024-01-15T10:30:00Z"
}
}
Error Response
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid email format",
"details": { ... }
}
}
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid token |
FORBIDDEN | 403 | Insufficient permissions |
NOT_FOUND | 404 | Resource not found |
VALIDATION_ERROR | 400 | Invalid request data |
RATE_LIMITED | 429 | Too many requests |
SERVER_ERROR | 500 | Internal server error |
Rate Limiting
API requests are rate limited:
| Tier | Limit |
|---|---|
| Guest | 60/minute |
| Free | 120/minute |
| Premium | 300/minute |
| Bookstore | 600/minute |
Rate limit headers:
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 118
X-RateLimit-Reset: 1673789400
Webhooks
BookWish can send webhooks for events:
- Order status changes
- Inventory updates
- New followers
Configure webhooks in store settings.
SDKs
Official SDKs:
- Flutter/Dart:
bookwish_apipackage - TypeScript:
@bookwish/api-client
API Versioning
The API is versioned via URL path:
/v1/books - Current stable version
/v2/books - Future version (when available)
Breaking changes result in new major versions.
Quick Reference
Book Search
GET /books?q=harry+potter
Add to Wishlist
POST /wishlists/{id}/items
{
"isbn": "9780143127741",
"bookData": { ... }
}
Create Order
POST /orders
{
"items": [...],
"fulfillmentType": "pickup",
"storeId": "..."
}
Check Availability
GET /books/availability?isbn=9780143127741
Support
For API questions:
- Check the detailed endpoint documentation
- Review error messages and codes
- Contact developer support