API Reference
SDK Config

SDK Config

The config endpoint returns the compiled configuration for a project. This is the single JSON blob that SDKs fetch on app launch. It contains all active campaigns, audience rules, experiment assignments, paywall schemas, and product definitions.

Get Config

GET /v1/config/:public_key

This endpoint uses the public key as a URL parameter. No Authorization header is needed.

Example

curl https://agentwallie.com/api/v1/config/pk_your_public_key

Response 200 OK

{
  "campaigns": [
    {
      "id": "camp_abc123",
      "name": "Onboarding Flow",
      "status": "active",
      "placements": [
        { "id": "pl_001", "name": "onboarding_complete", "type": "custom", "status": "active" }
      ],
      "audiences": [
        {
          "id": "aud_001",
          "name": "Free Users",
          "priorityOrder": 0,
          "filters": [
            { "field": "user.subscription_status", "operator": "is", "value": "free" }
          ],
          "experiment": {
            "id": "exp_001",
            "status": "running",
            "variants": [
              { "id": "var_001", "paywallId": "pw_abc123", "trafficPercentage": 100 }
            ],
            "holdoutPercentage": 0
          }
        }
      ]
    }
  ],
  "paywalls": {
    "pw_abc123": {
      "version": "1.0",
      "name": "Premium Upgrade",
      "settings": { "..." },
      "theme": { "..." },
      "products": [
        { "slot": "primary", "label": "Annual" },
        { "slot": "secondary", "label": "Monthly" }
      ],
      "components": [ "..." ]
    }
  },
  "products": [
    {
      "id": "prod_001",
      "name": "Annual Pro",
      "store": "apple",
      "storeProductId": "com.app.annual_pro",
      "entitlements": ["pro"]
    }
  ]
}

Config Structure

The compiled config has three top-level keys:

campaigns

An array of active campaigns. Each campaign includes:

  • placements: Event names that trigger this campaign
  • audiences: User segments, evaluated top-to-bottom by priorityOrder
    • filters: Rules for matching users to this audience
    • experiment: Variant assignments (which paywall to show)

paywalls

A map of paywall ID to paywall schema. Only published paywalls are included. The schema contains settings, theme, products, and components for native rendering.

products

An array of product definitions with store identifiers. The SDK uses these to resolve product slots in paywall schemas to actual store products.

How SDKs Use the Config

  1. On launch: SDK fetches the config and caches it in memory + disk.
  2. Periodic refresh: SDK re-fetches the config at a configurable interval (default 5 minutes).
  3. On register(placement:): SDK iterates through campaigns, finds ones with a matching placement, evaluates audiences top-to-bottom, checks experiment assignment, and renders the matched paywall.
  4. Offline fallback: If the network is unavailable, the SDK uses the disk-cached config.
⚠️

The config endpoint is rate-limited to 60 requests per minute per IP. SDKs should cache aggressively and avoid re-fetching on every placement evaluation.