Skip to main content

Review Stats

Monitor the review backlog with GET /v1/review/stats: per-status record counts for dashboards, alerting on pending queue depth, and review throughput.

GET /v1/review/stats returns a summary of the Record Review queue: the total number of validation records in your workspace and a by_status breakdown. Use it to monitor backlog size, track review throughput, and trigger alerts when pending items exceed a threshold. It is a single aggregate query, so it stays cheap to poll even when the underlying queue holds hundreds of thousands of records.

The by_status object is keyed by whichever statuses actually exist on your records — pending, approved, rejected, auto_approved, and partial are the possible keys. Statuses with zero records are omitted rather than reported as 0, and a workspace with no review records at all returns { "total": 0, "by_status": {} }. Guard your dashboard code with defaults (by_status.pending ?? 0) instead of assuming every key is present.

The counts cover every run and schema in the workspace; there is no per-schema or per-run breakdown on this endpoint. To decompose the backlog, list GET /v1/review?status=pending and group client-side by schema_id — the list rows carry both schema_id and run_id. The auto_approved count is also the fastest way to verify a schema's sampling policy is doing what you expect: it should grow in proportion to (100 − sample rate) percent of completed records.

One scoping difference from the list endpoint matters for restricted keys: stats are computed over all records in the workspace, while GET /v1/review drops records whose source document is hidden from the key's minting user. A key operating under source-visibility rules can therefore see a pending count here that is higher than the number of rows its own list call returns. Alert on stats, but drive work assignment from the list.

Stats also close the loop on review policy tuning. If pending grows faster than your reviewers clear it, lower the schema's sampling rate or move it out of full-validation mode; if rejected stays near zero over a long window, the sample is telling you extraction quality supports a lower rate. Because the endpoint is a point-in-time aggregate, compute rates yourself by differencing successive samples — the API keeps no history of past counts.

The by_status.pending count is the live human-review backlog. total includes approved, rejected, and auto_approved records, so it grows monotonically and is better suited to throughput dashboards than alerting.
GET/v1/review/stats

curl

curl -s https://api.talonic.com/v1/review/stats \
  -H "Authorization: Bearer tlnc_your_api_key"

Response

Response fields

totalintegerTotal number of review records across all statuses.
by_statusobjectCount of records keyed by status. Possible keys: pending, approved, rejected, auto_approved, partial. Keys with zero records are omitted.

Response

{
  "total": 1260,
  "by_status": {
    "pending": 15,
    "approved": 230,
    "rejected": 15,
    "auto_approved": 1000
  }
}

Errors

Error responses

401unauthorizedMissing or invalid API key.
403insufficient_scopeThe key lacks the read scope.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.

This endpoint is typically called on a dashboard polling loop to drive queue-depth indicators. A practical alerting pattern: sample by_status.pending every minute, alert when it crosses your SLA threshold, and compute throughput as the delta of approved + rejected between samples. Once the pending count crosses the threshold, fetch the actual items with [GET /v1/review?status=pending](list-review-items) and distribute them via [POST /v1/review/:id/assign](review-assign).

Frequently asked questions

Does the stats endpoint count all-time or only active items?+
It counts all review records across all statuses, including approved, rejected, and auto_approved items, so total grows monotonically. Use the `by_status.pending` value to see only the active backlog.
How often should I poll review stats?+
Stats are computed on each request with a single aggregate query, so polling is cheap. For dashboard polling, an interval of 30–60 seconds is reasonable; the calls are metered under the general platform rate-limit namespace, not a submission quota.
What statuses appear in by_status?+
The object is keyed by every status present on your review records: pending, approved, rejected, auto_approved, and partial. Statuses with zero records are omitted rather than reported as 0, so read counts with a fallback default.
Why does pending here exceed the rows my list call returns?+
Stats aggregate over all records in the workspace, while GET /v1/review filters out records whose source document is hidden from your key's minting user. Under source-visibility rules the two can legitimately diverge — treat stats as the workspace-wide view and the list as your key's actionable view.
Can I break the backlog down by schema or run?+
Not on this endpoint — it returns workspace-wide totals only. Page GET /v1/review?status=pending and group client-side on schema_id or run_id; every list row carries both, so a per-schema pending histogram is a single paged pass.