Guides
Idempotency and duplicates
Retry safely: control duplicate detection with eventId and witness replays.
Event duplicates #
For POST /v1/events, the duplicate key is eventId, scoped to the environment of the key you send. The first request with a given eventId is recorded and counted. Every later request with the same eventId in that environment returns 200 with duplicate_spans: 1. It creates no record and no Verification Pass. Its receipts entry has status: "duplicate" and is the receipt of the first request, with the same hash and signature.
This makes retries safe. After a timeout or a 5xx, send the identical request again. If the first attempt landed, you get a duplicate. If it did not, you get an accepted record.
curl -X POST https://attestinfra.com/v1/events \
-H "Authorization: Bearer $ATTEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"eventType": "ai.agent.tool_call", "eventId": "job_retry_41"}'{ "accepted_spans": 1, "duplicate_spans": 0, "receipts": [{ "status": "accepted", ... }], ... }curl -X POST https://attestinfra.com/v1/events \
-H "Authorization: Bearer $ATTEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"eventType": "ai.agent.tool_call", "eventId": "job_retry_41"}'{ "accepted_spans": 0, "duplicate_spans": 1, "receipts": [{ "status": "duplicate", ... }], ... }Rules #
- Only
eventIdis compared. A later request with the sameeventIdbut different fields is still a duplicate, and its contents are discarded. The first record stands. - No
eventId, no duplicate detection. If you omit it, attest assigns a random ID, so every retry creates a new record and a new pass. - Per environment. The same
eventIdin Sandbox and in Production produces two independent records. - No expiry. An
eventIdstays recorded. Reusing it months later is still a duplicate.
Witness replays #
Each pair has at most one observation per stage. The identity of an observation is its full normalized content, including timestamp and evidence.
| Request | Result |
|---|---|
| First observation for a stage | 201, duplicate: false, one Verification Pass. |
| Identical observation again | 200, duplicate: true, no pass. |
| Different content for a recorded stage | 409 WITNESS_CONFLICT. |
| Any observation after finalization | 409 WITNESS_FINALIZED. |
| Finalize again | 200 with the same finalized pair, no pass. |
The timestamp forms 2026-10-19T14:05:00Z and 2026-10-19T14:05:00.000Z are the same identity. Any other change to the timestamp is a conflict.