Bank List

POST

Retrieve a list of supported banks for account validation and disbursement.

Endpoint

POST /api/v1/bank-list

Request Headers

Header Required Description
Authorization Yes Bearer token from login
Content-Type Yes application/json
Accept Yes application/json

Request Parameters

No parameters required.

Request Body

Empty body or {}

{}

Response

Success Response

{
    "success": true,
    "message": "Bank list retrieved successfully",
    "data": [
        {
            "code": "1",
            "name": "Bank Central Asia"
        },
        {
            "code": "2",
            "name": "Bank Mandiri"
        },
        {
            "code": "3",
            "name": "Bank Rakyat Indonesia"
        },
        {
            "code": "4",
            "name": "Bank Negara Indonesia"
        }
    ],
    "meta": {
        "timestamp": "2025-01-15T10:30:00Z"
    }
}

Response Fields

Field Type Description
code string Unique identifier for the bank
name string Full official name of the bank

Code Examples

PHP Example

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://openapi.swiftrans.id:7654/api/v1/bank-list',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => '{}',
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer ' . $accessToken,
        'Content-Type: application/json',
        'Accept: application/json'
    ),
));

$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['success']) {
    echo "Available banks: " . count($result['data']) . "\n";
    foreach ($result['data'] as $bank) {
        echo $bank['code'] . " - " . $bank['name'] . "\n";
    }
} else {
    echo "Failed to retrieve bank list: " . $result['message'];
}

JavaScript Example

try {
    const response = await fetch('https://openapi.swiftrans.id:7654/api/v1/bank-list', {
        method: 'POST',
        headers: {
            'Authorization': `Bearer ${accessToken}`,
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        },
        body: JSON.stringify({})
    });

    const result = await response.json();

    if (response.ok && result.success) {
        console.log(`Available banks: ${result.data.length}`);
        result.data.forEach(bank => {
            console.log(`${bank.code} - ${bank.name}`);
        });
    } else {
        console.error('Failed to retrieve bank list:', result.message);
    }
} catch (error) {
    console.error('Error retrieving bank list:', error);
}

cURL Example

curl -X POST https://openapi.swiftrans.id:7654/api/v1/bank-list \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{}'

Error Responses

Authentication Error

{
    "success": false,
    "message": "Unauthorized access",
    "error_code": "UNAUTHORIZED"
}

Service Unavailable

{
    "success": false,
    "message": "Bank list service temporarily unavailable",
    "error_code": "SERVICE_UNAVAILABLE"
}

Best Practices

  1. Cache Results: Store bank list locally and refresh periodically
  2. Display Options: Use bank_short_name for dropdowns and bank_name for details
  3. Error Handling: Implement proper error handling for service unavailability

Rate Limiting

  • Maximum 20 bank list requests per minute
  • Cache results to minimize repeated API calls