Guides
Verify an event
Send a machine activity event, read the response, and handle rejections.
Choose the fields #
Only eventType is required. The fields below are all that POST /v1/events accepts: any other top-level field rejects the request with unknown event field.
| Field | Use it for |
|---|---|
eventType | A stable, dotted classification you can report on, for example ai.agent.tool_call or payment.refund.issued. |
eventId | Your own unique ID for the event, such as a job or request ID. This is the duplicate key. |
source | The service or agent that produced the event. |
action | The source's own name for what it did, such as search. |
actorType | The kind of actor, such as agent or service. |
model or tool | The model or tool involved. If you send both, only model is recorded. |
outcome | ok, error, unset, or unknown. |
timestamp | When your system says the event happened, as YYYY-MM-DDTHH:mm:ss.sssZ or YYYY-MM-DDTHH:mm:ssZ. |
metadata | Small context object. See what is recorded. |
String fields other than metadata accept letters, digits, and . _ : / - only. Length bounds are in Limits.
Send the event #
Use the SDK from Node.js, or send JSON from any language. All three tabs send the same request.
import { Attest } from "@attestinfra/sdk";
const attest = new Attest({ apiKey: process.env.ATTEST_API_KEY });
const result = await attest.verify({
eventType: "ai.agent.tool_call",
eventId: "job_7f3c9a12",
source: "research-agent",
action: "search",
actorType: "agent",
model: "summarizer-v2",
outcome: "ok",
timestamp: "2026-10-19T14:03:07.120Z",
metadata: { ticket: "SUP-1042", region: "us-east-1" },
});
console.log(result.acceptedSpans, result.duplicateSpans);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_7f3c9a12",
"source": "research-agent",
"action": "search",
"actorType": "agent",
"model": "summarizer-v2",
"outcome": "ok",
"timestamp": "2026-10-19T14:03:07.120Z",
"metadata": { "ticket": "SUP-1042", "region": "us-east-1" }
}'import json, os, urllib.request
event = {
"eventType": "ai.agent.tool_call",
"eventId": "job_7f3c9a12",
"source": "research-agent",
"action": "search",
"actorType": "agent",
"model": "summarizer-v2",
"outcome": "ok",
"timestamp": "2026-10-19T14:03:07.120Z",
"metadata": {"ticket": "SUP-1042", "region": "us-east-1"},
}
request = urllib.request.Request(
"https://attestinfra.com/v1/events",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["ATTEST_API_KEY"],
"Content-Type": "application/json",
},
data=json.dumps(event).encode(),
)
with urllib.request.urlopen(request) as response:
print(response.status, json.loads(response.read()))Read the response #
A 200 means the event is either newly recorded (accepted_spans: 1) or already recorded under the same eventId (duplicate_spans: 1). Both are success. Do not retry a duplicate.
usage is the all-time total for the environment.
Each event accepted through POST /v1/events returns a signed receipt (payload, hash, signature) that the caller can verify with attest's published key. It is the single entry in receipts. A duplicate returns the receipt of the original acceptance, with status: "duplicate" and the same hash and signature. To check it, see Verify a receipt independently. Every field is described in Receipt fields.
{
"accepted_spans": 1,
"duplicate_spans": 0,
"usage": {
"customer_id": "79e99bf5-9836-496a-a846-9533be1c4a16",
"environment_id": "1f7133e2-ec96-4c4c-89d1-ebdb7ca3dde3",
"verification_passes": 1,
"amount_usd": 0.001
},
"receipts": [
{
"status": "accepted",
"attestation_id": "otlp_d364c0280e22f7b0e183a71f187b0270",
"verified_at": "2026-10-19T14:03:07.214Z",
"payload": "{\"attestation_id\":\"otlp_d364c0280e22f7b0e183a71f187b0270\",...}",
"hash": "b74becb11d03de3606d4080f4be632ad6320da244cef20651d894a6ca2a8b7f5",
"signature": "M9U1o7wgXZnxB5KI/XZMJtZhASk22ZFDfkQYVYHKgcHC...",
"signer": {
"fingerprint": "sha256:552054128c0ca6f3fe6b6ef38e062f22593705e2e10a648a20418434f53b5e12"
}
}
],
"customer_id": "79e99bf5-9836-496a-a846-9533be1c4a16",
"environment_id": "1f7133e2-ec96-4c4c-89d1-ebdb7ca3dde3",
"event_type": "ai.agent.tool_call"
}What is recorded #
- The signed record holds
eventType,source,action,actorType,modelortool,outcome, and yourtimestampas sent, plus attest's own verification time. - Your
eventIdis not stored as sent. attest stores a keyed pseudonym of it (external_event_id, prefixedpsn_) that is stable within your account. metadatais validated but not stored. It contributes tosource_payload_hash, a SHA-256 of the canonical JSON of your entire request body. Keep your own copy of the body if you want to prove later what that hash covers.
Handle errors #
| Status | What to do |
|---|---|
400 | Fix the request. The error string names the field, for example invalid eventType or metadata exceeds 8KB. Retrying unchanged will fail again. |
401 | Check the key. See Failed authentication. |
413 | The body is over 1 MB. Send less. |
500, 503, timeout | Retry with the same eventId. If the first attempt was recorded, the retry comes back as a duplicate. |
The SDK raises AttestServerError for non-authentication HTTP errors, with the status in error.status. It does not pass on the server's error string. See SDK errors.