Users API
List Project Users
Section titled “List Project Users”GET /admin/projects/:projectId/usersAuthorization: Bearer <admin_token>Query Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Results per page (max 100) |
offset | number | 0 | Pagination offset |
Response
Section titled “Response”{ "users": [ { "user_id": "usr_abc123", "email": "user@example.com", "role": "member", "status": "active", "joined_at": "2025-03-10T14:30:00Z" }, { "user_id": "usr_def456", "email": "admin@example.com", "role": "admin", "status": "active", "joined_at": "2025-01-15T10:00:00Z" } ], "total": 2}Update User
Section titled “Update User”Change a user’s role or status within a project.
PATCH /admin/projects/:projectId/users/:userIdAuthorization: Bearer <admin_token>Content-Type: application/jsonRequest Body
Section titled “Request Body”| Field | Type | Description |
|---|---|---|
role | string | "admin" or "member" |
status | string | "active" or "blocked" |
Examples
Section titled “Examples”Block a user:
curl -X PATCH https://auth.beshoy.ai/admin/projects/proj_gym/users/usr_abc123 \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "status": "blocked" }'Promote to admin:
curl -X PATCH https://auth.beshoy.ai/admin/projects/proj_gym/users/usr_abc123 \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "role": "admin" }'Response
Section titled “Response”{ "ok": true }Remove User
Section titled “Remove User”Remove a user from a project entirely. This also revokes all their active sessions.
DELETE /admin/projects/:projectId/users/:userIdAuthorization: Bearer <admin_token>Example
Section titled “Example”curl -X DELETE https://auth.beshoy.ai/admin/projects/proj_gym/users/usr_abc123 \ -H "Authorization: Bearer $TOKEN"Response
Section titled “Response”{ "ok": true }Blocking vs. Removing
Section titled “Blocking vs. Removing”| Action | Effect | Reversible |
|---|---|---|
| Block | User can’t refresh tokens; existing access tokens expire in 5 min | Yes (set status back to “active”) |
| Remove | User removed from project; all sessions revoked; must be re-invited | Yes (re-add via invite) |
Blocking is preferred for temporary suspensions. Removal is for permanent access revocation.