Bank Account API
Documentation on using the bank account API through OAuth2 in SePay.
Introduction
SePay's Bank Account API allows you to query detailed information about bank accounts added to SePay. You can get a list of accounts, view details of each account, and sub-accounts linked to it.
To use this API, you need the bank-account:read permission in the Access Token scope.
Endpoints
The Bank Account API provides the following endpoints:
/api/v1/bank-accountsGet list of all bank accounts
/api/v1/bank-accounts/{id}Get details of a specific bank account
/api/v1/bank-accounts/{id}/sub-accountsGet list of sub-accounts of a bank account
Get Bank Account List
/api/v1/bank-accountsAuthorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint returns a list of bank accounts belonging to your company.
Required permissions:
- Scope:
bank-account:read - User permission: Bank Account (View account list)
Query parameters:
curl -G "https://my.sepay.vn/api/v1/bank-accounts" \-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \--data-urlencode "page=1" \--data-urlencode "limit=20"
{
"status": "success",
"data": [
{
"id": 19,
"label": "Cty Demo",
"account_holder_name": "CONG TY TNHH DEMO",
"account_number": "0071000888888",
"accumulated": 1777283273.00,
"active": true,
"created_at": "2025-02-12 21:09:49",
"bank": {
"short_name": "Vietcombank",
"full_name": "Ngân hàng TMCP Ngoại Thương Việt Nam",
"code": "VCB",
"bin": "970436",
"icon_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank-icon.png",
"logo_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank.png"
}
},
{
"id": 18,
"label": null,
"account_holder_name": "NGUYEN VAN A",
"account_number": "0071000899999",
"accumulated": 2625076186.00,
"active": true,
"created_at": "2025-02-12 20:05:47",
"bank": {
"short_name": "Vietcombank",
"full_name": "Ngân hàng TMCP Ngoại Thương Việt Nam",
"code": "VCB",
"bin": "970436",
"icon_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank-icon.png",
"logo_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank.png"
}
}
],
"meta": {
"pagination": {
"total": 2,
"per_page": 20,
"current_page": 1,
"last_page": 1
}
}
}Get Bank Account Details
/api/v1/bank-accounts/{id}Authorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint returns detailed information of a bank account based on ID.
Required permissions:
- Scope:
bank-account:read - User permission: Bank Account (View account details)
Path parameters:
curl -X GET "https://my.sepay.vn/api/v1/bank-accounts/{id}" \-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"status": "success",
"data": {
"id": 19,
"label": "Cty Demo",
"account_holder_name": "CONG TY TNHH DEMO",
"account_number": "0071000888888",
"accumulated": 1777283273.00,
"active": true,
"created_at": "2025-02-12 21:09:49",
"bank": {
"short_name": "Vietcombank",
"full_name": "Ngân hàng TMCP Ngoại Thương Việt Nam",
"code": "VCB",
"bin": "970436",
"icon_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank-icon.png",
"logo_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank.png"
}
}
}Get Sub-Account List
/api/v1/bank-accounts/{id}/sub-accountsAuthorization: Bearer {YOUR_ACCESS_TOKEN}
This endpoint returns a list of sub-accounts of a bank account.
Required permissions:
- Scope:
bank-account:read - User permission: Bank Account (View account list)
Path parameters:
Query parameters:
curl -G "https://my.sepay.vn/api/v1/bank-accounts/{id}/sub-accounts" \-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \--data-urlencode "page=1" \--data-urlencode "limit=20"
{
"status": "success",
"data": [
{
"id": 25,
"bank_account_id": 19,
"account_number": "VCB0011ABC001",
"account_holder_name": "Chi nhánh 1",
"label": "CN1",
"acc_type": "Virtual",
"active": true,
"va_active": true,
"created_at": "2025-02-20 09:15:32",
"updated_at": "2025-02-20 09:15:32"
},
{
"id": 26,
"bank_account_id": 19,
"account_number": "VCB0011ABC002",
"account_holder_name": "Chi nhánh 2",
"label": "CN2",
"acc_type": "Virtual",
"active": true,
"va_active": true,
"created_at": "2025-02-20 09:16:05",
"updated_at": "2025-02-20 09:16:05"
}
],
"meta": {
"pagination": {
"total": 2,
"per_page": 20,
"current_page": 1,
"last_page": 1
}
}
}Error Codes
Below are the error codes that may be encountered when using the Bank Account API:
401unauthorizedToken is invalid or expired
403forbiddenNo permission to access this resource
404resource_not_foundBank account does not exist
Next Step
Next, learn about the Transaction API to get information about transactions related to bank accounts.