Skip to main content
Sparkles emits an ordered event stream for each API access grant. Webhooks carry one event per request; the event feed returns the same durable events for gap recovery.

Event envelope

Every durable event contains: Process events in numeric sequence order and deduplicate on id.

Credit claim events

credit_claim.created fires after Sparkles creates and reserves a unique claim. Its status is pending and claimedAt is null. credit_claim.claimed fires after Sparkles adds the credits once to the recipient’s selected organization. Its status is claimed and claimedAt contains an ISO 8601 timestamp. Both payloads contain:

Attributed lifecycle events

All lifecycle payloads contain claimId, leadId, variant, and occurredAt. Attribution is immutable first touch. Project, task, and pull-request events use the first claimed offer for the exact recipient and selected organization. Paid conversion uses the first claimed offer for the selected organization. Redeeming a later claim does not replace either attribution.

Recover a sequence gap

Use the event feed only for backfills or webhook gap recovery:
Save nextCursor only after processing every returned event successfully, then pass it as the next after value. The default and maximum limit is 100. An empty page preserves the supplied cursor.

Recovery loop

  1. Read your last durable cursor.
  2. Request events with after=<cursor>.
  3. Process each event in ascending sequence order.
  4. Deduplicate each event by UUID.
  5. Save nextCursor after the batch commits.
  6. Repeat until data is empty.
See error handling for rate-limit and retry behavior.