HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In


## Overview

Full Stack SDKs open a well-defined set of public APIs, hiding all implementation details. However, some clients may need access to project configuration data within the [datafile](🔗).

In this document, we extend our public APIs to define data models and access methods, which clients can use to access project configuration data.

## OptimizelyConfig API

A public configuration data model (OptimizelyConfig) is defined below as a structured format of static Optimizely Project data.

### Get OptimizelyConfig

OptimizelyConfig can be accessed from OptimizelyClient (top-level) with this public API call:





`getOptimizelyConfig` returns an `OptimizelyConfig` instance which includes

  • environment key

  • SDK key

  • the datafile revision number

  • all experiments mapped by their key values

  • all attributes

  • all audiences

  • all events

  • feature flags mapped by their key values

Note

When the SDK datafile is updated (the client can add a notification listener for `OPTIMIZELY_CONFIG_UPDATE` to get notified), the client is expected to call the method to get the updated OptimizelyConfig data. See examples below.

### Get datafile

To share the same datafile between multiple SDK instances (for example, in a client/server scenario), you can pass a JSON string representation of the config (the datafile) between the instances. To get the datafile, use the `OptimizelyConfig` object's `getDatafile` method. For more information, see [Sharing the datafile with multiple SDK implementations](🔗).

### Object model

The following shows the object model for OptimizelyConfig.





## Examples

OptimizelyConfig can be accessed from OptimizelyClient (top-level) like this: