Skip to main content

Rate Limiting

The SASOM Partners API implements rate limiting to ensure fair usage and system stability.

Limits

LimitValue
Requests per minute1,000
PerSupplier (API Key)

Rate Limit Response

When you exceed the rate limit, you'll receive a 429 Too Many Requests response:

{
"success": false,
"message": "Rate limit exceeded. Please retry after 30 seconds."
}

Response Headers

When rate limited, the response includes:

HeaderDescription
Retry-AfterSeconds to wait before retrying

Best Practices

1. Implement Exponential Backoff

async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url, options);

if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || 30;
await new Promise(r => setTimeout(r, retryAfter * 1000));
continue;
}

return response;
}
throw new Error('Max retries exceeded');
}

2. Batch Requests When Possible

Instead of making many individual requests, use batch endpoints:

# Instead of multiple single-item listings
# Use the batch endpoint for R2S
curl -X POST https://partners.sasomapi.com/partner/batch/r2s \
-u "YOUR_API_KEY:YOUR_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"listings": [
{"sku": "SKU-1", "size": "10", "price": 5000, "quantity": 1},
{"sku": "SKU-2", "size": "11", "price": 4500, "quantity": 2}
],
"parcel_quantity": 1
}'

3. Cache Responses

Some endpoints support caching. Take advantage of this for frequently accessed data:

EndpointSuggested Cache Time
GET /partner/lowest/{sku}5 minutes
GET /partner/settled/orders10 minutes
GET /partner/live/listings/{type}1 minute

4. Use Pagination Efficiently

Don't fetch all pages at once. Use cursor-based pagination to fetch only what you need:

async function fetchAllOrders() {
let cursor = null;
const allOrders = [];

do {
const url = cursor
? `https://partners.sasomapi.com/partner/processing/orders?cursor=${cursor}`
: 'https://partners.sasomapi.com/partner/processing/orders';

const response = await fetch(url, { headers });
const data = await response.json();

allOrders.push(...data.data);
cursor = data.cursor;

// Add delay between requests
await new Promise(r => setTimeout(r, 100));
} while (cursor);

return allOrders;
}

Need Higher Limits?

If your integration requires higher rate limits, contact support@sasom.co.th with:

  • Your current API key
  • Expected request volume
  • Use case justification