canonical: https://jentic.com/apis/optimizely.com/optimizely-v2

# Optimizely API

Jentic publishes the only available OpenAPI specification for Optimizely API v2, keeping it validated and agent-ready. The Optimizely v2 REST API is the platform's flagship surface for digital experimentation, exposing programmatic control over projects, experiments, campaigns, audiences, attributes, events, pages, environments, features, and collaborator management. Agents can create and manage experiments end-to-end, retrieve results, and look up bucketing decisions for individual visitors. Authentication supports OAuth 2.0 authorization-code flow as well as personal access tokens used as bearer credentials.

## For AI agents

Manage Optimizely experiments, audiences, campaigns, attributes, events, and pages programmatically across 107 endpoints, with OAuth 2.0 or personal-token authentication.

## Scope

Does not handle data warehousing, raw event ingestion, or in-page SDK delivery - use for Optimizely v2 experiment, audience, campaign, and result management only.

## Capabilities

- Create and manage experiments under a project, including variations and traffic allocation
- Build and update audiences using attribute conditions for segmented experimentation
- Define event and attribute schemas used for goal tracking and personalisation
- Read campaign results and generate sharable result links for stakeholders
- Manage environments, projects, and collaborator invitations on the account
- Look up the bucketing decision for a specific visitor inside an account

## Use cases

### Programmatic experiment creation

Product teams running experiment-velocity programs can create experiments via POST /experiments (referenced through campaign and project endpoints in v2) using a templated payload generated from an internal experiment proposal form. Pairing this with POST /audiences and POST /events lets agents stand up an experiment end-to-end without leaving the proposal tool. The 107-endpoint surface covers the full lifecycle from setup through results.

Example prompt: POST /campaigns and the related experiment payload to create the experiment, then POST /audiences with the segmentation rules referenced in the proposal.

### Results retrieval and reporting

RevOps and growth teams pull experiment results into their own warehouses by calling GET /campaigns/{campaign_id}/results on a schedule, then storing the response for trend analysis. The /campaigns/{campaign_id}/results/share endpoint produces a sharable link that can be embedded directly into review documents.

Example prompt: GET /campaigns/{campaign_id}/results, store the response in the warehouse, then GET /campaigns/{campaign_id}/results/share for the link to embed in the readout.

### Audience and attribute management

Marketing analysts maintaining a library of audiences can keep them in sync with Optimizely via /audiences and /attributes. New behavioural attributes are created with POST /attributes, then referenced from audiences via POST or PATCH /audiences/{audience_id}, so the audience definitions track changes in the data model rather than drifting in the UI.

Example prompt: POST /attributes with the new attribute schema, then PATCH /audiences/{audience_id} to add a condition referencing the new attribute.

### Visitor bucketing lookups

Customer-support and personalisation agents resolving 'why did this user see X' questions can call GET /attribution/{account_id}/visitor/{visitor_id} to pull the bucketing decision for a specific visitor. This is well suited to agent workflows that triage personalisation complaints by checking which variation the user was assigned and why.

Example prompt: GET /attribution/{account_id}/visitor/{visitor_id} for the user from the support ticket and return the assigned variation and the rule that caused it.

### AI agent for experimentation programs

Through Jentic, an experimentation-program agent can answer 'what's running where' by calling GET /campaigns and GET /experiments under a project, then drill into a specific result with /campaigns/{campaign_id}/results. The Optimizely OAuth credential or personal token sits in your Jentic One instance, so PMs can run the agent without ever holding the secret themselves.

Example prompt: Search Jentic for 'list optimizely campaigns', execute GET /campaigns, and surface the top three by traffic with their current status.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /campaigns | List campaigns |
| POST | /campaigns | Create a campaign |
| GET | /campaigns/{campaign_id}/results | Get campaign results |
| GET | /audiences | List audiences |
| POST | /audiences | Create an audience |
| POST | /attributes | Create an attribute |
| GET | /attribution/{account_id}/visitor/{visitor_id} | Get visitor bucketing |
| GET | /billing/usage/{account_id}/summary | Get impressions usage summary |

## Key resources

- **Projects** — Top-level container for Optimizely experiments and configuration
- **Campaigns** — Experiment groups with results and sharable readouts
- **Experiments** — Individual experiments with variations and traffic allocation
- **Audiences** — Audience definitions composed of attribute conditions
- **Attributes** — Attribute schemas used by audiences and events
- **Events** — Goal tracking events tied to pages and metrics
- **Environments** — Project environments such as production and staging
- **Collaborators** — Account collaborators and invitations

## Why Jentic

- **Setup:** Wiring the Optimizely v2 API by hand means running its OAuth authorization-code flow or managing a personal access token, then carrying the bearer token across experiment, audience, campaign, and result routes. Through Jentic you install once, import the Optimizely API from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** Optimizely v2 puts the resource id in the URL path (/campaigns/{campaign_id}/results, /attribution/{account_id}/...), so a rule can pin your agent to reading one campaign's results and nothing else. You choose the operations it may call, so writes like creating a campaign or an audience are not included unless you add them.
- **Credential handling:** Your Optimizely OAuth token or personal access token is stored once, encrypted, by your own Jentic One instance and injected as the Authorization header at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'list optimizely campaigns' or 'get an optimizely audience', and Jentic returns the matching operation under /campaigns or /audiences with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Optimizely Developers API** — Auth and resource-discovery slice of the Optimizely developer surface
- **PostHog** — Open-source product analytics with feature flags and experimentation
- **Amplitude** — Product analytics platform used to validate experiment outcomes
- **Mixpanel** — Product analytics platform commonly paired with experimentation results

## FAQ

### Why is there no official OpenAPI spec for Optimizely API v2?

Optimizely does not publish a maintained, validated OpenAPI specification for the v2 REST surface. Jentic generates and maintains this spec so that AI agents and developers can call Optimizely API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Optimizely v2 API use?

Two methods are supported: OAuth 2.0 authorization-code flow against app.optimizely.com/oauth2/authorize, or a personal access token used as a bearer credential. Through Jentic either flavour is stored encrypted in the vault and supplied as the Authorization header at request time.

### Can I create an experiment end-to-end with this API?

Yes. POST /campaigns creates the campaign container, POST /audiences and POST /attributes define targeting, and POST /events captures goals. The 107-endpoint surface covers the full lifecycle including reading results from /campaigns/{campaign_id}/results.

### What are the rate limits for the Optimizely v2 API?

Optimizely applies platform-level rate limits that differ by subscription tier. The spec does not encode hard limits, so agents should treat 429 responses with backoff and consult the impressions usage summary endpoint for visibility into consumption.

### How do I get campaign results through Jentic?

Search Jentic for 'get optimizely campaign results', load GET /campaigns/{campaign_id}/results, and execute it with the campaign ID. The vaulted OAuth or personal token is supplied automatically.

### Can I look up which variation a specific visitor saw?

Yes. GET /attribution/{account_id}/visitor/{visitor_id} returns the bucketing decision for that visitor, including the variation and the rule that placed them. This is the canonical endpoint for support and personalisation triage.

### Can I limit what my agent is allowed to do with the Optimizely API?

Yes. Because you run Jentic One yourself, your own rules decide which Optimizely operations and credential the agent may use. Optimizely v2 carries the resource id in the URL path, such as /campaigns/{campaign_id}/results and /attribution/{account_id}/visitor/{visitor_id}, so you can pin the agent to reading one campaign's results or looking up one account's bucketing and nothing else. You choose the operations it can call, so writes like POST /campaigns or POST /audiences stay out of reach unless you add them.
