Skip to main content

List User

Description

Retrieve a paginated list of users with optional filtering and search capabilities.

Authentication

  • Required: Yes
  • Roles: Any authenticated user

Request

Headers

GET /v1/customer/user
Authorization: Bearer <token>
Content-Type: application/json

Query Parameters

ParameterTypeRequiredDefaultDescription
pagenumberNo1Page number for pagination
limitnumberNo20Number of items per page
searchstringNo-Search by email, name, or username
roleIdnumberNo-Filter by role ID
sortBystringNocreatedAtSort field (createdAt, firstName, lastName, username)
sortOrderstringNodescSort order (asc, desc)

Example Request

GET /v1/customer/user?page=1&limit=10&search=john&roleId=1&sortBy=firstName&sortOrder=asc

Response

Success Response (200)

{
"data": {
"users": [
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"username": "johndoe",
"email": "john@example.com",
"phoneNumber": "0123456789",
"description": "User description",
"roleId": 1,
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 25,
"totalPages": 3
}
}
}

Error Responses

Error Codes

  • E008_PARAMS_INVALID: Invalid request parameters

Example Usage

curl -X GET "https://api.stepx.io.vn/v1/customer/user?page=1&limit=10" \
-H "Authorization: Bearer <token>"
const response = await fetch('https://api.stepx.io.vn/v1/customer/user?page=1&limit=10', {
method: 'GET',
headers: {
'Authorization': 'Bearer <token>'
}
});

const data = await response.json();