Manage Users
User management in Nexla allows you to control access to the platform, manage permissions, and organize users within your organization. The system provides comprehensive APIs for user operations including creation, modification, and access control.
User Resources
User resources describe individual Nexla accounts. Every user has a corresponding User resource and may belong to one or more organizations through Org memberships. Users can access resources based on their organization memberships and assigned permissions.
Fetch Current User
Users can fetch their information by calling the GET /users endpoint. This response contains only one entry - their own information.
API Endpoint
The endpoint for fetching current user information is:
GET /users/current
- Nexla API
GET /users/current
Response Structure
The response includes comprehensive user information including profile details, organization memberships, and access permissions.
- Nexla API
[
{
"id": 42,
"email": "john.smith@example.com",
"full_name": "John Smith",
"api_key": "<API-Key>",
"super_user": true,
"impersonated": false,
"default_org": {
"id": 101,
"name": "Acme Corporation"
},
"org_memberships": [
{
"id": 101,
"name": "Acme Corporation",
"is_admin?": true,
"api_key": "<Org-API-Key>"
}
],
"email_verified_at": "2023-01-15T15:47:15.000Z",
"updated_at": "2023-01-15T21:48:10.000Z",
"created_at": "2023-01-15T15:47:15.000Z"
}
]
List All Users
Organization admins can list all users that belong to their org by including the access_role=all query param to the /users endpoint.
Admin Access Endpoint
To list all users in your organization:
GET /users?access_role=all
- Nexla API
GET /users?access_role=all
Admin Response Structure
The response includes all users in the organization with their profile information and membership details.
- Nexla API
[
{
"id": 41,
"email": "admin@example.com",
"full_name": "Admin User",
"api_key": "<API-Key>",
"super_user": true,
"impersonated": false,
"default_org": {
"id": 101,
"name": "Acme Corporation"
},
"org_memberships": [
{
"id": 101,
"name": "Acme Corporation",
"is_admin?": true,
"api_key": "<Org-API-Key>"
}
],
"email_verified_at": "2023-01-15T15:47:15.000Z",
"updated_at": "2023-01-15T15:47:15.000Z",
"created_at": "2023-01-15T15:47:15.000Z"
},
{
"id": 42,
"email": "john.smith@example.com",
"full_name": "John Smith",
"api_key": "<API-Key>",
"super_user": true,
"impersonated": false,
"default_org": {
"id": 101,
"name": "Acme Corporation"
},
"org_memberships": [
{
"id": 101,
"name": "Acme Corporation",
"is_admin?": true,
"api_key": "<Org-API-Key>"
}
],
"email_verified_at": "2023-01-15T15:47:15.000Z",
"updated_at": "2023-01-15T21:48:10.000Z",
"created_at": "2023-01-15T15:47:15.000Z"
}
]
Add User to Organization
Organization admins can add users to their organization and optionally make them org administrators. The payload should contain email, full_name and admin selection for creating a new user.
Add Member Endpoint
To add a user to your organization:
PUT /orgs/{org_id}
- Nexla API
PUT /orgs/101
{
"members": [
{
"email": "jane.doe@example.com",
"full_name": "Jane Doe",
"admin": false
}
]
}
User Management Operations
The Nexla API provides comprehensive user management capabilities beyond basic CRUD operations.
User Activation and Deactivation
You can control user access by activating or deactivating accounts:
PUT /users/{user_id}/activate
PUT /users/{user_id}/deactivate
Password Management
Users can change their passwords and reset forgotten passwords:
PUT /users/{user_id}/change_password
POST /users/reset_password
POST /users/set_password
Account Locking
For security purposes, you can lock and unlock user accounts:
PUT /users/{user_id}/lock_account
PUT /users/{user_id}/unlock_account
User Information Fields
User resources contain several important fields:
id: Unique identifier for the useremail: User's email address (used for login)full_name: User's display nameapi_key: Authentication key for API accesssuper_user: Whether the user has super user privilegesimpersonated: Whether the user is being impersonateddefault_org: User's primary organizationorg_memberships: List of organizations the user belongs toemail_verified_at: When the email was verifiedcreated_at: When the user account was createdupdated_at: When the user account was last updated
Organization Memberships
Users can belong to multiple organizations, with each membership having specific permissions:
id: Organization identifiername: Organization nameis_admin?: Whether the user is an admin in this organizationapi_key: Organization-specific API key
Best Practices
To effectively manage users in your Nexla platform:
- Use Descriptive Names: Choose clear, identifiable names for user accounts
- Implement Role-Based Access: Assign users to teams based on their responsibilities
- Regular Access Reviews: Periodically review user permissions and access
- Monitor User Activity: Track login history and resource access patterns
- Secure API Keys: Ensure API keys are kept secure and rotated regularly
Related Operations
After managing users, you may need to:
Manage Teams
GET /teams
POST /teams
PUT /teams/{team_id}/members
Control Resource Access
GET /resource_access
PUT /resource_access
View Audit Logs
GET /users/{user_id}/audit_log
GET /orgs/{org_id}/audit_log