Skip to content

Branch Management

Manage branches for your EasySlip service. Branches allow you to organize API usage across different departments, locations, or applications.

List All Branches

http
GET /b2b/branches

Full URL: https://api.easyslip.com/b2b/branches

Permission: branch:read

Request

No request body required.

Examples

bash
curl -X GET https://api.easyslip.com/b2b/branches \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}"
javascript
const headers = signRequest({
    method: 'GET',
    path: '/b2b/branches',
    body: null,
    apiKey: 'your_api_key',
    secretKey: 'your_secret_key',
})

const response = await fetch('https://api.easyslip.com/b2b/branches', { headers })
const result = await response.json()

Success Response (200)

json
{
    "success": true,
    "data": [
        {
            "id": "cm1a2b3c4d5e6f7g8h9i0",
            "name": "สำนักงานใหญ่",
            "isActive": true,
            "ipAddress": null,
            "limitQuota": 10000,
            "usedQuota": 1500,
            "totalUsedQuota": 45000,
            "bankAccounts": [
                {
                    "id": "cm9z8y7x6w5v4u3t2s1r0",
                    "bankCode": "004",
                    "bankNumber": "123-4-56789-0",
                    "nameTh": "บริษัท อีซี่สลิป จำกัด",
                    "nameEn": "EasySlip Co., Ltd."
                }
            ],
            "createdAt": "2024-06-15T10:30:00+07:00",
            "updatedAt": "2024-12-01T14:00:00+07:00"
        },
        {
            "id": "cm2b3c4d5e6f7g8h9i0j1",
            "name": "สาขาเชียงใหม่",
            "isActive": true,
            "ipAddress": "203.150.100.50",
            "limitQuota": 5000,
            "usedQuota": 800,
            "totalUsedQuota": 12000,
            "bankAccounts": [],
            "createdAt": "2024-08-20T09:00:00+07:00",
            "updatedAt": "2024-11-15T16:30:00+07:00"
        }
    ]
}

Response Fields

FieldTypeDescription
idstringBranch ID
namestringBranch name
isActivebooleanWhether the branch is active
ipAddressstring | nullAllowed IP address (null = any IP)
limitQuotanumber | nullBranch quota limit (null = use service-level limit)
usedQuotanumberQuota used this period
totalUsedQuotanumberAll-time quota usage
bankAccountsarrayLinked bank accounts
createdAtstringCreation timestamp (ISO 8601)
updatedAtstringLast update timestamp (ISO 8601)

Get a Branch

http
GET /b2b/branches/:branchId

Full URL: https://api.easyslip.com/b2b/branches/:branchId

Permission: branch:read

Examples

bash
curl -X GET https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0 \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}"
javascript
const headers = signRequest({
    method: 'GET',
    path: '/b2b/branches/cm1a2b3c4d5e6f7g8h9i0',
    body: null,
    apiKey: 'your_api_key',
    secretKey: 'your_secret_key',
})

const response = await fetch(
    'https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0',
    { headers }
)
const result = await response.json()

Success Response (200)

json
{
    "success": true,
    "data": {
        "id": "cm1a2b3c4d5e6f7g8h9i0",
        "name": "สำนักงานใหญ่",
        "isActive": true,
        "ipAddress": null,
        "limitQuota": 10000,
        "usedQuota": 1500,
        "totalUsedQuota": 45000,
        "bankAccounts": [
            {
                "id": "cm9z8y7x6w5v4u3t2s1r0",
                "bankCode": "004",
                "bankNumber": "123-4-56789-0",
                "nameTh": "บริษัท อีซี่สลิป จำกัด",
                "nameEn": "EasySlip Co., Ltd."
            }
        ],
        "createdAt": "2024-06-15T10:30:00+07:00",
        "updatedAt": "2024-12-01T14:00:00+07:00"
    }
}

Error Response (404)

json
{
    "success": false,
    "error": {
        "code": "BRANCH_NOT_FOUND",
        "message": "Branch not found"
    }
}

Create a Branch

http
POST /b2b/branches

Full URL: https://api.easyslip.com/b2b/branches

Permission: branch:write

Request Body

FieldTypeRequiredDescription
namestringYesBranch name
limitQuotanumber | nullNoQuota limit (null or omit to use service-level limit)
bankAccountIdsstring[]NoBank account IDs to link

Examples

bash
curl -X POST https://api.easyslip.com/b2b/branches \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}" \
  -d '{
    "name": "สาขาขอนแก่น",
    "limitQuota": 3000,
    "bankAccountIds": ["cm9z8y7x6w5v4u3t2s1r0"]
  }'
javascript
const body = {
    name: 'สาขาขอนแก่น',
    limitQuota: 3000,
    bankAccountIds: ['cm9z8y7x6w5v4u3t2s1r0'],
}

const headers = signRequest({
    method: 'POST',
    path: '/b2b/branches',
    body,
    apiKey: 'your_api_key',
    secretKey: 'your_secret_key',
})

const response = await fetch('https://api.easyslip.com/b2b/branches', {
    method: 'POST',
    headers,
    body: JSON.stringify(body),
})
const result = await response.json()

Success Response (201)

json
{
    "success": true,
    "data": {
        "id": "cm3c4d5e6f7g8h9i0j1k2",
        "name": "สาขาขอนแก่น",
        "isActive": true,
        "ipAddress": null,
        "limitQuota": 3000,
        "usedQuota": 0,
        "totalUsedQuota": 0,
        "bankAccounts": [
            {
                "id": "cm9z8y7x6w5v4u3t2s1r0",
                "bankCode": "004",
                "bankNumber": "123-4-56789-0",
                "nameTh": "บริษัท อีซี่สลิป จำกัด",
                "nameEn": "EasySlip Co., Ltd."
            }
        ],
        "createdAt": "2025-01-10T11:00:00+07:00",
        "updatedAt": "2025-01-10T11:00:00+07:00"
    }
}

Update a Branch

http
PATCH /b2b/branches/:branchId

Full URL: https://api.easyslip.com/b2b/branches/:branchId

Permission: branch:write

Request Body

All fields are optional. Only include fields you want to update.

FieldTypeDescription
namestringBranch name
isActivebooleanActive status
ipAddressstring | nullAllowed IP address (null to allow any IP)
bankAccountIdsstring[]Replace linked bank accounts with this list

Examples

bash
curl -X PATCH https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0 \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}" \
  -d '{
    "name": "สำนักงานใหญ่ กรุงเทพฯ",
    "ipAddress": "203.150.100.10"
  }'
javascript
const body = {
    name: 'สำนักงานใหญ่ กรุงเทพฯ',
    ipAddress: '203.150.100.10',
}

const headers = signRequest({
    method: 'PATCH',
    path: '/b2b/branches/cm1a2b3c4d5e6f7g8h9i0',
    body,
    apiKey: 'your_api_key',
    secretKey: 'your_secret_key',
})

const response = await fetch(
    'https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0',
    {
        method: 'PATCH',
        headers,
        body: JSON.stringify(body),
    }
)
const result = await response.json()

Success Response (200)

json
{
    "success": true,
    "data": {
        "id": "cm1a2b3c4d5e6f7g8h9i0",
        "name": "สำนักงานใหญ่ กรุงเทพฯ",
        "isActive": true,
        "ipAddress": "203.150.100.10",
        "limitQuota": 10000,
        "usedQuota": 1500,
        "totalUsedQuota": 45000,
        "bankAccounts": [
            {
                "id": "cm9z8y7x6w5v4u3t2s1r0",
                "bankCode": "004",
                "bankNumber": "123-4-56789-0",
                "nameTh": "บริษัท อีซี่สลิป จำกัด",
                "nameEn": "EasySlip Co., Ltd."
            }
        ],
        "createdAt": "2024-06-15T10:30:00+07:00",
        "updatedAt": "2025-01-10T15:00:00+07:00"
    }
}

Delete a Branch

http
DELETE /b2b/branches/:branchId

Full URL: https://api.easyslip.com/b2b/branches/:branchId

Permission: branch:write

WARNING

This performs a soft delete. The branch will be deactivated and marked as deleted, but its data is retained.

Examples

bash
curl -X DELETE https://api.easyslip.com/b2b/branches/cm2b3c4d5e6f7g8h9i0j1 \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}"
javascript
const headers = signRequest({
    method: 'DELETE',
    path: '/b2b/branches/cm2b3c4d5e6f7g8h9i0j1',
    body: null,
    apiKey: 'your_api_key',
    secretKey: 'your_secret_key',
})

const response = await fetch(
    'https://api.easyslip.com/b2b/branches/cm2b3c4d5e6f7g8h9i0j1',
    { method: 'DELETE', headers }
)
const result = await response.json()

Success Response (200)

json
{
    "success": true,
    "data": {
        "id": "cm2b3c4d5e6f7g8h9i0j1",
        "name": "สาขาเชียงใหม่",
        "isActive": false,
        "deletedAt": "2025-01-10T16:00:00+07:00"
    }
}

Error Responses

Branch Not Found (404)

json
{
    "success": false,
    "error": {
        "code": "BRANCH_NOT_FOUND",
        "message": "Branch not found"
    }
}

Validation Error (400)

json
{
    "success": false,
    "error": {
        "code": "VALIDATION_ERROR",
        "message": "Branch name is required"
    }
}

Bank Slip Verification API for Thai Banking