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:

GET
/api/v1/bank-accounts

Get list of all bank accounts

GET
/api/v1/bank-accounts/{id}

Get details of a specific bank account

GET
/api/v1/bank-accounts/{id}/sub-accounts

Get list of sub-accounts of a bank account


Get Bank Account List

GET
/api/v1/bank-accounts
Authorization: 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:

pageinteger
Page number, starting from 1
limitinteger
Number of results per page
1
2
3
4
curl -G "https://my.sepay.vn/api/v1/bank-accounts" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
--data-urlencode "page=1" \
--data-urlencode "limit=20"
RESPONSE
{
    "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

GET
/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:

idintegerrequired
Bank account ID
1
2
curl -X GET "https://my.sepay.vn/api/v1/bank-accounts/{id}" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
RESPONSE
{
    "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

GET
/api/v1/bank-accounts/{id}/sub-accounts
Authorization: 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:

idintegerrequired
Bank account ID

Query parameters:

pageinteger
Page number, starting from 1
limitinteger
Number of results per page
1
2
3
4
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"
RESPONSE
{
    "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:

401unauthorized

Token is invalid or expired

403forbidden

No permission to access this resource

404resource_not_found

Bank account does not exist


Next Step

Next, learn about the Transaction API to get information about transactions related to bank accounts.