API Reference
Base URL: https://api.yourdomain.com/v1
All requests must include the Authorization: Bearer <token> header.
Authentication
POST /auth/token
Content-Type: application/json
{
"email": "user@example.com",
"password": "secret"
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR...",
"expires_in": 3600
}
Documents
List documents
GET /documents?page=1&limit=20
Get document
GET /documents/:id
Create document
POST /documents
Content-Type: application/json
{
"title": "My Document",
"content": "<p>Hello world</p>",
"category": "guides"
}
Update document
PATCH /documents/:id
Content-Type: application/json
{
"title": "Updated Title"
}
Delete document
DELETE /documents/:id
Error Responses
All errors follow this shape:
{
"error": {
"code": "NOT_FOUND",
"message": "Document not found",
"status": 404
}
}
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid token |
FORBIDDEN | 403 | Insufficient permissions |
NOT_FOUND | 404 | Resource does not exist |
VALIDATION_ERROR | 422 | Request body is invalid |
RATE_LIMITED | 429 | Too many requests |