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

Integrating Bitrix24 via REST API often breaks at the worst moment: tokens expire, batch requests return errors, and limits unexpectedly kick in. We build reliable integrations that account for all the nuances of OAuth2, error handling, and limits. Our team delivers turnkey projects—from audit to ongoing support—ensuring stable operation and scaling with your business.

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