Get Current User
Retrieve information about the currently authenticated user.
Request
GET /api/v1/auth/me
Authentication
Bearer JWT - Requires a valid access token.
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Request Body
No request body required.
Response
Success Response (200 OK)
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"name": "John Doe",
"isOrgAdmin": true,
"platformRole": "USER",
"organizationId": "223e4567-e89b-12d3-a456-426614174001",
"organizationName": "Acme Corporation",
"organizationSlug": "acme-corporation",
"subscriptionTier": "BUSINESS",
"maxUsers": 50,
"maxResources": 100,
"mfaEnabled": true,
"organizationMfaRequired": false
}
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Unique user ID (UUID) |
| string | User's email address | |
| name | string | User's full name |
| isOrgAdmin | boolean | Whether the user has organization admin privileges |
| platformRole | string | Platform-level role (USER, SUPER_ADMIN) |
| organizationId | string | Organization ID (UUID) |
| organizationName | string | Organization name |
| organizationSlug | string | URL-friendly organization identifier |
| subscriptionTier | string | Organization subscription tier (FREE, BUSINESS, ENTERPRISE, PLATFORM) |
| maxUsers | number | Maximum number of users allowed in the organization |
| maxResources | number | Maximum number of cloud resources allowed in the organization |
| mfaEnabled | boolean | Whether MFA is enabled for this user |
| organizationMfaRequired | boolean | Whether MFA is required for all users in the organization |
Subscription Tier Limits
| Tier | Max Users | Max Resources | Features |
|---|---|---|---|
| FREE | 3 | 5 | Basic IP whitelisting |
| BUSINESS | 50 | 100 | API keys, priority support |
| ENTERPRISE | 500 | 1000 | SSO, custom integrations |
| PLATFORM | Unlimited | Unlimited | All features, super admin access |
Error Responses
| Status Code | Description |
|---|---|
| 401 Unauthorized | Missing, invalid, or expired access token |
| 403 Forbidden | User or organization is suspended |
| 429 Too Many Requests | Rate limit exceeded |
| 500 Internal Server Error | Server error occurred |
Example
curl -X GET https://api.entryguard.io/api/v1/auth/me \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjNlNDU2Ny1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJvcmdJZCI6IjIyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMSIsInJvbGVzIjpbIk9SR19BRE1JTiJdLCJpYXQiOjE3MDkwNDk2MDAsImV4cCI6MTcwOTA1MzIwMH0.xyz123"
Example Response
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"name": "John Doe",
"isOrgAdmin": true,
"platformRole": "USER",
"organizationId": "223e4567-e89b-12d3-a456-426614174001",
"organizationName": "Acme Corporation",
"organizationSlug": "acme-corporation",
"subscriptionTier": "BUSINESS",
"maxUsers": 50,
"maxResources": 100,
"mfaEnabled": true,
"organizationMfaRequired": false
}
Usage Notes
User Context
This endpoint is useful for:
- Displaying user information in the UI
- Checking user permissions and roles
- Determining available features based on subscription tier
- Verifying organization limits before creating resources or users
- Confirming MFA status
Token Validation
This endpoint also serves as a token validation mechanism. If the access token is valid, the endpoint returns user information. If invalid or expired, it returns a 401 Unauthorized error.
Example Usage in Application
// JavaScript example - fetch current user on app load
async function getCurrentUser() {
const accessToken = localStorage.getItem('accessToken');
try {
const response = await fetch('https://api.entryguard.io/api/v1/auth/me', {
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
if (!response.ok) {
if (response.status === 401) {
// Token expired, try to refresh
await refreshToken();
return getCurrentUser(); // Retry with new token
}
throw new Error('Failed to fetch user');
}
const user = await response.json();
return user;
} catch (error) {
console.error('Error fetching current user:', error);
// Redirect to login
window.location.href = '/login';
}
}