N

Netzhandwerker Agent Tools · Cohort Retention

by Netzhandwerker Agent Tools

POSTBase

$0.002

per call · USD Coin on Base

Builds the cohort table from the events you pass: users grouped by the period of their first event, counted again in each following period. Returns the table per cohort, a retention curve across all cohorts, and, where events carry a value, cumulative value and value per user. The curve counts only cohorts old enough for a given period, so a young cohort is not scored as churn. Day, week and month are real calendar periods. Nothing is fetched, nothing is stored.

Endpoint

POST https://tools.halowerk.com/v1/cohort/retention

1

Calls / 30d

1

Unique payers / 30d

Aug 19

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://tools.halowerk.com/v1/cohort/retention", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "events": [
      {
        "time_unix_s": 1785110400,
        "type": "order",
        "user_id": "u1",
        "value": 19.9
      },
      {
        "time_unix_s": 1785715200,
        "type": "order",
        "user_id": "u1",
        "value": 24.5
      },
      {
        "time_unix_s": 1785110400,
        "type": "order",
        "user_id": "u2",
        "value": 12
      },
      {
        "time_unix_s": 1785715200,
        "type": "order",
        "user_id": "u3",
        "value": 30
      }
    ],
    "period": "week",
    "periods": 3
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://tools.halowerk.com/v1/cohort/retention" \
  -H "Content-Type: application/json" \
  -d '{"events":[{"time_unix_s":1785110400,"type":"order","user_id":"u1","value":19.9},{"time_unix_s":1785715200,"type":"order","user_id":"u1","value":24.5},{"time_unix_s":1785110400,"type":"order","user_id":"u2","value":12},{"time_unix_s":1785715200,"type":"order","user_id":"u3","value":30}],"period":"week","periods":3}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "activation_type": null,
  "cohort_count": 2,
  "cohorts": [
    {
      "cohort": "2026-07-27T00:00:00.000Z",
      "cohort_start_unix_s": 1785110400,
      "periods": [
        {
          "active_users": 2,
          "cumulative_value": 31.9,
          "cumulative_value_per_user": 15.95,
          "period_index": 0,
          "period_value": 31.9,
          "retention_rate": 1
        },
        {
          "active_users": 1,
          "cumulative_value": 56.4,
          "cumulative_value_per_user": 28.2,
          "period_index": 1,
          "period_value": 24.5,
          "retention_rate": 0.5
        },
        {
          "active_users": 0,
          "cumulative_value": 56.4,
          "cumulative_value_per_user": 28.2,
          "period_index": 2,
          "period_value": 0,
          "retention_rate": 0
        }
      ],
      "users": 2
    }
  ],
  "curve": [
    {
      "active_users": 3,
      "cohorts_observed": 2,
      "period_index": 0,
      "retention_rate": 1,
      "users_at_risk": 3
    },
    {
      "active_users": 1,
      "cohorts_observed": 1,
      "period_index": 1,
      "retention_rate": 0.5,
      "users_at_risk": 2
    }
  ],
  "event_count": 4,
  "period": "week",
  "periods": 3,
  "retention_types": null,
  "stateless": true,
  "summary": {
    "first_event_unix_s": 1785110400,
    "last_event_unix_s": 1785715200,
    "median_lifetime_periods": 1,
    "total_value": 86.4,
    "value_per_user": 28.8
  },
  "timezone_offset_s": 0,
  "user_count": 3,
  "week_start": "monday"
}

Payment details

Pay to0x2880edfff13100677bf97a3cbdf3bc34771c4e5e
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Developer Tools and the homepage with a featured placement.

Get featured →

More from Netzhandwerker Agent Tools & similar services