Users¶
This section covers endpoints related to users within a company.
Overview¶
User endpoints allow you to:
- Retrieve the current authenticated user
- Fetch a specific user by ID
- List all users in the company
Most user operations require elevated permissions.
GET /api/v1/secure/currentuser¶
Return the current authenticated user from JWT claims.
Authentication required¶
Bearer JWT
Request¶
Headers¶
Response¶
{
"error": false,
"message": "current user",
"user": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"company_id": "string",
"role": "string"
}
}
Notes¶
- Data is extracted directly from the JWT
- No database lookup is performed
- Response is a simplified user object
Example¶
GET /api/v1/secure/user/:id¶
Retrieve a specific user by ID.
Authentication required¶
Bearer JWT
Request¶
Headers¶
Path params¶
id(required)
User ID
Response¶
{
"error": false,
"message": "user retrieved",
"user": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"company_id": "string",
"role": "string",
"avatar": "string",
"is_active": "boolean",
"meta": {},
"last_login": "string | null",
"last_logout": "string | null",
"created_at": "string"
}
}
Validation rules¶
idis required- Must be a valid identifier
- Caller must have manager-level or higher permissions
Example¶
Example error¶
GET /api/v1/secure/user/list¶
List all users in the current company.
Authentication required¶
Bearer JWT
Request¶
Headers¶
Response¶
{
"error": false,
"message": "users retrieved",
"users": [
{
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"company_id": "string",
"role": "string",
"avatar": "string",
"is_active": "boolean",
"meta": {},
"last_login": "string | null",
"last_logout": "string | null",
"created_at": "string"
}
],
"total": "integer"
}
Notes¶
- Returns users belonging to the same company
- Requires manager-level or higher permissions
- Pagination is applied internally but not exposed via request parameters
Example¶
Example response¶
Roles¶
The exact set of roles may vary, but commonly include:
systemmanageruser
Permissions for endpoints may depend on role level.
Best practices¶
- Use
currentuserfor session-aware features - Use
user/:idonly when necessary - Handle authorization errors explicitly
- Do not assume full user lists without pagination awareness