Skip to main content

Remote Config

Remote Config lets you control your app's behavior from the server without releasing an update. Use it for feature flags, pricing experiments, onboarding flows, and more.

Overviewโ€‹

Remote Config values are resolved per-user based on targeting conditions. The server evaluates rules and returns the resolved values for the current user.

Fetching Configโ€‹

// Config is resolved server-side based on the authenticated app context.
// Platform/appVersion/country are inferred by the SDK.
let configs = try await AppActor.shared.loadRemoteConfigs()
print("Loaded config items: \(configs.items.count)")

// Access typed values
if AppActor.shared.getRemoteConfigBool("show_holiday_banner") == true {
showHolidayBanner()
}

if let maxRetries = AppActor.shared.getRemoteConfigInt("max_upload_retries") {
setMaxRetries(maxRetries)
}

// Read raw value if needed
if let raw = AppActor.shared.getRemoteConfig("welcome_message") {
print(raw)
}

// Last loaded snapshot (no network call)
if let cached = AppActor.shared.cachedRemoteConfigs {
print("Cached items: \(cached.items.count)")
}

Targeting Conditionsโ€‹

Config values can be targeted based on:

ConditionOperatorsExample
Platformeq, neq, in, not_inOnly show on iOS
App Versioneq, gt, gte, lt, lteEnable for v2.1.0+
Countryeq, neq, in, not_inDifferent config for US vs EU
Entitlementhas, not_hasShow upsell only to free users

Example Rulesโ€‹

[
{
"type": "country",
"op": "in",
"value": ["US", "CA", "GB"]
},
{
"type": "app_version",
"op": "gte",
"value": "2.0.0"
},
{
"type": "entitlement",
"op": "not_has",
"value": "premium"
}
]

This config value would only be returned for users in US/CA/GB, running app version 2.0.0 or later, who do not have the "premium" entitlement.

REST APIโ€‹

Requestโ€‹

GET /v1/remote-config
Authorization: Bearer pk_live_your_key_here

Query Parameters:

ParameterRequiredDescription
app_user_idNoUser ID for entitlement-based targeting
app_versionNoApp version (e.g., "2.1.0")
countryNoISO 3166-1 alpha-2 code (e.g., "US")

Platform is derived from the authenticated app context (your API key is tied to a platform).

Responseโ€‹

{
"data": [
{
"key": "show_holiday_banner",
"value": true,
"valueType": "boolean"
},
{
"key": "max_upload_retries",
"value": 5,
"valueType": "number"
},
{
"key": "welcome_message",
"value": "Happy holidays!",
"valueType": "string"
}
],
"requestId": "req_abc123"
}

Cachingโ€‹

The response includes cache headers:

Cache-Control: private, max-age=900
ETag: W/"abc123"

The SDK caches config values and uses ETags to avoid unnecessary data transfer. A 304 Not Modified response means the cached values are still valid.

Next Stepsโ€‹