API Reference
Events

Events

The events endpoint ingests telemetry from SDKs. Events are batched by the SDK and sent as an array. This endpoint uses public key authentication.

Ingest Events

POST /v1/events/:public_key

This endpoint authenticates via the public key in the URL path, not via the Authorization header. This allows SDKs to post events without exposing the private key.

Request Body

FieldTypeRequiredDescription
eventsarrayYesArray of event objects (min 1)

Event Object

FieldTypeRequiredDescription
event_namestringYesEvent name (see standard events below)
timestampstringYesISO 8601 timestamp
device_idstringNoDevice identifier
user_idstringNoUser identifier (set via identify())
propertiesobjectNoArbitrary key-value properties
campaign_idstringNoAssociated campaign ID
paywall_idstringNoAssociated paywall ID

Example

curl -X POST https://agentwallie.com/api/v1/events/pk_your_public_key \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "event_name": "paywall_open",
        "timestamp": "2025-03-15T10:30:00.000Z",
        "device_id": "device_abc123",
        "user_id": "user_456",
        "campaign_id": "camp_abc123",
        "paywall_id": "pw_def456",
        "properties": {
          "placement": "onboarding_complete",
          "platform": "ios",
          "app_version": "2.1.0"
        }
      },
      {
        "event_name": "purchase_started",
        "timestamp": "2025-03-15T10:30:15.000Z",
        "device_id": "device_abc123",
        "user_id": "user_456",
        "campaign_id": "camp_abc123",
        "paywall_id": "pw_def456",
        "properties": {
          "slot": "primary",
          "store_product_id": "com.app.annual"
        }
      }
    ]
  }'

Response 201 Created

{
  "ingested": 2
}

Standard Event Names

These events are tracked automatically by the SDKs:

Event NameDescription
placement_triggeredSDK evaluated a placement
paywall_openPaywall was presented to the user
paywall_closePaywall was dismissed
purchase_startedUser initiated a purchase
transaction_completePurchase completed successfully
transaction_failPurchase failed
restore_startedUser initiated a restore
restore_completeRestore completed

Custom events can use any name. Track them via AgentWallie.shared.trackEvent(name:properties:) in the SDK.

Side Effects

When events are ingested, two background processes run asynchronously:

  1. Webhook dispatch: If any webhooks are configured for the ingested event names, they are dispatched with the event data.
  2. Auto-promote check: If any ingested events reference paywalls that are part of an active experiment with auto_promote enabled, the system checks if the experiment has reached statistical significance and promotes the winner if so.

Batch Ingestion

The SDK batches events and sends them periodically (typically every 30 seconds or when the app backgrounds). You can also batch events manually from a server-side integration.

⚠️

The events endpoint is rate-limited to 120 requests per minute per IP. Each request can contain multiple events, so batch them for efficiency.