Get started
Quickstart
Verify your first event in Sandbox with the SDK or one HTTP request.
1. Get a Sandbox key #
Create an account, verify your email, and open API Keys in the dashboard. Create a Sandbox key (it starts with att_test_) and export it. Sandbox requests are never billed.
export ATTEST_API_KEY=att_test_...2. Install the SDK #
The SDK is a dependency-free package for Node.js 18 or later. If you are not on Node.js, skip to step 3 and use the cURL tab: any client that can send an authenticated HTTPS request works.
npm install @attestinfra/sdk@0.2.03. Verify an event #
Send one event. eventType is the only required field. eventId is your own identifier and makes retries safe: sending the same eventId again is recorded as a duplicate, not a second pass.
The SDK calls POST /v1/events for you. The cURL tab sends the same request directly.
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",
outcome: "ok",
});
console.log(result);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",
"outcome": "ok"
}'4. Read the result #
acceptedSpans: 1 means attest created a new signed record. Run the same request again and you get acceptedSpans: 0 and duplicateSpans: 1, and the pass count does not change.
usage is the running total for the environment, not the cost of this request. The raw HTTP response uses snake_case names. See POST /v1/events.
{
acceptedSpans: 1,
duplicateSpans: 0,
usage: {
customerId: '79e99bf5-9836-496a-a846-9533be1c4a16',
verificationPasses: 1,
amountUsd: 0.001
},
customerId: '79e99bf5-9836-496a-a846-9533be1c4a16'
}5. Optional: witness an operation #
To record what happened on both sides of a boundary, such as a payment request leaving checkout and arriving at the payment service, wrap the operation with prepareWitness. attest records an assembly observation before your function runs and a delivery observation after it, then reconciles them.
Persist prepared.pairId and prepared.assemblyIdentity before calling execute so you can recover if the process dies. See Witness a round-trip.
import { Attest } from "@attestinfra/sdk";
const attest = new Attest({ apiKey: process.env.ATTEST_API_KEY });
// Your operation. Replace with the real call.
async function transferFunds() {
return { transferId: "tr_82" };
}
const prepared = attest.prepareWitness({
eventType: "transfer.requested",
source: "checkout",
destination: "payments",
action: "transfer",
evidence: { actionId: "transfer_82", amount: 500, currency: "USD" },
});
const { result, witness } = await prepared.execute(() => transferFunds());
console.log(result, witness.reconciliationStatus);{ transferId: 'tr_82' } matchedNext steps #
- Activate Production and swap in an
att_live_key. - Read Verify an event for field choices and error handling.
- Read What attest attests before relying on a record.