When developing React applications for Bitrix24, one of the most frequent problems is the expired_token error exactly one hour after startup. CORS blocks direct requests, pagination returns only the first 50 records, and without batch operations, loading a list of 500 deals takes tens of seconds. We configure the Bitrix24 REST interface for React to avoid these issues, ensuring a seamless React Bitrix24 integration. Without correct setup, every new endpoint becomes a headache: tokens expire, CORS rejects, and pagination requires cursor iteration. Our experience—over 50 integrations with React, Vue, and Angular—lets us sidestep these pitfalls. This guide covers the full Bitrix24 REST API setup for React applications. A basic webhook integration starts at $500, while a full OAuth setup with proxy ranges from $1,500 to $3,000. Contact us for a free project assessment.
Authorization Schemes
An inbound webhook is the simplest option. It is created in Settings → Developers → Other → Inbound webhook. It provides a static URL with a token. Suitable for internal tools without complex authorization.
const WEBHOOK_URL = 'your-webhook-url'; // Replace with actual webhook URL
async function callBX24(method: string, params: object) {
const response = await fetch(`${WEBHOOK_URL}${method}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(params),
});
return response.json();
}
OAuth 2.0 via an application—for apps installed on different portals. Register in the developer account, obtain client_id + client_secret, and an authorization flow via redirect.
OAuth flow details
After app installation, the user is redirected to the Bitrix24 authorization page. After granting permissions, they receive a code that is exchanged for an access_token and refresh_token. The access_token lives for 1 hour, the refresh_token for 2 weeks. For a React app, it is important to store tokens securely (e.g., HttpOnly cookies) and configure automatic refresh via an interceptor mechanism.
BX24.js SDK—for apps inside the Bitrix24 iframe. The SDK automatically passes the authenticated user's token.
Comparison of Authorization Methods
| Method |
Complexity |
Requires refresh? |
Scope |
| Inbound webhook |
Low |
No |
Internal tools, dev environments |
| OAuth 2.0 |
High |
Yes |
Marketplace, multi-tenant apps |
| BX24.js SDK |
Medium |
No (token built-in) |
Apps inside the portal (iframe) |
How Pagination Works in the REST API
List methods (crm.deal.list, etc.) return up to 50 records plus a next field for the next page. In a React app, this is easy to handle with React Query:
// src/api/bitrix24.ts
import axios from 'axios';
const bx24Api = axios.create({
baseURL: process.env.REACT_APP_BX24_WEBHOOK,
});
// Auto-handle Bitrix24 pagination (limit 50 records per request)
async function getAllItems<T>(method: string, params: object): Promise<T[]> {
const items: T[] = [];
let start = 0;
do {
const { data } = await bx24Api.post(method, { ...params, start });
items.push(...data.result);
start = data.next;
} while (data.next);
return items;
}
// Hook for deal list
export function useDeals(filter?: object) {
return useQuery({
queryKey: ['deals', filter],
queryFn: () => getAllItems('crm.deal.list', {
select: ['ID', 'TITLE', 'STAGE_ID', 'OPPORTUNITY', 'ASSIGNED_BY_ID'],
filter,
order: { ID: 'DESC' },
}),
staleTime: 60_000,
});
}
Bitrix24 pagination returns a maximum of 50 records and a next field for the next page—must be handled explicitly.
Why Batch Requests Are Critical for Performance
Bitrix24 supports batch operations via batch—up to 50 methods in a single HTTP request. Bitrix24 REST API documentation states that batched endpoints support up to 50 commands. On one project, we replaced 20 individual requests with a single batch—load time dropped from 4 to 0.3 seconds, a 13x improvement. Batch calls are 13 times faster than sequential ones. Savings on bandwidth and server time reduce infrastructure costs by up to 40%. For instance, a 13x reduction in API calls can translate to roughly $200 monthly savings on server infrastructure. Each authentication error costs an average of 15,000 ₽.
async function getUsersWithDepartments(userIds: number[]) {
const batchCommands: Record<string, string> = {};
userIds.forEach(id => {
batchCommands[`user_${id}`] = `user.get?ID=${id}`;
batchCommands[`dept_${id}`] = `department.get?ID=user_${id}`;
});
const { data } = await bx24Api.post('batch', { halt: 0, cmd: batchCommands });
return data.result;
}
Batch operations critically reduce the number of HTTP round-trips during initial data loading.
Comparison of Batch vs Sequential Requests
| Parameter |
Sequential requests |
Batch requests |
| Time for 50 methods |
~4 s |
~0.3 s |
| Number of HTTP round-trips |
50 |
1 |
| Implementation complexity |
Low |
Medium |
| Dependency support |
No |
Yes (via named commands) |
CORS and Server Proxy
When making direct requests from the browser to Bitrix24 REST, CORS restrictions appear—especially when working with cloud portals on a subdomain. The recommended approach: all REST requests go through your own proxy server (Laravel, Node.js), which adds tokens and handles authentication errors.
Error Handling and Token Refresh
bx24Api.interceptors.response.use(
response => response,
async error => {
if (error.response?.data?.error === 'expired_token') {
await refreshBX24Token();
return bx24Api.request(error.config);
}
throw error;
}
);
The Bitrix24 OAuth token lasts 1 hour. The refresh token lasts 2 weeks. Without an interceptor, the app breaks after an hour of use.
What's Included in the Work
- Authorization scheme selection—we analyze whether a webhook, OAuth, or BX24.js is needed. We suggest the optimal option with justification.
- Application registration—we create an app in the official documentation, obtain and save tokens.
- API layer development—wrappers on axios/fetch, React Query hooks with typing.
- Pagination and batch implementation—automatic
next handling, batch operations for speed.
- Automatic token refresh—axios interceptor for refresh.
- Proxy server setup (if needed)—with CORS configuration.
- Access credentials and setup instructions—including all keys and URLs.
- Documentation—detailed endpoint descriptions and deployment guide. Training: one-hour walkthrough for your team. Support: 12-month warranty with priority assistance.
Estimated Timelines
Basic integration with a webhook—2–3 days. Full OAuth protocol flow with token management and proxy—1–2 weeks. Timelines may vary depending on business logic complexity. Pricing is individual. The return on investment in REST API setup is realized within the first month of operation. Our clients save up to 30% on development thanks to integration optimization.
Over 5 years, we have worked with Bitrix24 and Bitrix24 Cloud—completed 50+ integrations with React, Vue, and Angular. We provide a 12-month warranty on all work. Order your REST API setup and get a ready solution in 1–2 weeks. Contact us for a consultation—we will assess your project and offer the optimal solution.
What Does React Development for 1C-Bitrix Provide and When Is It Needed?
A catalog with 30,000 SKUs and a faceted filter — the standard Bitrix template loads the page in 3 seconds. A B2B cabinet with personalized discounts — price recalculation with every filter change. The bottleneck is not the data but the monolithic architecture: each block calls REST separately, 6–8 sequential requests of 200–500 ms result in a total delay of 2–3 seconds. React solves this radically: component model, virtual DOM, and library ecosystem turn a slow interface into a responsive application. We are a certified 1C-Bitrix partner with 10+ years of experience and over 500 completed projects. Order an audit — we will evaluate your project in 1–2 days and show cases similar to yours.
Architectural Approaches
SPA on React + REST API Bitrix (BX.rest)
The React application lives separately, accessing /rest/ or custom endpoints via CRestServer. Maximum control, but also maximum work.
- Client-side routing with React Router — transitions without reload, but on F5 you need a catch-all on Nginx:
try_files $uri /index.html
- Optimistic updates: cart updates instantly,
sale.basket.update flies in the background. On error, roll back state and show a toast
- Frontend deploys to CDN independent of Bitrix — updated a button without touching the backend
SSR with Hydration — When Yandex Doesn't See SPA
Yandex has learned to render JS, but not perfectly; Googlebot is better, but still not 100%. Server-side rendering of React components via Node.js solves the problem radically: the bot receives ready HTML, the user gets an interactive application after hydration. FCP drops below one second on normal hosting, og:title and og:image work for social networks. The complexity is needing a Node.js process alongside Apache/Nginx serving Bitrix: two runtimes, two deploys, two log sets. Bitrix cache (CPHPCache, Composite) can be used to warm data that later goes to SSR.
Headless Bitrix — Admin Panel for Content Managers, React for Visitors
Content manager logs into /bitrix/admin/, edits infoblocks. The visitor sees a React application that retrieves data via API. One backend serves the site, mobile app, and Telegram bot. Scaling: React bundle on CloudFront/CDN, Bitrix on a single server. With 50,000 unique visitors, the frontend does not directly load the backend. Pitfall: the standard Bitrix visual editor (BXEditor) stops working for visitors — content managers will have to work only through the admin panel.
Stack and Component Architecture
Stack We Actually Use
| Technology |
Why It's Used |
| React 18+ |
Suspense, useTransition — UI does not block during heavy catalog updates |
| TypeScript |
Typing Bitrix API responses — IBlockElement, BasketItem, Order. Without it, refactoring is Russian roulette |
| Vite |
HMR in 50 ms vs 3–5 s for webpack. On a project with 200 components, the difference is enormous |
| React Query |
useQuery(['catalog', sectionId]) — automatic cache, revalidation, retry on 503 from overloaded Bitrix |
| React Hook Form + Zod |
Order form: 15–20 fields, conditional validation (legal entity — one set, individual — another). RHF does not re-render form on every keystroke |
| Tailwind CSS |
Utility classes — no fighting with cascades from Bitrix's template_styles.css |
| Radix UI / Shadcn |
Accessible primitives with ARIA out of the box |
How We Build Components and Type Data
Every project starts with a design system — otherwise, by the third month, three developers will write three different button components. Typography, colors, spacing — via CSS variables and Tailwind config. Forms: inputs with masks (phone, INN), searchable selects, file upload with preview and MIME validation. Product card is a separate story: price with discounts from CCatalogProduct::GetOptimalPrice(), labels "Hit"/"New" from infoblock properties, "Add to cart" button with loading/success/error states. Tables with virtualization (react-window) for price lists of 5000+ rows.
We type everything that comes from Bitrix. The REST API returns string where you'd expect number, "Y"/"N" instead of boolean, and null instead of empty array. A Zod schema on input parses and transforms — components get proper types.
// Real type of CIBlockElement via REST — surprises everywhere
interface BitrixProduct {
ID: string; // yes, string, not number
ACTIVE: "Y" | "N"; // not boolean
PRICE: string; // also string
QUANTITY: string; // and this is string
}
Performance and API Integration
Aggregating endpoints are key. One ajax.php or custom controller on \Bitrix\Main\Engine\Controller gathers catalog data, filters, cart, and user in a single request. React Query caches the response, and a second visit returns from cache with staleTime — load time reduces by 60% already on the second load.
How Does React Improve Core Web Vitals?
-
LCP < 2.5 s — lazy loading images via
loading="lazy", inline critical CSS, preload LCP image via <link rel="preload">
-
INP (replaces FID) < 200 ms —
useTransition for heavy filtering, useDeferredValue for search input
-
CLS < 0.1 — fixed sizes for skeletons and images. Skeleton placeholders instead of spinners
Virtualization is not optional, but necessary. A catalog with faceted filter may return 500 products per page. React-window or react-virtuoso render only the visible 20–30 cards — DOM does not bloat, scrolling is smooth.
REST and Custom Controllers
Out of the box via /rest/: infoblocks (iblock.element.get), cart (sale.basket.*), orders (sale.order.*), users (user.*). For a simple catalog, that's enough. But 70% of tasks require custom endpoints. \Bitrix\Main\Engine\Controller is the standard way to create your own endpoints in D7. Write a controller, register via registerAction, get endpoint with CSRF protection and authorization out of the box.
- Aggregation: one request = catalog data + filters + cart + user
- WebSocket via Bitrix Push & Pull (
CPullStack::AddByTag) — order status updates in real time, no polling
- GraphQL middleware (webonyx/graphql-php) on top of D7 ORM — frontend requests exactly the fields it needs. Mobile traffic savings up to 40%
Projects, Timelines, and What's Included
Typical Projects We Have Already Done
- Online store with 30,000 SKUs and faceted filter via
\Bitrix\Iblock\PropertyIndex\Facet — SPA, React Query, catalog virtualization
- B2B cabinet: personalized prices from
CCatalogGroup, reconciliation statements from 1C via \Bitrix\Sale\Compatible\OrderCompatibility, order history with filtering
- Corporate portal: dashboards on Recharts, real-time via Push & Pull, integration with internal APIs through middleware
- Marketplace: two React applications (buyer + seller), common backend, data separation via
CUser::GetUserGroup()
Timelines and What's Included
| Project Type |
Timeline |
| Landing page on React + Bitrix |
2–4 weeks |
| SPA online store |
8–16 weeks |
| Corporate portal |
10–20 weeks |
| Gradual frontend migration to React |
6–12 weeks |
- Audit of current Bitrix code and architecture
- Design of API layer (REST / custom controllers / GraphQL)
- Development of design system and components
- CI/CD setup (deploy React bundle independently of Bitrix)
- Documentation of endpoints and types (Swagger / TypeScript types)
- Transfer of access to server, admin panel, repository
- Training content managers to work through the admin panel
- Warranty support for 2 months after delivery
Exact numbers after scope analysis. Assessment is phased, with a fixed budget for each sprint.
How We Implement React in a Project
- Audit existing code — find bottlenecks: redundant requests, outdated templates, suboptimal caches.
- Design API layer — determine which endpoints are needed, design aggregators or GraphQL.
- Develop design system — create components (buttons, forms, cards) based on mockups or UX recommendations.
- Integrate with Bitrix via chosen approach (SPA, SSR, or Headless) — set up rendering and routing.
- Test and deploy — launch a pilot section (e.g., catalog), measure Core Web Vitals, upon approval expand.
Typical Mistakes When Implementing React in Bitrix
- Ignoring Bitrix caching — React Query may conflict with composite cache if tagged caching is not configured.
- Lack of error handling from REST — on a 500 error, the interface may "freeze". Need a global handler with fallback UI.
- Too many micro-components — each small widget calls API. Better to aggregate data in a single request.
- Wrong hydration order in SSR — data from the server must exactly match the client's initial state, otherwise React hydration errors.
Why React, Not Vue or Bitrix Templates
- Ecosystem. For any UI task, there is a ready library: tables, charts, drag-and-drop, virtualization. For Vue, the choice is narrower; for Bitrix templates, almost absent.
- Talent pool. Finding a React developer is three times easier than a Bitrix templater who knows D7 and
template.php.
- React Native. Components are reused in mobile app — not one-to-one, but business logic and types are shared.
- Gradual adoption. Start with one section (
/catalog/) on React, keep the rest on Bitrix templates. component_epilog.php loads the React bundle, data is passed via window.__INITIAL_DATA__.
1C-Bitrix + React is not a theoretical architecture but a working combination that already serves catalogs with tens of thousands of SKUs and B2B cabinets with heavy business logic. Learn more about React and 1C-Bitrix. Get a consultation — we will send you cases similar to your project. Contact us to discuss details. We implement turnkey with a guarantee of results.