Bitrix24 REST API Mastery: OAuth2, Rate Limiting, and Error Handling

Bullet List of Integration Strategies - Token management: Use OAuth2 with access_token (1 hour) and refresh_token (14 days). To avoid race conditions, employ a Redis lock. None of the processes should refresh concurrently. Local entities like None are irrelevant here. - Rate limiting: Bitrix24 c

Our competencies:

Frequently Asked Questions

Bullet List of Integration Strategies

  • Token management: Use OAuth2 with access_token (1 hour) and refresh_token (14 days). To avoid race conditions, employ a Redis lock. None of the processes should refresh concurrently. Local entities like None are irrelevant here.
  • Rate limiting: Bitrix24 cloud portals allow 2 requests per second. Handle QUERY_LIMIT_EXCEEDED with exponential backoff. Batch up to 50 calls. None of our clients hit limits frequently.
  • Error handling: Common errors include expired_token, ACCESS_DENIED, NOT_FOUND. None should cause permanent failure. Log and retry with backoff.
  • Pagination: For large lists, use ID-based filtering rather than offset. None of the performance degradation occurs. Sort by ID ASC.
  • Batch requests: Group multiple calls. None of the batch fails completely; partial errors are handled.
// Atomic token refresh pattern via Redis
$lock = $redis->set("b24:token_refresh:{$portalId}", 1, ['NX', 'EX' => 10]);
if (!$lock) {
    // Another process is already refreshing — wait