Skip to content

PATCH /bank-accounts/:id

Update a bank account. Partial update — send only the fields you want to change. Only accessible if the account is linked to the calling branch, otherwise returns 404.

Endpoint

http
PATCH /bank-accounts/:id

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

Authentication

Required. See Authentication Guide.

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

Request

Path Parameters

ParameterTypeRequiredDescription
idnumberYesThe bank account id

Body Parameters

All fields are optional. Provide only the ones you want to update.

ParameterTypeDescription
bankCodestringA valid code from GET /banks — validated if provided
bankNumberstringThe account number
nameThstringAccount holder name in Thai (≤255 chars)
nameEnstringAccount holder name in English (≤255 chars)
typestringAccount type — NATURAL or JURISTIC
extraVerifystring | nullVerify option for the bank — a valid option value to set, or null to clear. Validated per-bank (see GET /banks)

Request Body

json
{
  "nameEn": "EXAMPLE COMPANY LIMITED",
  "extraVerify": "REF-2024"
}

Type Definitions

typescript
// Request — all fields optional
interface UpdateBankAccountRequest {
  bankCode?: string;                   // validated against the bank list if provided
  bankNumber?: string;
  nameTh?: string;                     // ≤255 chars
  nameEn?: string;                     // ≤255 chars
  type?: 'NATURAL' | 'JURISTIC';
  extraVerify?: string | null;         // a valid option value to set, or null to clear (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 PATCH https://api.easyslip.com/v2/bank-accounts/12345 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nameEn": "EXAMPLE COMPANY LIMITED"
  }'
javascript
const updateBankAccount = async (id, changes) => {
  const response = await fetch(`https://api.easyslip.com/v2/bank-accounts/${id}`, {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(changes)
  });

  const result = await response.json();

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

  return result.data;
};

// Usage
const account = await updateBankAccount(12345, {
  nameEn: 'EXAMPLE COMPANY LIMITED'
});
php
function updateBankAccount(int $id, array $changes): array
{
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => 'https://api.easyslip.com/v2/bank-accounts/' . $id,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'PATCH',
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer YOUR_API_KEY',
            'Content-Type: application/json'
        ],
        CURLOPT_POSTFIELDS => json_encode($changes)
    ]);

    $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 = updateBankAccount(12345, [
    'nameEn' => 'EXAMPLE COMPANY LIMITED'
]);
python
import requests

def update_bank_account(account_id: int, changes: dict) -> dict:
    response = requests.patch(
        f'https://api.easyslip.com/v2/bank-accounts/{account_id}',
        headers={
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        json=changes
    )

    result = response.json()

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

    return result['data']

# Usage
account = update_bank_account(12345, {
    'nameEn': 'EXAMPLE COMPANY LIMITED'
})

Response

Success Response (200)

json
{
  "success": true,
  "data": {
    "id": 12345,
    "bankCode": "004",
    "bankNumber": "123-4-56789-0",
    "nameTh": "บริษัท ตัวอย่าง จำกัด",
    "nameEn": "EXAMPLE COMPANY LIMITED",
    "type": "JURISTIC",
    "extraVerify": "REF-2024",
    "createdAt": "2024-01-15T14:30:00+07:00",
    "updatedAt": "2024-01-16T09:15:00+07:00"
  }
}

Error Responses

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"
  }
}

Bank Account Not Found (404)

json
{
  "success": false,
  "error": {
    "code": "BANK_ACCOUNT_NOT_FOUND",
    "message": "Bank account not found"
  }
}

Updating extraVerify

extraVerify is validated against the target bank's supported options (the values from GET /banks). How it behaves depends on whether you also change bankCode.

Same bankCode (or bankCode omitted)

You sendResult
a valid extraVerify valueStored
extraVerify: nullCleared
extraVerify omittedLeft unchanged
an invalid value400 INVALID_EXTRA_VERIFY

Changing bankCode

When bankCode changes, extraVerify is re-resolved against the new bank:

New bankYou sendResult
has optionsa valid extraVerify valueStored
has optionsextraVerify omitted, and the old value is not valid for the new bank400 INVALID_EXTRA_VERIFY — you must send a valid one for the new bank
has no options(anything)Cleared (set to null)

Notes

  • Only the fields you send are changed; omitted fields keep their current values.
  • If bankCode is provided, it is validated against GET /banks.
  • extraVerify accepts a valid option value to set, null to clear, or omit to leave unchanged. See Updating extraVerify for how it interacts with a bankCode change.
  • Returns 404 BANK_ACCOUNT_NOT_FOUND if the account does not exist or is not linked to your branch.

Bank Slip Verification API for Thai Banking