Reference

User Endpoints


User Management

Create User

1
POST /api/v1/users
2
Authorization: Bearer <token>
3
Content-Type: application/json
4
5
{
6
"email": "newuser@example.com",
7
"name": "Jane Smith",
8
"password": "secure-password",
9
"roles": ["developer"]
10
}

Response:

1
{
2
"user_id": "usr_456",
3
"email": "newuser@example.com",
4
"name": "Jane Smith",
5
"roles": ["developer"],
6
"created_at": "2024-01-07T12:00:00Z"
7
}

List Users

1
GET /api/v1/users?limit=50&offset=0
2
Authorization: Bearer <token>

Response:

1
{
2
"users": [
3
{
4
"user_id": "usr_123",
5
"email": "user@example.com",
6
"name": "John Doe",
7
"roles": ["admin"],
8
"created_at": "2024-01-01T00:00:00Z"
9
}
10
],
11
"total": 15,
12
"limit": 50,
13
"offset": 0
14
}

Get User

1
GET /api/v1/users/:user_id
2
Authorization: Bearer <token>

Update User

1
PUT /api/v1/users/:user_id
2
Authorization: Bearer <token>
3
Content-Type: application/json
4
5
{
6
"name": "John Updated",
7
"roles": ["admin", "developer"]
8
}

Delete User

1
DELETE /api/v1/users/:user_id
2
Authorization: Bearer <token>

Change Password

1
POST /api/v1/users/:user_id/password
2
Authorization: Bearer <token>
3
Content-Type: application/json
4
5
{
6
"currentPassword": "old-password",
7
"newPassword": "new-secure-password"
8
}

Reset Password

1
POST /api/v1/users/:user_id/password/reset
2
Authorization: Bearer <token>

Lock User Account

1
POST /api/v1/users/:user_id/lock
2
Authorization: Bearer <token>

Assign Roles

1
POST /api/v1/users/:user_id/roles
2
Authorization: Bearer <token>
3
Content-Type: application/json
4
5
{
6
"roles": ["admin", "developer"]
7
}

Get User Activity

1
GET /api/v1/users/:user_id/activity
2
Authorization: Bearer <token>

Get User Preferences

1
GET /api/v1/users/:user_id/preferences
2
Authorization: Bearer <token>

Update User Preferences

1
PUT /api/v1/users/:user_id/preferences
2
Authorization: Bearer <token>
3
Content-Type: application/json
4
5
{
6
"theme": "dark",
7
"notifications": true,
8
"timezone": "America/New_York"
9
}

Next Steps