API Danh sách Công ty
API lấy danh sách công ty đã được tạo trên hệ thống Bank Hub. Hỗ trợ phân trang và lọc theo trạng thái.
API Endpoint
GET
https://bankhub-api-sandbox.sepay.vn/v1/companyQuery Parameters
pageinteger
Số trang cần lấy
Mặc định:1per_pageinteger
Số item mỗi trang
Mặc định:20qstring
Từ khóa tìm kiếm (tìm trong full_name)
statusenum
Lọc theo trạng thái
sort[created_at]enum
Sắp xếp theo created_at
Mặc định:descLưu ý
- API này yêu cầu Bearer Token trong header Authorization
- Kết quả được sắp xếp theo thời gian tạo mới nhất
- Trường
activecho biết công ty có đang hoạt động hay không (1 = Active, 0 = Pending)
API Response
Response 200 - Thành công
{
"data": [
{
"xid": "string",
"full_name": "string",
"status": "string",
"active": "string",
"created_at": "string",
"updated_at": "string"
}
],
"meta": {
"per_page": 0,
"total": 0,
"has_more": true,
"current_page": 0,
"page_count": 0
}
}dataarray<object>
Danh sách công ty
metaobject
Thông tin phân trang
Code mẫu
1
2
3
curl --request GET \--url 'https://bankhub-api-sandbox.sepay.vn/v1/company?page=SOME_INTEGER_VALUE&per_page=SOME_INTEGER_VALUE&q=SOME_STRING_VALUE&status=SOME_STRING_VALUE&sort%5Bcreated_at%5D=SOME_STRING_VALUE' \--header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
Ví dụ sử dụng
JSLấy trang đầu tiên với 10 công ty
1
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/company?per_page=10&page=1' \\\n --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
JSPhân trang - Lấy trang 2
1
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/company?page=2' \\\n --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
JSLọc chỉ công ty đang hoạt động
1
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/company?status=Active' \\\n --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
JSLọc chỉ công ty với trạng thái đang chờ
1
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/company?status=Pending' \\\n --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Lưu ý về Performance
- Nên sử dụng
per_pagephù hợp để tối ưu hiệu suất - Không nên lấy quá nhiều công ty trong một lần request
- Sử dụng
has_moređể kiểm tra còn dữ liệu hay không thay vì dựa vàopage_count