GET /users
Retrieve a paginated list of users.
Query Parameters
{
"page": 1,
"limit": 20,
"search": "john"
}
Response
{
"data": [
{
"id": 123,
"name": "John Doe",
"email": "john@example.com"
}
],
"meta": {
"page": 1,
"totalPages": 5,
"totalItems": 100
}
}
POST /users
Create a new user.
Request Body
{
"name": "Jane Smith",
"email": "jane@example.com",
"password": "SecurePass123"
}
Response
{
"id": 124,
"name": "Jane Smith",
"email": "jane@example.com",
"createdAt": "2025-09-17T12:34:56Z"
}
GET /users/:id
Retrieve a single user by ID.
Path Parameter
{ "id": 123 }
Response
{
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"createdAt": "2024-06-01T09:12:45Z"
}
PUT /users/:id
Update user information.
Request Body
{
"name": "Johnathan Doe",
"email": "johnathan@example.com"
}
Response
{
"id": 123,
"name": "Johnathan Doe",
"email": "johnathan@example.com",
"updatedAt": "2025-09-17T13:00:00Z"
}
DELETE /users/:id
Remove a user from the system.
Response
{ "message": "User deleted successfully" }
Authentication
All endpoints require a Bearer token in the Authorization header.
Authorization: Bearer your_jwt_token
Error Codes
{
"400": "Bad Request – validation error",
"401": "Unauthorized – invalid or missing token",
"403": "Forbidden – insufficient permissions",
"404": "Not Found – resource does not exist",
"500": "Internal Server Error – unexpected condition"
}