Users
Users API endpoint reference for the LegionEdge Platform
The Users API allows you to manage user accounts within your organization. All endpoints require authentication and appropriate permissions.
List Users
Retrieve a paginated list of users in an organization.
GET /v2/organizations/{orgId}/usersQuery Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
per_page | integer | 20 | Results per page (max 100) |
status | string | -- | Filter by status: active, suspended, pending |
search | string | -- | Search by name or email |
sort | string | created_at | Sort field: created_at, name, email, last_login_at |
order | string | desc | Sort order: asc, desc |
Example
const users = await client.users.list({
organizationId: "org_abc123",
status: "active",
search: "jane",
perPage: 50,
});
for (const user of users.data) {
console.log(`${user.name} <${user.email}> - ${user.status}`);
}Response
{
"data": [
{
"id": "user_abc123",
"email": "jane@example.com",
"name": "Jane Developer",
"avatarUrl": "https://cdn.legionedge.com/avatars/user_abc123.png",
"status": "active",
"emailVerified": true,
"createdAt": "2025-06-15T10:30:00Z",
"updatedAt": "2026-03-01T14:20:00Z",
"lastLoginAt": "2026-03-12T09:00:00Z"
}
],
"pagination": {
"total": 42,
"page": 1,
"perPage": 20,
"totalPages": 3,
"hasMore": true
}
}Get User
Retrieve a single user by ID.
GET /v2/users/{userId}const user = await client.users.get("user_abc123");
console.log(user.name, user.email);Create User (Invite)
Invite a new user to the organization. The user receives an email invitation.
POST /v2/organizations/{orgId}/usersRequest Body
{
"email": "bob@example.com",
"name": "Bob Engineer",
"role": "member",
"teams": ["team_frontend"]
}const invitation = await client.users.invite({
organizationId: "org_abc123",
email: "bob@example.com",
name: "Bob Engineer",
role: "member",
teams: ["team_frontend"],
});
console.log(`Invitation sent: ${invitation.id} (status: ${invitation.status})`);Update User
Update a user's profile or role.
PATCH /v2/users/{userId}const updated = await client.users.update("user_abc123", {
name: "Jane Senior Developer",
metadata: {
department: "Engineering",
title: "Senior Developer",
},
});Suspend User
Suspend a user, revoking all active sessions and API keys.
POST /v2/users/{userId}/suspendawait client.users.suspend("user_abc123");Delete User
Remove a user from the organization. This action is irreversible.
DELETE /v2/users/{userId}await client.users.delete("user_abc123");Next Steps
- Manage projects that users belong to.
- Configure authorization policies for user access.