Customer Profile and Sessions API
Base URL: http://localhost:8000/api/v1
Prefix: /accounts/customers
Auth: Customer JWT bearer token
Headers: Content-Type: application/json
1. Get Profile
Retrieves the authenticated customer profile.
/accounts/customers/me/Auth: Required
Headers
Authorization: Bearer {{access_token}}Success Example
{
"success": true,
"message": "",
"data": {
"customer": {
"id": "b6b542cc-e8fb-4dd2-a96a-6cb1fa62a498",
"full_name": "Jane Customer",
"email": "jane@example.com",
"phone": "+15125550103",
"avatar_url": "",
"avatar_upload_id": null,
"bio": "",
"roles": [
"buyer",
"renter"
],
"status": "active",
"is_email_verified": true,
"is_phone_verified": false
}
}
}Notes
-
Requires an authenticated active customer account.
-
The response excludes the password.
2. Update Profile
Updates the authenticated customer profile.
/accounts/customers/me/Auth: Required
Headers
Authorization: Bearer {{access_token}}Request Body
{
"full_name": "Jane Updated",
"phone": "+15125550103",
"avatar_upload_id": "59ed7663-357f-402f-b414-27d7f3b12e87",
"bio": "Property buyer and renter."
}Success Example
{
"success": true,
"message": "Customer profile updated successfully.",
"data": {
"customer": {
"id": "b6b542cc-e8fb-4dd2-a96a-6cb1fa62a498",
"full_name": "Jane Updated",
"email": "jane@example.com",
"phone": "+15125550103",
"avatar_url": "http://localhost:8000/api/v1/uploads/59ed7663-357f-402f-b414-27d7f3b12e87/content/",
"avatar_upload_id": "59ed7663-357f-402f-b414-27d7f3b12e87",
"bio": "Property buyer and renter.",
"roles": [
"buyer",
"renter"
],
"status": "active",
"is_email_verified": true,
"is_phone_verified": false
}
}
}Notes
-
All body fields are optional.
-
Allowed fields are
full_name,phone,avatar_upload_id, andbio. -
Send a completed managed upload ID, not a storage URL.
-
Phone numbers must be unique.
-
Changing the phone number resets phone verification.
-
Set
avatar_upload_idtonullto remove the current avatar.
3. Deactivate Account
Deactivates the authenticated customer account and logs out all devices.
/accounts/customers/me/Auth: Required
Headers
Authorization: Bearer {{access_token}}Success Example
{
"success": true,
"message": "Account deactivation requested successfully.",
"data": {}
}Notes
-
The account status becomes
deleted. -
The account is marked inactive.
-
All active sessions are revoked.
-
This action cannot be performed without customer authentication.
4. Get Security Information
Retrieves customer security and authentication details.
/accounts/customers/me/security/Auth: Required
Headers
Authorization: Bearer {{access_token}}Success Example
{
"success": true,
"message": "",
"data": {
"security": {
"email": "jane@example.com",
"phone": "+15125550103",
"is_email_verified": true,
"is_phone_verified": false,
"has_password": true,
"active_session_count": 2,
"last_login": "2026-10-06T09:30:00Z",
"date_joined": "2026-08-01T10:00:00Z",
"social_accounts": [
{
"provider": "google",
"provider_user_id": "google-user-id",
"email": "jane@example.com",
"created_at": "2026-08-01T10:05:00Z"
}
]
}
}
}Notes
-
social_accountsmay be an empty array. -
active_session_countincludes all non-revoked sessions. -
has_passwordisfalsefor accounts created only through OAuth.
5. List Sessions
Lists all active sessions for the authenticated customer.
/accounts/customers/me/sessions/Auth: Required
Headers
Authorization: Bearer {{access_token}}Success Example
{
"success": true,
"message": "",
"data": {
"sessions": [
{
"id": 12,
"jti": "6f1f0c55-ccf5-4e54-9d2c-45e1b7c0d0c1",
"ip_address": "192.168.1.20",
"user_agent": "Mozilla/5.0",
"created_at": "2026-10-06T09:00:00Z",
"last_active_at": "2026-10-06T09:30:00Z",
"expires_at": "2026-10-13T09:00:00Z",
"is_current": true
}
]
}
}Notes
-
Only active, non-revoked sessions are returned.
-
is_currentidentifies the session used for the current request.
6. Revoke Session
Revokes one active customer session.
/accounts/customers/me/sessions/{session_id}/Auth: Required
Headers
Authorization: Bearer {{access_token}}Success Example
{
"success": true,
"message": "Session revoked successfully.",
"data": {}
}Notes
-
is the numeric session ID returned by the list sessions endpoint.
-
Only sessions owned by the authenticated customer can be revoked.
-
Revoking an already revoked or unknown session returns
Session not found.
Common Success Format
{
"success": true,
"message": "Operation completed successfully.",
"data": {}
}Common Error Format
{
"success": false,
"message": "Validation failed.",
"errors": {
"field_name": [
"Error message."
]
}
}