Update Admin User
Update an existing admin user's password.
Endpoint
POST /admin/update
Authentication
Header | Value |
---|---|
Authorization | Bearer <jwt_token> |
Content-Type | application/json |
Request Body
Field | Type | Required | Description |
---|---|---|---|
id | string | ✅ | ID of the admin to update (cannot be changed) |
username | string | ✅ | Username of the admin to update (cannot be changed) |
password | string | ✅ | New password for the admin |
Example Request
curl -X POST \
'http://localhost:9000/admin/update' \
-H 'Authorization: Bearer <jwt_token>' \
-H 'Content-Type: application/json' \
-d '{
"id": "67ffc3f5a2120e73468ce66c",
"username": "admin",
"password": "newpassword123"
}'
Response
Success Response (200 OK)
{
"message": "Admin updated successfully"
}
Response Fields
Field | Type | Description |
---|---|---|
message | string | Confirmation message indicating successful admin update |
Notes
- Only admin users can update admin passwords
- The
id
andusername
fields are used for identification and cannot be changed - Password changes take effect immediately
- New passwords should follow security best practices
- The admin will need to re-authenticate with the new password