API beta
GrowthBook offers a full REST API for interacting with the GrowthBook application. This is currently in beta as we add more authenticated API routes and features.
SDK Connection Endpoints
In addition to the REST API above, there is one additional readonly endpoint - the SDK Connection Endpoint.
The SDK Connection Endpoint provides readonly access to a subset of your feature flag data, just enough for the GrowthBook SDKs to assign values to users. They are meant to be public and do not require authentication to view.
In GrowthBook Cloud, the SDK Connection Endpoints are served from our global CDN: https://cdn.growthbook.io/api/features/...
. If you are self-hosting, you can run the GrowthBook Proxy server, which provides built-in caching and performance optimizations.
SDK Connection Endpoints are scoped to a single Environment (e.g. dev
or production
) and can also be scoped to a single Project. Manage all of your SDK Connections on the Features -> SDKs page.
Typescript Type Definition
interface SDKEndpointResponse {
status: 200;
features: {
[key: string]: FeatureDefinition
}
}
interface FeatureDefinition {
defaultValue: any;
rules?: FeatureDefinitionRule[];
}
interface FeatureDefinitionRule {
force?: any;
weights?: number[];
variations?: any[];
hashAttribute?: string;
hashVersion?: number;
seed?: string;
namespace?: [string, number, number];
key?: string;
coverage?: number;
condition?: any;
meta?: VariationMeta[];
name?: string;
phase?: string;
}
interface VariationMeta = {
passthrough?: boolean;
key?: string;
name?: string;
}
Example JSON object
{
"status": 200,
"features": {
"feature-key": {
"defaultValue": true
},
"another-feature": {
"defaultValue": "blue",
"rules": [
{
"condition": {
"browser": "firefox"
},
"force": "green"
}
]
}
}
}
Encryption
If you've enabled encryption for your SDK endpoint, the response format changes:
Typescript Type Definition
interface SDKEncryptedEndpointResponse {
status: 200;
encryptedFeatures: string;
}
Example JSON object
{
"status": 200,
"encryptedFeatures": "abcdef123456GHIJKL0987654321..."
}
You will need to decrypt the features first before passing into the SDK. Our front-end SDKs (Javascript and React) handle this for you automatically and we're in the process of adding built-in support to our other SDKs.