Skip to main content
Version: 2.3.0

Get list of departments

Updated date: 18/08/2026
Updated by: VNPT eContract's team


Purpose​

The function performs retrieving a list of company departments.

  • Request URL: /api/departments
  • HTTP method: GET
  • Authorize: Bearer token
  • Parameter: Not required, but additional options can be added below to filter or search the list of departments.
KeyTypeDescription
searchstringSearch information by department name
pageintPage number (default is 1)
pagesizeintPage size (default is 10 records)

Sample request​

Query param:
page: 1
pageSize: 10
search: dochub
Request: /api/departments?page=1&pageSize=10&search=dochub

Sample response body​

{
"data": {
"items": [
{
"id": 33,
"name": "DocHub",
"code": "DHB",
"userCount": 2,
"users": [
{
"id": 6,
"createdDate": "2021-01-06T17:06:07.2893325",
"comId": 164,
"code": "USER01",
"name": "Nguyen Van A",
"phone": "",
"email": "email_address",
"username": "username1",
"isSelected": false
},
{
"id": 19,
"createdDate": "2021-01-08T16:09:39.9081934",
"comId": 164,
"code": "USER02",
"name": "Nguyen Van B",
"phone": "0919XXXXXX",
"email": "email_address",
"username": "username2",
"isSelected": false
}
]
}
],
"totalCount": 1,
"pageCount": 1,
"page": 1,
"pageSize": 10,
"hasNextPage": false,
"hasPreviousPage": false
},
"success": true,
"code": 0,
"messages": []
}

Response Body Description​

KeyTypeDescription
successbooleanResponse status (true: Success, false: Failure)
codeintResponse code from the system
messagesarrayList of messages returned by the system
dataobjectObject containing the list of departments and pagination data (see details below)

Details of data:​

KeyTypeDescription
itemsarrayList of detailed department information (see details below)
totalCountintTotal number of departments matching the filter criteria
pageCountintTotal number of pages
pageintCurrent page
pageSizeintNumber of records per page
hasNextPagebooleanWhether there is a next page (true: Yes, false: No)
hasPreviousPagebooleanWhether there is a previous page (true: Yes, false: No)

Details of objects in the items array:​

KeyTypeDescription
idintDepartment ID
namestringDepartment name
codestringDepartment code
userCountintTotal number of users belonging to the department
usersarrayList of users belonging to the department (see details below)

Details of objects in the users array:​

KeyTypeDescription
idintUser ID
createdDatestringUser account creation time (ISO 8601 format)
comIdintCompany ID
codestringUser code
namestringUser name
phonestringUser phone number (if available)
emailstringUser email address
usernamestringUser login name