Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback
Hey! These docs are for version 2.0, which is no longer officially supported. Click here for the latest version, 3.0!

The datafile is a JSON representation of your Full Stack project. It contains all the instructions needed to run your experiments.

The datafile is updated immediately after changes to your experiments, but it may take a few minutes to upload to the content delivery network (CDN). If you’re experiencing delays longer than 5 minutes, please [contact Optimizely support](🔗).

In general, you don’t need to access the datafile, but it can be handy if your experiments don’t update as expected. The datafile can help you debug a Full Stack experiment and confirm expected updates.

See also [Datafile versioning and management](🔗).


If you're using the iOS or Android SDKs, skip straight to [Initialize a mobile SDK](🔗), which encompasses getting the datafile and instantiating a client.


**Be careful changing the datafile's environment key as it will impact the datafile URL your code loads**. The environment key displays on the _Settings > Datafile_ page; see the image in [Access the datafile via the app](🔗).

## Get the datafile

Before you [instantiate a client](🔗), get a local copy of the datafile from our servers. Synchronizing this local copy lets the SDK make immediate decisions on experiments, without waiting for a blocking network request.

How you synchronize and how often you synchronize depends on your application:

  • **Recommended method**: Use [webhooks](🔗) to notify your server when the datafile changes so it can retrieve the latest version.

  • **Alternative method**: Poll the CDN or REST API at a regular interval (such as every minute) for an updated datafile. The length of this interval will vary according to your application requirements.


Be sure to synchronize the datafile often enough to stay current with changes in the Optimizely project environment without generating unacceptable network traffic and latency. For more information on how to balance network latency with datafile freshness, see [Datafile versioning and management](🔗).

## Fetch the datafile via REST API

You can access the datafile via Optimizely's authenticated REST API. You need to [authenticate with an API token](🔗). For more information, see [Read the datafile of an environment](🔗).

## Access the datafile via the app

To access the datafile for your Full Stack project:

  1. Navigate to _Settings_ > _Environments_.

  2. Find the SDK Key/Primary URL for the project and environment whose datafile you want to access.

  3. Click the SDK Key/Primary URL to open the CDN link in a new browser tab or window.


## View the datafile via the CDN link

This image shows how the datafile appears when accessed from the CDN link.


See [Example datafile](🔗) to see an example in properly formatted JSON.