Users API
Endpoints for managing user profiles, settings, and related data.Get Current User
Retrieve the authenticated user’s profile.curl -X GET "https://api.usmewe.com/v1/users/me" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"success": true,
"data": {
"id": "user_abc123",
"email": "user@example.com",
"displayName": "Alice",
"walletAddress": "0x1234...5678",
"trustScore": 56,
"level": "Gold",
"xp": 2450,
"createdAt": "2024-01-01T00:00:00Z",
"settings": {
"notifications": true,
"emailAlerts": true,
"language": "en"
}
}
}
Get User by ID
Retrieve a user’s public profile.curl -X GET "https://api.usmewe.com/v1/users/{userId}"
{
"success": true,
"data": {
"id": "user_abc123",
"displayName": "Alice",
"walletAddress": "0x1234...5678",
"trustScore": 56,
"level": "Gold",
"badges": ["early_adopter", "perfect_payer"],
"createdAt": "2024-01-01T00:00:00Z"
}
}
Private fields like email and settings are only visible to the user themselves.
Update Profile
Update the current user’s profile.curl -X PATCH "https://api.usmewe.com/v1/users/me" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"displayName": "Alice Smith",
"settings": {
"notifications": true,
"emailAlerts": false
}
}'
{
"success": true,
"data": {
"id": "user_abc123",
"displayName": "Alice Smith",
"settings": {
"notifications": true,
"emailAlerts": false,
"language": "en"
},
"updatedAt": "2024-01-15T12:00:00Z"
}
}
Updatable Fields
| Field | Type | Description |
|---|---|---|
displayName | string | Public display name |
settings.notifications | boolean | Push notifications |
settings.emailAlerts | boolean | Email notifications |
settings.language | string | Preferred language |
Get User XP & Level
Get detailed XP and level information.curl -X GET "https://api.usmewe.com/v1/users/{userId}/xp" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"success": true,
"data": {
"userId": "user_abc123",
"xp": 2450,
"level": "Gold",
"nextLevel": "Platinum",
"xpToNextLevel": 2550,
"progressPercent": 49,
"badges": [
{
"id": "early_adopter",
"name": "Early Adopter",
"earnedAt": "2024-01-01T00:00:00Z"
},
{
"id": "perfect_payer",
"name": "Perfect Payer",
"earnedAt": "2024-01-10T00:00:00Z"
}
]
}
}
Get User Activity
Get recent activity history.curl -X GET "https://api.usmewe.com/v1/users/me/activity?limit=10" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"success": true,
"data": [
{
"id": "act_1",
"type": "loan_repaid",
"description": "Repaid loan #123",
"xpEarned": 20,
"timestamp": "2024-01-15T10:00:00Z"
},
{
"id": "act_2",
"type": "vault_deposit",
"description": "Deposited 100 USDC",
"xpEarned": 25,
"timestamp": "2024-01-14T15:30:00Z"
}
],
"pagination": {
"total": 45,
"limit": 10,
"offset": 0,
"hasMore": true
}
}
Activity Types
| Type | Description |
|---|---|
loan_created | Created a loan request |
loan_repaid | Repaid a loan |
vault_deposit | Deposited to Trust Vault |
vault_withdraw | Withdrew from Trust Vault |
guardian_added | Added a guardian |
level_up | Leveled up |
Get User Guardians
List the user’s guardians.curl -X GET "https://api.usmewe.com/v1/users/me/guardians" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"success": true,
"data": [
{
"id": "guardian_1",
"walletAddress": "0xabc...def",
"displayName": "Bob",
"status": "active",
"addedAt": "2024-01-05T00:00:00Z"
},
{
"id": "guardian_2",
"walletAddress": "0x123...456",
"displayName": "Carol",
"status": "pending",
"addedAt": "2024-01-10T00:00:00Z"
}
]
}
Export User Data
Export all user data (GDPR compliance).curl -X GET "https://api.usmewe.com/v1/users/me/export" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"success": true,
"data": {
"profile": { ... },
"activity": [ ... ],
"loans": [ ... ],
"vaultHistory": [ ... ],
"guardians": [ ... ],
"exportedAt": "2024-01-15T12:00:00Z"
}
}
Delete Account
Request account deletion.curl -X DELETE "https://api.usmewe.com/v1/users/me" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"confirmation": "DELETE_MY_ACCOUNT"
}'
{
"success": true,
"message": "Account scheduled for deletion within 30 days",
"deletionDate": "2024-02-15T00:00:00Z"
}
Account deletion is irreversible. On-chain data cannot be deleted.
Error Responses
| Code | Error | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing token |
| 403 | FORBIDDEN | Access denied to resource |
| 404 | USER_NOT_FOUND | User does not exist |
| 422 | VALIDATION_ERROR | Invalid request data |