attest Docs

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.

Request · cURL · First attempt
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"}'
Response · 200 · First attempt
{ "accepted_spans": 1, "duplicate_spans": 0, "receipts": [{ "status": "accepted", ... }], ... }
Request · cURL · Retry
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"}'
Response · 200 · Retry
{ "accepted_spans": 0, "duplicate_spans": 1, "receipts": [{ "status": "duplicate", ... }], ... }

Rules #

  • Only eventId is compared. A later request with the same eventId but 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 eventId in Sandbox and in Production produces two independent records.
  • No expiry. An eventId stays 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.

RequestResult
First observation for a stage201, duplicate: false, one Verification Pass.
Identical observation again200, duplicate: true, no pass.
Different content for a recorded stage409 WITNESS_CONFLICT.
Any observation after finalization409 WITNESS_FINALIZED.
Finalize again200 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.