Base URL http://localhost:8000
All requests (except login/register) require JWT token in header: ```
Authorization: Bearer <your_token>Format All responses are JSON with following structure:
{
"data": {},
"status": "success",
"code": 200
}{
"detail": "Error message",
"status": "error",
"code": 400
}GET /health
Check API health status.
Response:
{
"status": "ok"
}POST
/auth/register
Request Body:
{
"username": "john_doe",
"email": "john@example.com",
"full_name": "John Doe",
"password": "securepassword123"
}Response:
{
"id": 1,
"username": "john_doe",
"email": "john@example.com",
"full_name": "John Doe"
}POST /auth/login
Request Body:
{
"username": "john_doe",
"password": "securepassword123"
}Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 1800
}GET /users/me
Headers:
Authorization: Bearer <token>Response:
{
"id": 1,
"username": "john_doe",
"email": "john@example.com",
"full_name": "John Doe"
}GET /users/{id}
Headers:
Authorization: Bearer <token>Response:
{
"id": 1,
"username": "john_doe",
"email": "john@example.com",
"full_name": "John Doe"
}PUT /users/{id}
Headers:
Authorization: Bearer <token>Request Body:
{
"full_name": "John Updated",
"email": "newemail@example.com"
}Response:
{
"id": 1,
"username": "john_doe",
"email": "newemail@example.com",
"full_name": "John Updated"
}DELETE /users/{id}
Headers:
Authorization: Bearer <token>Response:
{
"message": "User deleted successfully"
}| Code | Message | Meaning |
|---|---|---|
| 200 | OK | Request successful |
| 400 | Bad Request | Invalid request data |
| 401 | Unauthorized | Missing or invalid token |
| 403 | Forbidden | No permission for resource |
| 404 | Not Found | Resource not found |
| 409 | Conflict | Resource already exists |
| 500 | Internal Server Error | Server error |
Currently no rate limiting implemented. Production deployments should implement rate limiting using middleware like slowapi.
List endpoints support pagination:
GET /users?skip=0&limit=10
Query Parameters:
skip(int): Number of items to skiplimit(int): Max items to return (default: 10, max: 100)
Response:
{
"total": 42,
"items": [],
"skip": 0,
"limit": 10
}