API reference
Verify an event
Verifies, signs, and records one machine activity event; an eventId already recorded in the same environment is acknowledged as a duplicate and creates no Verification Pass.
POST/v1/eventsSandbox and Production differ
Overview #
Verifies, signs, and records one machine activity event; an eventId already recorded in the same environment is acknowledged as a duplicate and creates no Verification Pass.
Authenticate with an environment API key in the Authorization: Bearer header. See Authentication.
Environments. Production: each accepted event is one billed Verification Pass. Sandbox: recorded and counted, never billed.
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"
}
}'const response = await fetch("https://attestinfra.com/v1/events", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATTEST_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"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(response.status, await response.json());import json, os, urllib.request
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({
"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",
},
}).encode(),
)
with urllib.request.urlopen(request) as response:
print(response.status, json.loads(response.read()))Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
eventType | string (body) | Required | Your classification of the activity, for example ai.agent.tool_call. max 255 characters; pattern ^[A-Za-z0-9._:/-]+$ |
eventId | string (body) | Optional | Your identifier for this event. The duplicate key within an environment. If omitted, a random ID is used and the event can never be detected as a duplicate. max 256 characters; pattern ^[A-Za-z0-9._:/-]+$ |
source | string (body) | Optional | The system that produced the event. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$ |
action | string (body) | Optional | The source's own name for the action. Recorded as unknown if omitted. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$ |
actorType | string (body) | Optional | What kind of actor performed the action. Recorded as unknown if omitted. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$ |
model | string (body) | Optional | Model involved. If both model and tool are sent, only model is recorded. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$ |
tool | string (body) | Optional | Tool involved. Recorded only when model is absent. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$ |
outcome | ok | error | unset | unknown (body) | Optional | Result reported by the source. Recorded as unknown if omitted. |
timestamp | string (body) | Optional | When the source says the event occurred, in UTC. Recorded as sent; attest adds its own verification time. |
metadata | object (body) | Optional | Your context. At most 32 top-level keys, 8 KB serialized, 2 levels of nesting below the top level, and keys of 1-128 characters. |
Response #
200 The event was accepted or recognized as a duplicate. Both responses include the signed receipt.
Response fields #
| Field | Type | Description |
|---|---|---|
accepted_spans | 0 | 1 | 1 if this request created a new record. |
duplicate_spans | 0 | 1 | 1 if the eventId was already recorded in this environment. |
usage | object | |
receipts | array | The signed receipt for the event, as one entry. For a duplicate it is the receipt of the original acceptance. |
customer_id | string | Your account identifier. |
environment_id | string | The environment the key belongs to. |
event_type | string | The eventType you sent. |
{
"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"
}{
"accepted_spans": 0,
"duplicate_spans": 1,
"usage": {
"customer_id": "79e99bf5-9836-496a-a846-9533be1c4a16",
"environment_id": "1f7133e2-ec96-4c4c-89d1-ebdb7ca3dde3",
"verification_passes": 1,
"amount_usd": 0.001
},
"receipts": [
{
"status": "duplicate",
"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"
}Errors #
| Status | error | code | Meaning |
|---|---|---|---|
400 | unknown event field | — | The body is not valid JSON or an event field failed validation. The error string names the field. |
400 | invalid eventType | — | The body is not valid JSON or an event field failed validation. The error string names the field. |
400 | metadata exceeds 8KB | — | The body is not valid JSON or an event field failed validation. The error string names the field. |
400 | Malformed JSON payload | — | The body is not valid JSON or an event field failed validation. The error string names the field. |
401 | Invalid API key | — | The API key is missing, unknown, revoked, or belongs to an environment that is not active. |
413 | JSON payload exceeds the configured limit | — | The request body is larger than 1 MB. |
500 | Event ingestion failed | — | The event could not be recorded. |
503 | Attestation verification failed | — | The signed record failed its own verification check and was not stored. |
All error bodies and their causes are listed in Errors.
{
"error": "unknown event field"
}{
"error": "invalid eventType"
}{
"error": "metadata exceeds 8KB"
}{
"error": "Malformed JSON payload"
}{
"error": "Invalid API key"
}