Skip to main content

Review Corrections from an Agent

The review loop for an agent: claim an item, inspect the cited page, submit a correction with an Idempotency-Key and read it back. Retries never apply twice.

This is the loop an agent runs to clear review work for a person. Every step acts with that person's permissions, and a retried write never applies twice.

  1. Claim: POST /v1/field-reviews/checkout returns your batch.
  2. Inspect: GET /v1/field-reviews/{docId}/{fieldKey}/provenance gives the value, its checks and the cited page; open the page with GET /v1/documents/{id}/file.
  3. Correct: POST /v1/field-reviews/{docId}/{fieldKey}/resolve with action: correct, the corrected_value, and optionally an evidence_quote from the cited document, which is verified verbatim. Send an Idempotency-Key.
  4. Continue: a corrected field resumes the rest of its processing; poll the run (GET /v1/pipelines/{id}) or listen for run.completed.
  5. Receipt: the decision log (GET /v1/field-reviews/decisions?pipeline_id=…) records the prior and final value, the action and the reason.

Submit a correction (safe to retry)

curl -s -X POST https://api.talonic.com/v1/field-reviews/2f6d1e8a-9c44-4b0d-a7f3-5e1c0d9b8a62/invoice_total/resolve \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: fix-invoice-total-2f6d" \
  -d '{ "action": "correct", "corrected_value": "1240.00", "reason": "Total on page 2", "evidence_quote": "Gesamtbetrag 1.240,00 EUR", "document_id": "9a8b7c6d-5e4f-4a3b-9c2d-1e0f9a8b7c6d" }'

Retries and Idempotency-Key

Send an Idempotency-Key (1 to 64 characters, unique per intended write) on review writes. A retry with the same key and the same request returns the stored response, with its original status and the header Idempotent-Replayed: true, and changes nothing. The same key on a different request answers 422 idempotency_key_reused; a retry while the first request is still running answers 409 idempotency_request_in_progress, so wait a moment and retry. A first request that failed leaves no stored response, so its retry runs for real. Keys are scoped to your workspace and replay for 24 hours.

Frequently asked questions

Can a retried correction be applied twice?+
Not when the request carries an Idempotency-Key: the retry returns the first response and changes nothing. Without a key, resolving an item that is no longer in review answers 400, so the value is still not changed twice.
Which scope does an agent need?+
reviews:read to list and inspect, reviews:write to claim, recommend and annotate. The person behind the credential also needs the edit permission in the workspace.