Skip to content
SaaSFunnelsHelp

Developers

Server events API

Send product events from your backend to SaaSFunnels with the Direct API.

Where to find itSettingsIntegrationsDirect API

On this page

Use the Direct API for events your server knows are true: a limit reached, a plan changed, an invoice paid, a usage total for the day. Events can start Funnels, decide who sees them and show up in Results.

The Direct API uses a secret key. Call it only from server code, never from a browser or mobile app.

Get a key

  1. Open Settings → Integrations → Direct API.
  2. Click Create key, set Access to Event ingestion, name it and click Create key.
  3. Copy the key now. It's shown once. Save it on your server as SAASFUNNELS_INGEST_API_KEY.

Send an event

Terminal
curl -X POST https://app.saasfunnels.com/api/events/ingest \
  -H "Authorization: Bearer $SAASFUNNELS_INGEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_id": "usage_limit_hit:acct_123:2026-11-20",
    "event_name": "usage_limit_hit",
    "account_id": "acct_123",
    "user_id": "user_456",
    "timestamp": "2026-11-20T15:00:00.000Z",
    "properties": { "plan": "starter", "limit_name": "monthly_events" }
  }'

The same request from Node.js:

JavaScript
const response = await fetch("https://app.saasfunnels.com/api/events/ingest", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SAASFUNNELS_INGEST_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    event_id: `usage_limit_hit:${accountId}:${day}`,
    event_name: "usage_limit_hit",
    account_id: accountId,
    timestamp: new Date().toISOString(),
    properties: { plan: "starter" },
  }),
});

Fields

FieldRequiredNotes
event_nameYesUp to 128 characters. Use a fixed lower_snake_case name.
account_idYesYour stable account ID. Use the same one as your sign-in route's accountKey.
event_idRecommendedA stable ID for this event. Resending the same ID doesn't create a duplicate.
timestampNoISO-8601 time the event happened. Defaults to now. Can't be more than 24 hours in the future.
user_idNoThe person who caused it.
valueNoA number, such as a usage count or amount.
propertiesNoExtra details as a flat JSON object. Don't include email addresses, passwords, tokens or card data.

A request body can be up to 64 KB. Send one event per request.

Responses

StatusMeaningWhat to do
200Received. data.duplicate is true if that event_id arrived before.Nothing.
400The body isn't valid JSON, is too large, or is missing event_name or account_id. The error field says which.Fix the payload. Don't retry it unchanged.
401The key is missing or wrong.Check the Authorization header.
403The key was revoked, or it's a Developer tools key.Use an active Event ingestion key.
429Too many requests this minute.Wait for the Retry-After seconds, then retry.
500 or 503A problem on our side.Retry with backoff and the same event_id.

Sending usage

Don't forward every API call your customers make. Run a scheduled job that sends one total per account and metric for each closed hour or day, with an event_id built from the account, metric and period. Retries then stay safe, and you stay well under the rate limit.

Check it worked

Validate a payload before you ship it with saasfunnels events validate (see CLI). After your first real send, confirm the event arrived; see Confirm events.

What's next