Account Management
Manage user accounts including registration, authentication, and account deletion.
Overview
The Account Management API allows you to:
- Register new user accounts
- Authenticate users (login/logout)
- Deactivate user accounts
Register
Create a new user account.
Endpoint: POST /api/register
Request Body:
{
"fullName": "John Doe",
"email": "john@example.com",
"phoneNumber": "743389051",
"countryCode": "255",
"password": "your_secure_password"
}
Response:
{
"uuid": "user-uuid",
"fullName": "John Doe",
"email": "john@example.com",
"phoneNumber": "743389051",
"countryCode": "255"
}
After registration, you'll need to verify your email (if provided) and phone number.
Login
Authenticate a user and obtain a JWT token.
Endpoint: POST /api/logon
Request Body (with phone number):
{
"countryCode": "255",
"phoneNumber": "743389051",
"password": "your_password"
}
Request Body (with email):
{
"email": "john@example.com",
"password": "your_password"
}
Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"uuid": "user-uuid",
"email": "john@example.com",
"fullName": "John Doe",
"permissionLevel": 222
}
}
For details on using the JWT token, see the Authentication guide.
Logout
End the current user session.
Endpoint: GET /api/logout
Headers:
Authorization: Bearer YOUR_JWT_TOKEN
Response:
{
"message": "Logged out successfully"
}
Deactivate Account
Deactivate a user account. This is a soft delete—your account data is retained but marked as inactive.
Endpoint: DELETE /api/user/deactivate/:id
Headers:
Authorization: Bearer YOUR_JWT_TOKEN
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string | The user's database ID |
Response:
{
"message": "Account deactivated successfully"
}
Account deactivation is not immediate deletion. Your data will be retained for a period before permanent deletion. Contact support if you need to reactivate your account.