Skip to content

Quota Management

Monitor and control quota usage for each branch. Quotas determine how many API calls a branch can make within a billing period.

Check Quota

http
GET /b2b/branches/:branchId/quota

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

Permission: quota:read

Examples

bash
curl -X GET https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0/quota \
  -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/quota',
    body: null,
    apiKey: 'your_api_key',
    secretKey: 'your_secret_key',
})

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

Success Response (200)

json
{
    "success": true,
    "data": {
        "branch": {
            "id": "cm1a2b3c4d5e6f7g8h9i0",
            "name": "สำนักงานใหญ่",
            "limitQuota": 10000,
            "usedQuota": 1500,
            "totalUsedQuota": 45000
        },
        "service": {
            "limitQuota": 50000,
            "usedQuota": 8500,
            "totalUsedQuota": 120000
        }
    }
}

Response Fields

FieldTypeDescription
branch.idstringBranch ID
branch.namestringBranch name
branch.limitQuotanumber | nullBranch-level quota limit (null = use service limit)
branch.usedQuotanumberBranch quota used this period
branch.totalUsedQuotanumberBranch all-time usage
service.limitQuotanumberService-level quota limit
service.usedQuotanumberService quota used this period
service.totalUsedQuotanumberService all-time usage

Set Quota Limit

Set an absolute quota limit for a branch.

http
PUT /b2b/branches/:branchId/quota

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

Permission: quota:write

Request Body

FieldTypeRequiredDescription
limitQuotanumber | nullYesNew quota limit, or null to use service-level limit

TIP

Setting limitQuota to null removes the branch-specific limit. The branch will then be constrained only by the service-level quota.

WARNING

You cannot set limitQuota below the current usedQuota. If the branch has already used 1500 calls, you cannot set the limit to 1000.

Examples

bash
curl -X PUT https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0/quota \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}" \
  -d '{"limitQuota": 15000}'
javascript
const body = { limitQuota: 15000 }

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

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

Success Response (200)

json
{
    "success": true,
    "data": {
        "id": "cm1a2b3c4d5e6f7g8h9i0",
        "name": "สำนักงานใหญ่",
        "limitQuota": 15000,
        "usedQuota": 1500,
        "totalUsedQuota": 45000
    }
}

Error Response (400)

json
{
    "success": false,
    "error": {
        "code": "VALIDATION_ERROR",
        "message": "Limit quota cannot be less than current used quota (1500)"
    }
}

Adjust Quota

Add or subtract from the current quota limit.

http
POST /b2b/branches/:branchId/quota/adjust

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

Permission: quota:write

Request Body

FieldTypeRequiredDescription
amountnumberYesAmount to adjust (positive to add, negative to subtract)

TIP

Use a positive number to increase the limit and a negative number to decrease it. For example, amount: 5000 adds 5000 to the current limit.

Examples

bash
# Add 5000 to current limit
curl -X POST https://api.easyslip.com/b2b/branches/cm1a2b3c4d5e6f7g8h9i0/quota/adjust \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${API_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Nonce: ${NONCE}" \
  -H "X-Signature: ${SIGNATURE}" \
  -d '{"amount": 5000}'
javascript
const body = { amount: 5000 }

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

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

Success Response (200)

json
{
    "success": true,
    "data": {
        "id": "cm1a2b3c4d5e6f7g8h9i0",
        "name": "สำนักงานใหญ่",
        "limitQuota": 20000,
        "usedQuota": 1500,
        "totalUsedQuota": 45000
    }
}

Reset Used Quota

Reset the used quota counter for a branch back to 0.

http
POST /b2b/branches/:branchId/quota/reset

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

Permission: quota:write

DANGER

This action cannot be undone. The used quota counter will be reset to 0, but the total used quota (all-time) will not be affected.

Examples

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

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

Success Response (200)

json
{
    "success": true,
    "data": {
        "id": "cm1a2b3c4d5e6f7g8h9i0",
        "name": "สำนักงานใหญ่",
        "limitQuota": 20000,
        "usedQuota": 0,
        "totalUsedQuota": 45000
    }
}

Notes

  • limitQuota: null means the branch has no individual limit and is constrained only by the service-level quota
  • usedQuota resets automatically based on your billing cycle
  • totalUsedQuota tracks all-time usage and never resets
  • Adjusting quota below usedQuota is not allowed

Bank Slip Verification API for Thai Banking