User API
Manage user profile, credits, and account settings. See Overview for credits and rate limits.
Get Profile
GET /api/user/profileGet the current user’s profile.
Response
{
"id": "user-uuid",
"email": "user@example.com",
"name": "John Doe",
"avatar_url": "https://...",
"created_at": "2024-01-01T00:00:00Z",
"subscription": {
"status": "active",
"product_id": "prod_standard",
"period_end": "2024-02-01T00:00:00Z"
}
}Update Profile
PATCH /api/user/profileUpdate profile information.
Request
{
"name": "John Smith",
"email": "john.smith@example.com",
"avatar_url": "https://..."
}| Field | Type | Description |
|---|---|---|
name | string | Display name |
email | string | Email address |
avatar_url | string | Profile image URL |
Response
Returns the updated profile object.
Change Password
POST /api/user/passwordChange account password. Requires session authentication.
Request
{
"current_password": "old-password",
"new_password": "new-secure-password"
}Response
{
"success": true,
"message": "Password updated successfully"
}Password Requirements
- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
Get Credits
GET /api/user/creditsGet current credit balance and usage.
Response
{
"total_allocation": 10000,
"credits_used": 3500,
"credits_remaining": 6500,
"percentage_used": 35,
"usage_summary": {
"parse": 1500,
"extract": 1200,
"chat": 500,
"generate": 300
},
"period": {
"start": "2024-01-01T00:00:00Z",
"end": "2024-02-01T00:00:00Z"
},
"subscription": {
"status": "active",
"plan": "Standard",
"renews_at": "2024-02-01T00:00:00Z"
}
}Credit Usage by Operation
| Operation | Credits per Unit |
|---|---|
| Parse | 1.5 per page |
| Extract | 2.0 per extraction |
| Chat | 0.1 per query |
| Generate | 1.0 per document |
Usage History
Credit usage is tracked in usage_summary and broken down by operation type:
| Field | Description |
|---|---|
parse | Credits used for parsing |
extract | Credits used for extraction |
chat | Credits used for chat queries |
generate | Credits used for document generation |
Authentication Notes
| Endpoint | Auth Type |
|---|---|
| GET /api/user/profile | API Key or Session |
| PATCH /api/user/profile | API Key or Session |
| POST /api/user/password | Session only |
| GET /api/user/credits | API Key or Session |
The password change endpoint requires session authentication for security.
See also: Overview.
Last updated on