Streakfox
API

Events API

Count actions with the webhook endpoint and read a member's streak.

Count an action by posting it to your project's webhook from your server or an automation. Zapier, Make, n8n, Pipedream and anything else that can send an HTTP POST works. Server-to-server ingest always uses this endpoint.

Actions are never counted from the browser. The widget only displays progress.


Count an action

POST /v1/webhook/YOUR_PROJECT_KEY/e HTTP/1.1
Host: api.streakfox.com
Content-Type: application/json
X-Streak-Webhook-Secret: YOUR_WEBHOOK_SECRET

{
  "event": "lesson_complete",
  "userHash": "member_123",
  "idempotencyKey": "lesson_42:member_123"
}

Find the webhook URL and secret in onboarding on the Connect the action step, or later under Programs → Connections. Your project key is already in the URL.

curl -X POST https://api.streakfox.com/v1/webhook/YOUR_PROJECT_KEY/e \
  -H "Content-Type: application/json" \
  -H "X-Streak-Webhook-Secret: $STREAKFOX_WEBHOOK_SECRET" \
  -d '{"event":"lesson_complete","userHash":"member_123","idempotencyKey":"lesson_42:member_123"}'

Body fields

FieldTypeRequiredDescription
eventstringYesYour action, such as lesson_complete. It must match the action on your program.
userHashstringYesYour member ID. Use the same stable ID every time. Hash emails or internal IDs first.
idempotencyKeystringRecommendedA unique ID for this one completion. Retries with the same key count once.
tsISO 8601NoWhen the action happened. Defaults to when Streakfox receives it.
metaobjectNoYour own details for analytics, such as {"courseId": "course_123"}. Max about 4KB.
externalServicestringNoWhere the action came from, such as zapier or make. Shows up in source breakdowns.
integrationIdstringNoA stable name for this integration, such as course-complete-zap.
siteKeystringNoYour project key. It defaults from the URL, so you can leave it out.

Test and live

Before your program goes live, every action it receives counts as a test. You don't need to flag anything. Test progress never triggers real member follow-ups.

Going live needs one real action from your site or sender, not the dashboard, that moved a member's progress. After that, every action counts for real.

Response

A 202 with {"ok": true} means Streakfox has the action.

Errors

Errors come back as {"error": "CODE"}.

StatusCodeWhat to do
401WEBHOOK_SECRET_REQUIREDThe secret is missing or wrong. Copy it again from Programs → Connections into X-Streak-Webhook-Secret.
400INVALID_WIDGET_KINDNo program counts that action. Check event matches your program's action exactly.
400INVALID_BODYThe body isn't valid JSON or is missing event or userHash. Check the JSON and the Content-Type header.
400INVALID_SITE_KEYThe project key in the URL doesn't exist. Copy the webhook URL again.
400SITE_KEY_MISMATCHsiteKey in the body doesn't match the URL. Remove siteKey from the body.
413PAYLOAD_TOO_LARGEmeta is too big. Keep it under about 4KB.
409IDEMPOTENCY_KEY_IN_PROGRESSThe same completion is still being processed. Retry after 1 second.

Read a member's streak

The widget calls this for you. Use it directly if you build your own display.

GET /v1/state?siteKey=YOUR_PROJECT_KEY&userHash=MEMBER_ID&event=lesson_complete HTTP/1.1
Host: api.streakfox.com

Query parameters

ParamRequiredDescription
siteKeyYesYour project key
userHashYesYour member ID
eventYesYour action

Browser requests must come from your website address saved in Streakfox. A browser on another site gets 403 FORBIDDEN_ORIGIN.

Response

{
  "meta": {
    "apiVersion": "1",
    "isLive": true
  },
  "streak": {
    "mode": "continuous",
    "current": 5,
    "best": 12,
    "todayDone": true,
    "pending": false
  },
  "week": [
    {
      "isoDate": "2024-01-08",
      "label": "Mon",
      "dayNumber": 8,
      "isToday": false,
      "isCheckedIn": true
    }
    // ... 7 days total
  ],
  "milestones": [
    { "id": "ms_1", "target": 7, "msg": "1 week!", "achieved": false, "rewardType": "message" }
  ],
  "settings": {
    "theme": { "name": "beige" },
    "position": "bottom-right",
    "mainMessage": "Keep your streak going!"
  }
}

Coupon and link reward values stay hidden unless the request carries a signed identity token. The WordPress plugin handles this for you. See Authentication.


Usage limits

PlanActive streakers / month
Starter500
Growth2,500
Scale10,000
Pro50,000

An active streaker is a unique member with at least one counted action in the month.

If you go over your plan's limit, nothing breaks for your members. Actions are still accepted and streaks keep counting. Dashboard reports (Overview, Events and Insights) pause until you upgrade, then show everything that was tracked in the meantime. Proof stays available so you can always read or stop a running experiment.


Next steps

On this page