// FIRST REQUEST

POST a counter, get a chart

Short answer: one HTTPS POST records a count, the stat is created by that first write, and it is on a chart in your dashboard straight away. A stored point answers {"status":"ok"} with HTTP 200; a rejection is a real 4xx or 5xx status. Free is $0 with no card, open to the first 250 accounts — 10 stats, 300,000 datapoints a month, 30-day retention. A place is taken when your first datapoint is stored, after you confirm your email. Paid plans are $19 Indie, $49 Pro and $99 Scale a month, in USD. The same request, with every endpoint around it, is in the API docs.

1. Send the counter

Create an account, copy your API key, and paste this with your key in place of YOUR_API_KEY:

curl -X POST https://api.ezstat.dev/api/v1/stats/signups/count \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"count": 1}'

That is the whole integration: a name in the path, a Bearer key, and a JSON body. No SDK, no agent, no daemon.

2. Read the answer

A stored point answers {"status":"ok"} with HTTP 200. On these v1 routes the status code is the verdict, so you do not need a special header to find out whether the point landed:

200  {"status":"ok"}                     the point was accepted
400  bad body, a bad ikey, a reserved name, or a refused stat
401  no key, or a key that is not yours
403  datapoint limit, stat limit, or the free slots are taken
413  payload too large
429  rate limit — the Retry-After header says when to come back
500  server error
503  temporarily unavailable — retryable, with Retry-After

If no response arrives at all — a timeout or a reset — the outcome is unknown, not “it failed”: the point may have landed after your client gave up. A blind retry can double-count, so retry only with the same explicit timestamp and idempotency key on every attempt (next section).

3. The chart is already there

Open your dashboard: the stat you just posted is on a chart. Nothing is registered in advance, and nothing has to be configured first. Counters are summed per bucket when you read them back, and values are averaged — the same rule on every write route.

To put one chart in public view, mint a share token. It works with a dashboard session or your API key:

curl -X POST https://api.ezstat.dev/api/v1/stats/signups/share \
  -H "Authorization: Bearer $EZSTAT_API_KEY"

DELETE on the same path revokes it. The Free plan can share 1 public chart at a time; paid plans are unlimited. The public data behind a shared chart is GET /api/v1/embed/:statId?token=…&range=24h, with ranges 1h, 6h, 24h, 7d and 30d.

4. A value works the same way

A gauge — a response time, a queue depth, a disk percentage — goes to the sibling route:

curl -X POST https://api.ezstat.dev/api/v1/stats/response_time/value \
  -H "Authorization: Bearer $EZSTAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value": 142}'

An agent can record the same point with track_metric on the MCP server, which works on every plan within that plan's limits.

5. Retries, without double-counting

Send an explicit timestamp (a date string or epoch milliseconds) together with an ikey, and repeat the same pair on every attempt. The same stat + timestamp + ikey is stored once, first write wins, and a later identical single-point send answers replay: "duplicate_ignored" — a deduplicated single-point retry is not billed either.

An ikey on its own is not enough: without an explicit timestamp the server stamps each attempt's arrival time, so the retry is a new point. And a re-send that lands on a stored point without an ikey merges rather than replaces — a counter answers replay: "sums_with_existing" and a value answers replay: "averages_with_existing". There is no overwrite flag.

Coming from StatHat?

The /ez, /c and /v endpoints take the same form fields you already send, so existing instrumentation can point at EzStat. On that family a rejection can arrive as HTTP 200 with the verdict in the body unless you send X-EzStat-Strict: 1. New code should use the v1 routes above. The cut-over, including history import, is in the StatHat migration guide.

At your plan limit

What happens at your limit: Your plan's monthly datapoint allowance is spread across the month as a limit that resets daily. At the limit, new datapoints are refused until the reset, and the response says “datapoint limit reached”. There are no overage charges and no automatic upgrade. A request that would add a new stat name past your plan's stat count is refused as a whole; as long as you are within that count, writes to stats you already track keep recording. Reaching either limit deletes or hides nothing already stored; your dashboard and the read API keep working.

What you get by plan

PlanPriceStatsDatapoints / monthRetentionPublic shared charts
Free$0, no card10300,00030-day1 public chart at a time
Indie$19 / month10,0004,500,00030-dayUnlimited
Pro$49 / month10,00022,500,0001-yearUnlimited
Scale$99 / month10,000150,000,0003-yearUnlimited

Prices are monthly, in USD, excl. tax where applicable. Full comparison: pricing.

FAQ

Do I have to create the stat or build the chart first?
No. A stat is created by the first successful write, and it is on a chart in your dashboard straight away. Nothing is registered in advance.
What does a successful write answer?
HTTP 200 with {"status":"ok"}. On the v1 write routes a rejection is a real 4xx or 5xx status, with no extra header needed — so a response that arrived is the verdict. If no response arrived (a timeout or a reset), the outcome is unknown: the point may have landed, so do not blindly retry without an idempotency key.
How do I retry without double-counting?
Send an explicit timestamp (a date string or epoch milliseconds) together with an ikey, and repeat the same timestamp and ikey on every attempt. The same stat + timestamp + ikey is stored once, first write wins, and a later identical single-point send answers with replay "duplicate_ignored". An ikey alone is not enough: without timestamp the server stamps each attempt's arrival time, so the retry counts again.
Can I chart a value as well as a counter?
Yes. POST to /api/v1/stats/:name/value with {"value": 142} for a gauge such as a response time or a queue depth. Counters are summed per bucket when you read them back; values are averaged.
Can I share the chart publicly?
Yes. POST /api/v1/stats/:name/share mints a share token for a public chart (a dashboard session or your API key both work), and DELETE on the same path revokes it. The Free plan can share 1 public chart at a time; paid plans are unlimited. The public data endpoint is GET /api/v1/embed/:statId?token=…&range=24h, with ranges 1h, 6h, 24h, 7d and 30d.
What happens when I hit my plan limit?
New datapoints are refused until the limit resets, and the response says so. There are no overage charges and no automatic upgrade, and nothing already stored is deleted. See https://ezstat.dev/pricing.

See also