Developer integration

Build any integration with the Optibase A/B testing API

Optibase exposes two API surfaces. A browser-side Active Variants API for personalization and downstream tags, and a server-to-server conversion endpoint for backend events like Stripe webhooks. If a tool isn't on the integrations page, you can wire it in through one of these in an afternoon.
Active Variants API in the browser. Read the user's current variants from any page-side script.
Server-to-server conversion endpoint. Fire conversions from your backend, queue jobs, webhooks, anywhere.
External user IDs. Pass your own identifier instead of the Optibase one.
Header image
Join 3000+ companies already testing with Optibase
API surface

What the Optibase API gives you

The Optibase API is built around two core actions: identifying which variant a user is assigned to and recording conversions. Most custom integrations rely on one or both of these. On the browser side, the Active Variants API allows you to access this data directly. The Optibase script exposes active variants through window.optibaseActiveVariants, an array of objects containing userFriendlyTestId and userFriendlyVariantId. It also provides window.optibaseAddActiveVariantsListener, a callback that triggers whenever variants are assigned or updated, returning the same data. This makes it easy to read variant information within any tag, script, or framework on the page.
On the backend, conversions are handled through a server-to-server endpoint. Any system, whether it’s your own server, a Stripe webhook, or a background worker, can send a POST request to Optibase with the user ID, conversion event name, and an optional value. Optibase then links that conversion to the variants previously assigned to the user, even if the conversion happens much later after the initial exposure.
Why this integration

Why use the Optibase API

Server-side conversions for events that happen off-page

Stripe Checkout, queue jobs, webhooks, server-rendered pages: any event that happens outside the browser is a candidate for the conversion endpoint. The standard client-side conversion tracking misses these. The API doesn't.
Conversion tracking icon

Custom data destinations Optibase doesn't natively integrate with

Optibase ships native integrations for the most common analytics and warehouse tools. For everything else (Snowflake, Redshift, Datadog, Sentry, Segment, custom data lakes), the Active Variants API gives you the variant data you need to push it wherever your stack lives.
Personalization icon

External user IDs for your own identity model

If your app uses its own user ID (auth ID, customer ID, account ID), you can pass it to Optibase instead of relying on the Optibase visitor ID. This makes joins to your own data warehouse trivial: same user ID on both sides.
Use cases

What you can build with the API

Server-side conversion from a Stripe webhook

Your Stripe webhook fires when a checkout completes. Read the Optibase user ID from client_reference_id in the Stripe payload, then POST a conversion to the Optibase endpoint with the purchase value. Stripe Checkout's domain change no longer breaks attribution.
Personalization icon

Personalization in a server-rendered framework

Read window.optibaseActiveVariants on initial page render. If the user is in the variant that should see a personalized hero section, render the personalized version directly from the server. Faster than rendering the default and then mutating it on the client.
A/B testing icon

Pipe variant data to Snowflake or Redshift

Use window.optibaseAddActiveVariantsListener to capture every variant assignment in the browser, then post it to your own ingestion endpoint or Segment Source. Now Snowflake or Redshift has the variant assignment alongside everything else your team tracks, ready for joining.

Trigger a Slack alert when a test reaches significance

Combine the conversion endpoint with your own analytics worker. When a job detects that a test crossed your significance threshold, fire a Slack webhook with the test name and winning variant. Optibase ships P2BB analytics natively, but for custom alerting, the API lets you build whatever your team wants.
Setup

How to use the API

The two API surfaces have different setup paths.

Active Variants API (browser-side)

There is no setup. Once the Optibase script is on the page, the global variables are available: // Read all active variants for the current userconst variants = window.optibaseActiveVariants;// returns: [{ userFriendlyTestId: 'pricing-page', userFriendlyVariantId: 'variant-b' }, ...]// Listen for variant updates (assignments, force-overrides)window.optibaseAddActiveVariantsListener((variants) => {  console.log('Active variants:', variants);}); Use these in any other page-side script, GTM tag, framework hook, or component.

Server-to-server conversion endpoint

Get the Optibase user ID on the page and pass it through to your backend using a method that fits your setup, such as a cookie, query string, or request header. Once you have that, send a POST request to the Optibase conversion endpoint including the user ID, the conversion event name, and any associated value.
Make sure to create a matching conversion in the Optibase dashboard using the exact same event name so everything lines up correctly. Optibase will automatically tie incoming conversions to the variants the user was assigned at the time. For full request format and authentication details, refer to the Optibase API documentation.
API endpoints

API surface, at a glance

Surface

Type

Auth

What it returns or accepts

window.optibaseActiveVariants

Browser global (read)

None (page context)

Array of { userFriendlyTestId, userFriendlyVariantId }

window.optibaseAddActiveVariantsListener(cb)

Browser global (event)

None

Calls the callback with the active variants array

Conversion endpoint

Server-to-server (POST)

Per docs

Records a conversion against an Optibase user ID

External user ID assignment

Browser-side or server-side

Per docs

Maps your user identifier to the Optibase visitor

SurfaceTypeAuthWhat it returns or accepts
window.optibaseActiveVariants Browser global (read) None (page context) Array of { userFriendlyTestId, userFriendlyVariantId }
window.optibaseAddActiveVariantsListener(cb) Browser global (event) None Calls the callback with the active variants array
Conversion endpoint Server-to-server (POST) Per docs Records a conversion against an Optibase user ID
External user ID assignment Browser-side or server-side Per docs Maps your user identifier to the Optibase visitor
Browse integrations

Optibase integrates with the rest of your stack

Google Analytics 4

The Google Optimize replacement. Variant exposure lands in GA4 as an event parameter, native or via GTM. Build variant-aware audiences for Google Ads remarketing.

Learn more

Mixpanel

Auto-detected. Variant exposure lands as a Mixpanel event with variantId and testId. Works in any Insight, Funnel, Retention, or Cohort.

Learn more

Amplitude

Variant assignment events flow into Amplitude. Skip the Amplitude Experiment seat. Analyze in your existing Amplitude dashboards.

Learn more

PostHog

PostHog Actions detect Optibase data attributes natively. Pair Optibase marketing-page testing with PostHog's product analytics.

Learn more

BigQuery

Service-account auth, batch export of variant assignments, conversions, visitor IDs, and timestamps. Joinable with the GA4 BigQuery export, Stripe revenue, and any other warehouse data.

Learn more

Stripe

Server-to-server attribution that survives Stripe Checkout's domain change. Pass the Optibase user ID via client_reference_id, fire conversions from your webhook, see revenue per variant on every test.

Learn more

Google Tag Manager

Trigger Optibase conversions from any GTM event with optibaseSendConversionEvent('your-conversion-id'). Push variant data into the dataLayer for every other tag to consume.

Learn more

MCP Server

Hosted Model Context Protocol server at https://my.optibase.io/api/mcp. Read tests, conversions, heatmaps, and traffic from Claude Desktop, Cursor, or any MCP-compatible client.

Learn more
FAQ

Frequently asked questions about the Optibase API

Is there an A/B testing API I can use?
Yes. Optibase exposes two API surfaces: a browser-side Active Variants API (window.optibaseActiveVariants and window.optibaseAddActiveVariantsListener) for reading the user's current test assignments, and a server-to-server conversion endpoint for posting conversions from any backend. Together they let you build any integration that isn't on the native list.
Can I trigger conversions from my backend?
Yes. POST to the Optibase conversion endpoint from your server with the user ID, event name, and value. Useful for Stripe webhooks (where Stripe Checkout breaks client-side attribution), queue jobs, server-rendered events, or any other server-side conversion.
Does the API support webhooks?
The conversion endpoint accepts incoming HTTPS POST requests, which is the pattern most webhook-emitting services use (Stripe, Slack, Zapier, etc.). Configure the source service to POST to the endpoint with the right payload, and conversions land in Optibase.
Are there official client libraries?
The browser-side API is just a global JavaScript variable, no library needed. For the server-to-server conversion endpoint, the docs show the HTTPS request format, which can be hit from any HTTP client (curl, fetch, axios, requests, etc.). No published SDK is required.
Can I use my own user ID instead of the Optibase one?
Yes. Optibase supports external user IDs. Assign your own identifier (auth ID, customer ID, account ID) and Optibase will tie variant assignments and conversions to that ID. Useful for joining Optibase data with your own product data warehouse using a single key.
How is this different from the MCP server?
The Active Variants API and conversion endpoint are for application code: anything that runs in your browser, server, or backend. The MCP server is for AI agents and clients that speak the Model Context Protocol (Claude Desktop, Cursor). Both let you interact with Optibase programmatically, but the audience is different.
 Is the API available on every Optibase plan?
Yes. Every Optibase integration, including the API, is available on every plan including the free tier. There is no upgrade or paid feature gate.