attest Docs

SDK

verify()

Submit one event from Node.js and read the normalized result.

Usage #

attest.verify(event) sends one event to POST /v1/events and resolves with a camelCase summary of the response. It resolves for both new and duplicate events.

Request · JavaScript (SDK)
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",
  model: "summarizer-v2",
  outcome: "ok",
  timestamp: new Date("2026-10-19T14:03:07.120Z"),
});
console.log(result);
Output · Console
{
  acceptedSpans: 1,
  duplicateSpans: 0,
  usage: {
    customerId: '79e99bf5-9836-496a-a846-9533be1c4a16',
    verificationPasses: 1,
    amountUsd: 0.001
  },
  customerId: '79e99bf5-9836-496a-a846-9533be1c4a16'
}

Parameters #

NameTypeRequiredDescription
eventTypestringRequiredClassification of the event, up to 255 characters. You may send name instead, as an alias. If you send both, they must be equal.
eventIdstringOptionalDuplicate key. See Idempotency and duplicates.
sourcestringOptionalProducing system.
actionstringOptionalSource-native action name.
actorTypestringOptionalKind of actor.
model, toolstringOptionalModel or tool. If both are sent, only model is recorded.
outcomestringOptionalok, error, unset, or unknown.
timestampDate | string | numberOptionalA Date, a date string, or epoch milliseconds. The SDK converts it to an ISO string with milliseconds.
metadataobjectOptionalContext object, validated and hashed but not stored. See Limits.

The SDK checks only eventType locally. Every other field is validated by the server. Fields not listed here are dropped before sending.

Returns #

FieldTypeDescription
acceptedSpansnumber1 if a new record was created.
duplicateSpansnumber1 if the eventId was already recorded.
usage.customerIdstringYour account identifier.
usage.verificationPassesnumberAll-time passes in the key's environment.
usage.amountUsdnumberPasses multiplied by the unit price.
customerIdstringYour account identifier.

environment_id, event_type, and receipts from the HTTP response are not included in the SDK result. To keep the signed receipt, send the request over HTTP. See Verify a receipt from a response.

Errors #

ClassWhen
AttestValidationErrorevent is not an object, or eventType is missing, too long, or conflicts with name. No request is sent.
AttestAuthenticationErrorThe server returned 401 or 403.
AttestServerErrorAny other non-2xx response, including 400. error.status holds the HTTP status.
AttestNetworkErrorThe request failed or timed out. error.code is NETWORK_ERROR or TIMEOUT_ERROR.
AttestResponseErrorThe response was not the expected JSON.