Skip to main content
GET
/
v1
/
users
curl -X GET "https://api.trusec.io/v1/users?limit=20" \
  -H "Authorization: Bearer trusec_sk_your_api_key"
{
  "data": [
    {
      "id": "user_123",
      "email": "[email protected]",
      "name": "Jane Smith",
      "createdAt": "2024-01-15T10:00:00Z",
      "roles": ["role_admin"]
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "cur_abc123"
  }
}

List Users

Retrieve a paginated list of users in your organization.
limit
integer
default:"20"
Number of users to return (1-100)
cursor
string
Pagination cursor from previous response
email
string
Filter by email address
role
string
Filter by role ID
curl -X GET "https://api.trusec.io/v1/users?limit=20" \
  -H "Authorization: Bearer trusec_sk_your_api_key"
{
  "data": [
    {
      "id": "user_123",
      "email": "[email protected]",
      "name": "Jane Smith",
      "createdAt": "2024-01-15T10:00:00Z",
      "roles": ["role_admin"]
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "cur_abc123"
  }
}

Get User

Retrieve a specific user by ID.
id
string
required
The user ID
curl -X GET "https://api.trusec.io/v1/users/user_123" \
  -H "Authorization: Bearer trusec_sk_your_api_key"
{
  "data": {
    "id": "user_123",
    "email": "[email protected]",
    "name": "Jane Smith",
    "emailVerified": true,
    "createdAt": "2024-01-15T10:00:00Z",
    "updatedAt": "2024-01-20T15:30:00Z",
    "roles": ["role_admin"],
    "metadata": {
      "department": "Engineering"
    }
  }
}

Create User

Create a new user account.
email
string
required
User’s email address
name
string
User’s display name
password
string
Initial password (if not using passwordless)
roles
array
Array of role IDs to assign
metadata
object
Custom metadata object
curl -X POST "https://api.trusec.io/v1/users" \
  -H "Authorization: Bearer trusec_sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "name": "Jane Smith",
    "roles": ["role_user"]
  }'
{
  "data": {
    "id": "user_456",
    "email": "[email protected]",
    "name": "Jane Smith",
    "emailVerified": false,
    "createdAt": "2024-01-20T10:00:00Z",
    "roles": ["role_user"]
  }
}

Update User

Update an existing user’s profile.
id
string
required
The user ID
name
string
Updated display name
metadata
object
Updated metadata (merged with existing)
curl -X PATCH "https://api.trusec.io/v1/users/user_123" \
  -H "Authorization: Bearer trusec_sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Doe",
    "metadata": {
      "department": "Product"
    }
  }'
{
  "data": {
    "id": "user_123",
    "email": "[email protected]",
    "name": "Jane Doe",
    "updatedAt": "2024-01-20T16:00:00Z",
    "metadata": {
      "department": "Product"
    }
  }
}

Delete User

Permanently delete a user account.
id
string
required
The user ID
This action is irreversible. All user data will be permanently deleted.
curl -X DELETE "https://api.trusec.io/v1/users/user_123" \
  -H "Authorization: Bearer trusec_sk_your_api_key"