77trust / 100

Cohort Retention

by HALOWERK Agent Tools in Productivity & SaaS

x402 APIPassing, checked 7 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
Price
$0.002
per call in USDC
Uptime
97.0%
last 30 days
Response time
133 ms
240 ms slowest 5%
Last check
Passed
7 h ago, next any minute now

Run a free test callHow to call it

Reliability

All checks passedSome failedAll failedNot checked

Status and outage history · Atom feed · Watch with other listings

How to call it

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

Each call costs $0.002 in USDC on Base, paid with the request over x402.

Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.

Example request

From the listing.

POST https://tools.halowerk.com/v1/cohort/retention
content-type: application/json

{
  "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
}

Parameters

ParameterTypeRequiredDescription
activation_typestringNoIf set, only events of this type put a user into a cohort. Without it the first event of any type counts.
eventsarrayYesEach event needs user_id and a timestamp (time_unix_s in seconds since 1970, or time as ISO 8601). Optional: type and value. Any other field name is rejected rather than guessed. The service caps the whole request body at 256 KB, so long records reach that limit before maxItems.
periodstringNo One of: day, week, month. Default: "week".
periodsintegerNoHow many periods the table runs, period 0 being the entry period. Default: 12.
retention_typesarray of stringNoIf set, only events of these types count as being active. Without it every event counts.
timezone_offset_sintegerNoOffset from UTC in seconds used to place period boundaries. Default: 0.
week_startstringNo One of: monday, sunday. Default: "monday".

Example response

The provider's example. We can't check it without paying.

Example response, 68 lines
{
  "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"
}

Call it from code

The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.002.

curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://tools.halowerk.com/v1/cohort/retention' \
  -H 'content-type: application/json' \
  --data-raw '{"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}'

# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://tools.halowerk.com/v1/cohort/retention' \
  -H 'content-type: application/json' \
  --data-raw '{"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}' \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
JavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

// Pays at most $0.002 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.002" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.002 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Ftools.halowerk.com%2Fv1%2Fcohort%2Fretention&method=POST
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(res.status, await res.text());
Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

# Pays at most $0.002 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.002"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))

with x402_requests(client) as session:
    res = session.post(
        "https://tools.halowerk.com/v1/cohort/retention",
        json={
            "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,
        },
    )
    print(res.status_code, res.text)

Security scan

No findings

We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
7 h agoPassed402198 ms$0.002
17 h agoPassed402379 ms$0.002
28 h agoPassed402168 ms$0.002
38 h agoPassed402115 ms$0.002
2 days agoPassed402133 ms$0.002
Show 10 older checks
2 days agoPassed402153 ms$0.002
3 days agoPassed402152 ms$0.002
4 days agoTimed out---
6 days agoTimed out---
7 days agoPassed402144 ms$0.002
7 days agoPassed402240 ms$0.002
8 days agoPassed402133 ms$0.002
8 days agoPassed402133 ms$0.002
8 days agoPassed402120 ms$0.002
9 days agoPassed402125 ms$0.002