Quick Start

Get started with SePay API - query transactions and bank account information in just 5 minutes.


API v1 Deprecated

API v1 is no longer being developed. Please use API v2 for new integrations. See the upgrade guide for details.

Sandbox Environment

If you need a test environment, register an account at my.dev.sepay.vn. Here you can create simulated transactions and API calls for development purposes. After registration, please contact SePay to activate your account.


Integration Overview

The diagram below illustrates the API integration flow — from creating an API token to querying bank accounts and transactions.

SePay API Integration Flow
Rendering diagram...

What can you do with SePay API?

  • Bank Accounts — List all linked bank accounts, get account details
  • Transactions — List transactions with filters, get transaction details
  • Counting — Count transactions and accounts for reporting

Quick Start

Step 1: Create API Token

Access API Settings

Log in to my.sepay.vn → go to Company SettingsAPI Access.

Add a New API Key

Click the + Add API button, fill in the required information, then click Add.

Copy Your Token

Copy the generated API token. You will use this token in the Authorization header for all API calls.

Keep Your API Token Secure
  • Never commit API tokens to source code — use environment variables instead
  • Your API Token has full access to all bank account and transaction data
  • Only call the API from server-side code — never expose your token in frontend JavaScript or mobile apps
  • If you suspect a token has been compromised, delete and create a new one immediately at API Access

Full guide: Create API Token


Step 2: Your First API Call — List Bank Accounts

cURL:

Bash
1
2
3
curl -X GET "https://my.sepay.vn/userapi/bankaccounts/list" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$apiToken = getenv('SEPAY_API_TOKEN');
 
$opts = [
'http' => [
'method' => 'GET',
'header' => "Content-Type: application/json\r\nAuthorization: Bearer $apiToken"
]
];
$context = stream_context_create($opts);
$response = file_get_contents('https://my.sepay.vn/userapi/bankaccounts/list', false, $context);
$data = json_decode($response, true);
 
print_r($data);
 

Sample response:

JSON
{
  "status": 200,
  "messages": { "success": true },
  "bankaccounts": [
    {
      "id": 123,
      "bank_short_name": "Vietcombank",
      "bank_full_name": "Joint Stock Commercial Bank for Foreign Trade of Vietnam",
      "account_number": "0071000888888",
      "account_holder_name": "NGUYEN VAN A",
      "accumulated": 19077000,
      "last_transaction_date": "2023-05-02 10:30:00"
    }
  ]
}

Step 3: List Transactions

cURL:

Bash
1
2
3
curl -X GET "https://my.sepay.vn/userapi/transactions/list" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$apiToken = getenv('SEPAY_API_TOKEN');
 
$opts = [
'http' => [
'method' => 'GET',
'header' => "Content-Type: application/json\r\nAuthorization: Bearer $apiToken"
]
];
$context = stream_context_create($opts);
$response = file_get_contents('https://my.sepay.vn/userapi/transactions/list', false, $context);
$data = json_decode($response, true);
 
print_r($data);
 

Sample response:

JSON
{
  "status": 200,
  "messages": { "success": true },
  "transactions": [
    {
      "id": 92704,
      "bank_brand_name": "Vietcombank",
      "account_number": "0071000888888",
      "transaction_date": "2023-05-02 10:30:00",
      "amount_out": 0,
      "amount_in": 2277000,
      "accumulated": 19077000,
      "transaction_content": "chuyen tien mua hang DH001",
      "reference_number": "MBVCB.3278907687",
      "code": "DH001",
      "sub_account": null,
      "bank_account_id": 123
    }
  ]
}

Step 4: Get Transaction Details

To retrieve details for a specific transaction, pass the transaction ID:

Bash
1
2
3
curl -X GET "https://my.sepay.vn/userapi/transactions/details/92704" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"

API Rate Limits

Rate Limiting

SePay API enforces a rate limit of 3 requests per second per API token.

  • When the limit is exceeded, the API returns HTTP status code 429 (Too Many Requests)
  • The response header x-sepay-userapi-retry-after indicates the number of seconds to wait before retrying

Next Steps

  1. SePay API Overview — Understand the full API architecture, authentication, and error handling
  2. Transaction API — Query, filter, and paginate transactions
  3. Bank Account API — Manage and query linked bank accounts
  4. VA Order API — Create and manage Virtual Account orders
  5. SePay Webhooks — Receive real-time transaction notifications via webhooks