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
GET /b2b/branches/:branchId/quotaFull URL: https://api.easyslip.com/b2b/branches/:branchId/quota
Permission: quota:read
Examples
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}"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)
{
"success": true,
"data": {
"branch": {
"id": "cm1a2b3c4d5e6f7g8h9i0",
"name": "สำนักงานใหญ่",
"limitQuota": 10000,
"usedQuota": 1500,
"totalUsedQuota": 45000
},
"service": {
"limitQuota": 50000,
"usedQuota": 8500,
"totalUsedQuota": 120000
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
branch.id | string | Branch ID |
branch.name | string | Branch name |
branch.limitQuota | number | null | Branch-level quota limit (null = use service limit) |
branch.usedQuota | number | Branch quota used this period |
branch.totalUsedQuota | number | Branch all-time usage |
service.limitQuota | number | Service-level quota limit |
service.usedQuota | number | Service quota used this period |
service.totalUsedQuota | number | Service all-time usage |
Set Quota Limit
Set an absolute quota limit for a branch.
PUT /b2b/branches/:branchId/quotaFull URL: https://api.easyslip.com/b2b/branches/:branchId/quota
Permission: quota:write
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
limitQuota | number | null | Yes | New 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
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}'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)
{
"success": true,
"data": {
"id": "cm1a2b3c4d5e6f7g8h9i0",
"name": "สำนักงานใหญ่",
"limitQuota": 15000,
"usedQuota": 1500,
"totalUsedQuota": 45000
}
}Error Response (400)
{
"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.
POST /b2b/branches/:branchId/quota/adjustFull URL: https://api.easyslip.com/b2b/branches/:branchId/quota/adjust
Permission: quota:write
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Amount 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
# 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}'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)
{
"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.
POST /b2b/branches/:branchId/quota/resetFull 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
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}"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)
{
"success": true,
"data": {
"id": "cm1a2b3c4d5e6f7g8h9i0",
"name": "สำนักงานใหญ่",
"limitQuota": 20000,
"usedQuota": 0,
"totalUsedQuota": 45000
}
}Notes
limitQuota: nullmeans the branch has no individual limit and is constrained only by the service-level quotausedQuotaresets automatically based on your billing cycletotalUsedQuotatracks all-time usage and never resets- Adjusting quota below
usedQuotais not allowed