Users API¶
Base path: /api/v1/users
All user endpoints require authentication. Superuser privileges are needed for create, delete, and tier-update operations.
Create User¶
Auth: Superuser required
Request body (JSON):
{
"username": "jane",
"email": "jane@example.com",
"name": "Jane Doe",
"password": "securepassword",
"is_superuser": false
}
Response 201 Created:
{
"id": 2,
"username": "jane",
"email": "jane@example.com",
"name": "Jane Doe",
"is_superuser": false,
"is_active": true,
"created_at": "2024-01-15T10:00:00"
}
List Users¶
Returns a paginated list of users.
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
page |
integer |
1 |
Page number |
items_per_page |
integer |
10 |
Items per page |
Response 200 OK:
{
"items": [...],
"total": 50,
"total_count": 50,
"has_more": true,
"page": 1,
"items_per_page": 10
}
Get User¶
Path parameter: username
Response 200 OK: UserRead object (same as Create response).
Update User¶
Updates a user's own profile. Superusers can update any user.
Path parameter: username
Request body (JSON, all fields optional):
Response 200 OK:
Soft-Delete User¶
Auth: Superuser required
Marks the user as deleted (is_deleted=true, sets deleted_at). The user record is retained in the database.
Response 200 OK:
Hard-Delete User¶
Auth: Superuser required
Permanently removes the user record from the database.
Response 200 OK:
Get User Tier¶
Returns the tier assigned to a user.
Response 200 OK:
Returns null if the user has no tier assigned.
Update User Tier¶
Auth: Superuser required
Request body (JSON):
Response 200 OK: