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.
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);{
acceptedSpans: 1,
duplicateSpans: 0,
usage: {
customerId: '79e99bf5-9836-496a-a846-9533be1c4a16',
verificationPasses: 1,
amountUsd: 0.001
},
customerId: '79e99bf5-9836-496a-a846-9533be1c4a16'
}Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
eventType | string | Required | Classification of the event, up to 255 characters. You may send name instead, as an alias. If you send both, they must be equal. |
eventId | string | Optional | Duplicate key. See Idempotency and duplicates. |
source | string | Optional | Producing system. |
action | string | Optional | Source-native action name. |
actorType | string | Optional | Kind of actor. |
model, tool | string | Optional | Model or tool. If both are sent, only model is recorded. |
outcome | string | Optional | ok, error, unset, or unknown. |
timestamp | Date | string | number | Optional | A Date, a date string, or epoch milliseconds. The SDK converts it to an ISO string with milliseconds. |
metadata | object | Optional | Context 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 #
| Field | Type | Description |
|---|---|---|
acceptedSpans | number | 1 if a new record was created. |
duplicateSpans | number | 1 if the eventId was already recorded. |
usage.customerId | string | Your account identifier. |
usage.verificationPasses | number | All-time passes in the key's environment. |
usage.amountUsd | number | Passes multiplied by the unit price. |
customerId | string | Your 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 #
| Class | When |
|---|---|
AttestValidationError | event is not an object, or eventType is missing, too long, or conflicts with name. No request is sent. |
AttestAuthenticationError | The server returned 401 or 403. |
AttestServerError | Any other non-2xx response, including 400. error.status holds the HTTP status. |
AttestNetworkError | The request failed or timed out. error.code is NETWORK_ERROR or TIMEOUT_ERROR. |
AttestResponseError | The response was not the expected JSON. |