81trust / 100
Cohort Retention
by HALOWERK Agent Tools in Productivity & SaaS
x402 APIPassing, checked 3 h ago
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.
POST https://tools.halowerk.com/v1/cohort/retention
Last 30 days
All checks passedSome failedAll failedNot checked
- Uptime
- 100%
- Response time
- 38 ms typical, 38 ms slowest 5%
- Last check
- 3 h ago
- Next check
- any minute now
How to call it
# See the payment challenge (nothing is charged)
curl -i -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}'import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client().register(
"eip155:8453",
new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? Preflight it first for $0.03:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Ftools.halowerk.com%2Fv1%2Fcohort%2Fretention
const res = await pay("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}),
});
console.log(await res.json());Example input
{
"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
}Example output
{
"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"
}Security scan
- No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 3 h ago | Passed | 402 | 38 ms | $0.002 |