TaskForge API uses JSON Web Tokens (JWT) for authentication. Every protected endpoint requires a valid access token in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/YamiDarknezz/task-forge-api/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header. Refresh tokens allow you to obtain new access tokens without re-entering credentials.
Token overview
| Token | Lifetime | Purpose |
|---|---|---|
| Access token | 1 hour (configurable via JWT_ACCESS_TOKEN_EXPIRES) | Authenticate requests to protected endpoints |
| Refresh token | 30 days (configurable via JWT_REFRESH_TOKEN_EXPIRES) | Obtain new access tokens; stored and tracked in the database |
- Register or log in to receive an access token and a refresh token.
- Include the access token in the
Authorization: Bearer <token>header on every request. - When the access token expires, call
POST /api/auth/refreshwith the refresh token to get a new access token. - Call
POST /api/auth/logoutto revoke the refresh token and end the session.
Registration
user role. Rate limited to 5 requests per hour.
Request body
Unique username. Must be 3–80 characters and contain only letters, numbers, underscores (
_), and hyphens (-).Unique email address. Must be a valid email format, 3–120 characters, with no consecutive dots.
Account password. Must be 8–128 characters and contain at least one uppercase letter, one lowercase letter, and one number.
User’s first name. Optional.
User’s last name. Optional.
Example
Password rules
Passwords are validated byapp/utils/validators.py and must meet all of the following:
- Minimum 8 characters, maximum 128 characters
- At least one uppercase letter (
A–Z) - At least one lowercase letter (
a–z) - At least one digit (
0–9)
Login
Request body
The registered email address.
The account password.
Example
Using access tokens
Include the access token in theAuthorization header of every request to a protected endpoint:
current_user_required middleware decorator (app/middleware/auth.py). If the token is missing, expired, or invalid, the server responds with 401 Unauthorized.
Refreshing tokens
Authorization header.
401 Unauthorized.
Logout
Authorization header. Revokes the given refresh token in the database, invalidating that session. The access token itself continues to be accepted until it naturally expires.
Request body
The refresh token to revoke.
Get current user
Change password
Request body
The user’s current password.
The new password. Must satisfy the same rules as registration: 8–128 characters, at least one uppercase letter, one lowercase letter, and one digit.
Role-based access control
Every user is assigned a role at registration. Two roles exist:| Role | Value | Description |
|---|---|---|
| Admin | admin | Full access to all users’ tasks and user management endpoints |
| User | user | Access limited to their own tasks and profile |
user role. Admin accounts must be created directly in the database or by an existing admin.
The RBAC decorators in app/middleware/rbac.py enforce these rules:
@admin_required— endpoint accessible only to users with roleadmin. Returns403 Forbiddenfor any other role.@role_required(RoleType.ADMIN, RoleType.USER)— endpoint accessible to any of the specified roles.@resource_owner_or_admin— endpoint accessible to the resource owner or any admin.
admin role include user management routes (GET /api/users, DELETE /api/users/<id>, etc.). Standard task endpoints use @resource_owner_or_admin, so admins can see and manage all tasks while regular users can only manage their own.
Rate limits on auth endpoints
| Endpoint | Limit |
|---|---|
POST /api/auth/register | 5 per hour |
POST /api/auth/login | 10 per hour |
POST /api/auth/change-password | 3 per hour |
RATELIMIT_ENABLED and RATELIMIT_DEFAULT environment variables.
Token expiration
Token lifetimes are set in the.env file: