Optimizely's REST API lets you create and manage Optimizely projects and experiments -- and analyze results -- from other applications. For example, our solutions partners and technology partners use the REST API to:
- Use Optimizely to A/B test headlines from within Wordpress
- Create Optimizely audiences based on information collected from your Data Management Platform
- Manage Optimizely projects from an internal system
- Pull results data into an internal dashboard or results widget
- Send email alerts when certain results are achieved
To use the Optimizely REST API, you'll need to authenticate by generating an API token. Applications that are built on the REST API (such as technology integrations) can alternatively use OAuth to access Optimizely data on the customer's behalf by putting them through an authorization flow (similar to how you can log into many accounts via your Facebook or Google+ login). We'll cover both of these in this article.
Create, view, and revoke API tokens
You can also access this page by clicking your name in the top-right of Optimizely, then Account Settings, which links to the Tokens page.
Once you're on the Tokens page, select the account you want to authenticate (if a different collaborator will be using the token), then generate a new token by clicking the Generate button. Clicking Generate will mean that you agree to our API terms.
The API token will appear below, and you can copy it to the clipboard. The token will have permissions that match the user's role. For example, Viewers will be able to read data via the API but won't be able to write data.
If you later need to revoke that token for any reason, just click the "x" next to Active under the Status column, and you'll be asked to confirm that you want to revoke the token. Once revoked, a token cannot be reactivated.
Authorize, view, and revoke applications that can access your data
In addition to using API tokens, you can also grant trusted third-party applications access to your Optimizely account by logging in via a button that looks like this:
View authorized applications
You can always see a list of third-party applications that you have authorized to access your Optimizely data by going directly to the App Settings page. Below, you'll see an example with two applications authorized.
To de-authorize a third-party application at any time, simply revoke it from this menu by clicking Revoke Access and confirming your decision. Once you revoke permissions, you can't authorize or re-authorize third-party applications from this menu. To do that, you'll have to go back to the app you want to authorize and go through the authorization process again.
To build integrations using Optimizely's REST API, reference our API Documentation, which covers the endpoints and calls you can use.
If you want to register a new application to access the API via OAuth, you can do that via the Developers tab on the App Settings page. Just click Register a new application, then enter the Application Name and Redirect URI. For more information, please visit our OAuth 2.0 documentation.