Skip to content

POST /bank-accounts

Create a bank account. The account is auto-linked to the calling branch, so it is visible to your branch immediately.

Endpoint

http
POST /bank-accounts

Full URL: https://api.easyslip.com/v2/bank-accounts

Authentication

Required. See Authentication Guide.

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Request

Parameters

ParameterTypeRequiredDescription
bankCodestringYesA valid code from GET /banks
bankNumberstringYesThe account number
nameThstringYesAccount holder name in Thai (≤255 chars)
nameEnstringYesAccount holder name in English (≤255 chars)
typestringYesAccount type — NATURAL or JURISTIC
extraVerifystringNoVerify option for the bank — must be one of the bank's supported option values (see GET /banks)

Request Body

json
{
  "bankCode": "004",
  "bankNumber": "123-4-56789-0",
  "nameTh": "บริษัท ตัวอย่าง จำกัด",
  "nameEn": "EXAMPLE CO., LTD.",
  "type": "JURISTIC"
}

serviceId is automatic

serviceId is set server-side from your API key — you cannot set it in the request.

Type Definitions

typescript
// Request
interface CreateBankAccountRequest {
  bankCode: string;                    // must be a valid code from GET /banks
  bankNumber: string;
  nameTh: string;                      // ≤255 chars
  nameEn: string;                      // ≤255 chars
  type: 'NATURAL' | 'JURISTIC';
  extraVerify?: string;                // must be one of the bank's extraVerify option values (see GET /banks)
}

// Response
interface BankAccountResponse {
  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 POST https://api.easyslip.com/v2/bank-accounts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bankCode": "004",
    "bankNumber": "123-4-56789-0",
    "nameTh": "บริษัท ตัวอย่าง จำกัด",
    "nameEn": "EXAMPLE CO., LTD.",
    "type": "JURISTIC"
  }'
javascript
const createBankAccount = async (account) => {
  const response = await fetch('https://api.easyslip.com/v2/bank-accounts', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(account)
  });

  const result = await response.json();

  if (!result.success) {
    throw new Error(result.error.message);
  }

  return result.data;
};

// Usage
const account = await createBankAccount({
  bankCode: '004',
  bankNumber: '123-4-56789-0',
  nameTh: 'บริษัท ตัวอย่าง จำกัด',
  nameEn: 'EXAMPLE CO., LTD.',
  type: 'JURISTIC'
});

console.log('Created account:', account.id);
php
function createBankAccount(array $account): array
{
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => 'https://api.easyslip.com/v2/bank-accounts',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer YOUR_API_KEY',
            'Content-Type: application/json'
        ],
        CURLOPT_POSTFIELDS => json_encode($account)
    ]);

    $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 = createBankAccount([
    'bankCode' => '004',
    'bankNumber' => '123-4-56789-0',
    'nameTh' => 'บริษัท ตัวอย่าง จำกัด',
    'nameEn' => 'EXAMPLE CO., LTD.',
    'type' => 'JURISTIC'
]);

echo "Created account: " . $account['id'];
python
import requests

def create_bank_account(account: dict) -> dict:
    response = requests.post(
        'https://api.easyslip.com/v2/bank-accounts',
        headers={
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        json=account
    )

    result = response.json()

    if not result['success']:
        raise Exception(result['error']['message'])

    return result['data']

# Usage
account = create_bank_account({
    'bankCode': '004',
    'bankNumber': '123-4-56789-0',
    'nameTh': 'บริษัท ตัวอย่าง จำกัด',
    'nameEn': 'EXAMPLE CO., LTD.',
    'type': 'JURISTIC'
})

print('Created account:', account['id'])

Response

Success Response (201)

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

Validation Error (400)

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "bankNumber: Too small: expected string to have >=1 characters"
  }
}

Invalid Bank Code (400)

json
{
  "success": false,
  "error": {
    "code": "INVALID_BANK_CODE",
    "message": "The provided bankCode is not supported"
  }
}

Invalid Extra Verify (400)

json
{
  "success": false,
  "error": {
    "code": "INVALID_EXTRA_VERIFY",
    "message": "The provided extraVerify is not a valid option for this bank"
  }
}

Duplicate Account (409)

json
{
  "success": false,
  "error": {
    "code": "BANK_ACCOUNT_DUPLICATE",
    "message": "An active account with the same bank code and number already exists"
  }
}

Notes

  • The new account is automatically linked to the calling branch — no separate link step is needed to use it from this branch.
  • bankCode must be a valid code from GET /banks.
  • extraVerify is optional. If provided, it must be one of the target bank's supported option values — otherwise 400 INVALID_EXTRA_VERIFY. The valid set is per-bank; call GET /banks and read that bank's extraVerify options.
  • A duplicate is defined as an active account with the same bankCode + bankNumber within your service.

Bank Slip Verification API for Thai Banking