Events

Ingest the events that drive referral qualification

Events are the raw material the qualification engine evaluates gates against. Every action a referred user takes — signup, onboarding milestones, a paid subscription — arrives here, whether it comes from an SDK, your server, or a connected integration.

The Event object

FieldTypeDescription
idstringUnique identifier (a UUID).
objectstringAlways event.
namestringEvent name, e.g. signup, subscription_started, completed_onboarding.
referred_user_idstringYour id for the referred end-user this event belongs to.
referral_codestringThe referral code or link the user came in through (for attribution), if known.
propertiesobjectArbitrary properties gates can match on (e.g. plan: "paid").
timestampstring (date-time)When the event occurred, as supplied by you.
idempotency_keystringOptional dedup key supplied in the body (in addition to the header).
sourcestringWhere the event came from: sdk, api, revenuecat, adapty, stripe, or segment.
modestringtest or live, determined by the API key.
livemodebooleanWhether the event exists in live mode.
received_atstring (date-time)When Invitebase received the event.

Ingest an event

POST/v1/events

Records an event for a referred user. The endpoint is idempotent and accepts either key type, so you can send events from client SDKs (publishable key) or your server (secret key). Events are accepted for asynchronous processing and return 202 Accepted.

Accepts publishable keys.

ParameterInTypeRequiredDescription
Idempotency-KeyheaderstringNoRetries with the same key return the original result.
namebodystringYesEvent name, e.g. subscription_started.
referred_user_idbodystringYesYour id for the referred end-user.
referral_codebodystringNoThe code the user came in through, if known. Used for attribution.
propertiesbodyobjectNoProperties gates can match on (e.g. plan, value, count).
timestampbodystring (date-time)NoWhen the event occurred. Defaults to receipt time.
idempotency_keybodystringNoOptional dedup key in the body.
curl https://api.invitebase.com/v1/events \
  -H "Authorization: Bearer $INVITEBASE_SECRET_KEY" \
  -H "Idempotency-Key: evt-usr_123-sub-2026-07-09" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "subscription_started",
    "referred_user_id": "usr_123",
    "referral_code": "ANDREW-3F9K",
    "properties": { "plan": "paid" },
    "timestamp": "2026-07-09T14:32:00Z"
  }'

Response — 202 Accepted:

{
  "id": "4d7e9f2a-1b58-4c36-a0d9-8e5f3b6c2d14",
  "object": "event",
  "name": "subscription_started",
  "referred_user_id": "usr_123",
  "referral_code": "ANDREW-3F9K",
  "properties": { "plan": "paid" },
  "timestamp": "2026-07-09T14:32:00.000Z",
  "idempotency_key": null,
  "source": "api",
  "mode": "test",
  "livemode": false,
  "received_at": "2026-07-09T14:32:01.000Z"
}

Errors: 400 (malformed body), 401 (missing or invalid key), 429 (rate limited). See Errors.

If the event satisfies a campaign's qualification gate, the referral's gate_progress updates and — once all gates pass inside the window — the referral moves to validated and a Reward is created automatically.

What's next

On this page