mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2026-01-09 11:19:36 +01:00
2.1 KiB
2.1 KiB
Account Management API
Overview
Manage user accounts, forwarding emails, locked inboxes, and API tokens.
Endpoints
GET /api/v1/account/
Get account info and stats for the authenticated user.
- Auth: Required
- Response:
userId,username,createdAt,lastLogin,verifiedEmails,lockedInboxes,apiToken
POST /api/v1/account/verify-email
Add a forwarding email (triggers verification).
- Auth: Required
- Body:
email: string (required)
- Response:
- Success or error
DELETE /api/v1/account/verify-email/:id
Remove a forwarding email by ID.
- Auth: Required
- Response:
- Success or error
POST /api/v1/account/change-password
Change account password.
- Auth: Required
- Body:
oldPassword,newPassword
- Response:
- Success or error
DELETE /api/v1/account/
Delete the user account.
- Auth: Required
- Response:
- Success or error
GET /api/v1/account/token
Get API token info (not the token itself).
- Auth: Required
- Response:
hasToken,createdAt,lastUsed
POST /api/v1/account/token
Generate or regenerate API token.
- Auth: Required
- Response:
- Success or error
DELETE /api/v1/account/token
Revoke API token.
- Auth: Required
- Response:
- Success or error
Response Format
All responses follow:
{
success: true|false,
data: ...,
error?: ...,
code?: ...
}
Error Codes
AUTH_DISABLED: Authentication is disabledVALIDATION_ERROR: Invalid inputREGISTRATION_FAILED: Registration failedNOT_FOUND: Resource not foundFORBIDDEN: Unauthorized
Example Response
{
"success": true,
"data": {
"userId": "abc123",
"username": "user1",
"createdAt": "2026-01-01T00:00:00Z",
"lastLogin": "2026-01-05T12:00:00Z",
"verifiedEmails": ["forward@example.com"],
"lockedInboxes": ["inbox1@example.com"],
"apiToken": {
"hasToken": true,
"createdAt": "2026-01-01T00:00:00Z",
"lastUsed": "2026-01-05T12:00:00Z"
}
}
}