attest Docs

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.

Request · cURL
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"
    }
  }'
Request · JavaScript
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());
Request · Python
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 #

NameTypeRequiredDescription
eventTypestring (body)RequiredYour classification of the activity, for example ai.agent.tool_call. max 255 characters; pattern ^[A-Za-z0-9._:/-]+$
eventIdstring (body)OptionalYour 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._:/-]+$
sourcestring (body)OptionalThe system that produced the event. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$
actionstring (body)OptionalThe source's own name for the action. Recorded as unknown if omitted. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$
actorTypestring (body)OptionalWhat kind of actor performed the action. Recorded as unknown if omitted. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$
modelstring (body)OptionalModel involved. If both model and tool are sent, only model is recorded. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$
toolstring (body)OptionalTool involved. Recorded only when model is absent. max 128 characters; pattern ^[A-Za-z0-9._:/-]+$
outcomeok | error | unset | unknown (body)OptionalResult reported by the source. Recorded as unknown if omitted.
timestampstring (body)OptionalWhen the source says the event occurred, in UTC. Recorded as sent; attest adds its own verification time.
metadataobject (body)OptionalYour 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 #

FieldTypeDescription
accepted_spans0 | 11 if this request created a new record.
duplicate_spans0 | 11 if the eventId was already recorded in this environment.
usageobject
receiptsarrayThe signed receipt for the event, as one entry. For a duplicate it is the receipt of the original acceptance.
customer_idstringYour account identifier.
environment_idstringThe environment the key belongs to.
event_typestringThe eventType you sent.
Response · 200 · New event accepted
{
  "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"
}
Response · 200 · Same eventId sent again: the original receipt
{
  "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 #

StatuserrorcodeMeaning
400unknown event field—The body is not valid JSON or an event field failed validation. The error string names the field.
400invalid eventType—The body is not valid JSON or an event field failed validation. The error string names the field.
400metadata exceeds 8KB—The body is not valid JSON or an event field failed validation. The error string names the field.
400Malformed JSON payload—The body is not valid JSON or an event field failed validation. The error string names the field.
401Invalid API key—The API key is missing, unknown, revoked, or belongs to an environment that is not active.
413JSON payload exceeds the configured limit—The request body is larger than 1 MB.
500Event ingestion failed—The event could not be recorded.
503Attestation verification failed—The signed record failed its own verification check and was not stored.

All error bodies and their causes are listed in Errors.

Response · 400 · Field not in the allowed list
{
  "error": "unknown event field"
}
Response · 400 · eventType missing or invalid
{
  "error": "invalid eventType"
}
Response · 400 · metadata over 8 KB
{
  "error": "metadata exceeds 8KB"
}
Response · 400 · Body is not JSON
{
  "error": "Malformed JSON payload"
}
Response · 401
{
  "error": "Invalid API key"
}