GET /bank-accounts/:id
Get a single bank account by id. Only accessible if the account is linked to the calling branch — otherwise returns 404.
Endpoint
http
GET /bank-accounts/:idFull URL: https://api.easyslip.com/v2/bank-accounts/:id
Authentication
Required. See Authentication Guide.
http
Authorization: Bearer YOUR_API_KEYRequest
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | number | Yes | The bank account id |
Type Definitions
typescript
// Response
interface GetBankAccountResponse {
success: true;
data: BankAccount;
}
interface BankAccount {
id: number;
bankCode: string;
bankNumber: string;
nameTh: string;
nameEn: string;
type: 'NATURAL' | 'JURISTIC';
extraVerify: string | null;
createdAt: string; // ISO 8601
updatedAt: string; // ISO 8601
}
// Error Response
interface ErrorResponse {
success: false;
error: {
code: string;
message: string;
};
}Examples
bash
curl -X GET https://api.easyslip.com/v2/bank-accounts/12345 \
-H "Authorization: Bearer YOUR_API_KEY"javascript
const getBankAccount = async (id) => {
const response = await fetch(`https://api.easyslip.com/v2/bank-accounts/${id}`, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const result = await response.json();
if (!result.success) {
throw new Error(result.error.message);
}
return result.data;
};
// Usage
const account = await getBankAccount(12345);
console.log('Account:', account.nameEn, account.bankNumber);php
function getBankAccount(int $id): array
{
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.easyslip.com/v2/bank-accounts/' . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY'
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if (!$result['success']) {
throw new Exception($result['error']['message']);
}
return $result['data'];
}
// Usage
$account = getBankAccount(12345);
print_r($account);python
import requests
def get_bank_account(account_id: int) -> dict:
response = requests.get(
f'https://api.easyslip.com/v2/bank-accounts/{account_id}',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
result = response.json()
if not result['success']:
raise Exception(result['error']['message'])
return result['data']
# Usage
account = get_bank_account(12345)
print('Account:', account['nameEn'], account['bankNumber'])Response
Success Response (200)
json
{
"success": true,
"data": {
"id": 12345,
"bankCode": "004",
"bankNumber": "123-4-56789-0",
"nameTh": "บริษัท ตัวอย่าง จำกัด",
"nameEn": "EXAMPLE CO., LTD.",
"type": "JURISTIC",
"extraVerify": null,
"createdAt": "2024-01-15T14:30:00+07:00",
"updatedAt": "2024-01-15T14:30:00+07:00"
}
}Error Responses
Bank Account Not Found (404)
json
{
"success": false,
"error": {
"code": "BANK_ACCOUNT_NOT_FOUND",
"message": "Bank account not found"
}
}Notes
- Returns
404 BANK_ACCOUNT_NOT_FOUNDif the account does not exist or is not linked to your branch — the two cases are intentionally indistinguishable.