SDKs

Node.js

The @avetrust/node SDK — TypeScript-first client for the AveTrust API.

Install

npm i @avetrust/node

Initialize

import { AveTrust } from "@avetrust/node";

const av = new AveTrust(process.env.AVETRUST_API_KEY!);
// Sandbox is inferred from a sk_test_ key. Override the host with { baseUrl }.

Create a verification

const v = await av.verifications.create({
  checks: ["DOCUMENT", "LIVENESS", "FACE_MATCH"],
  externalUserId: "user_42",
  callbackUrl: "https://your-app.example/kyc/webhook",
});

console.log(v.id, v.hostedUrl);

Read the result

const result = await av.verifications.result(v.id);
console.log(result.status);            // APPROVED | REJECTED | REVIEW
console.log(result.decision?.outcome);
for (const c of result.checks) console.log(c.type, c.result, c.score);

Or stream progress in real time (SSE):

const final = await av.verifications.stream(v.token, {
  onStatus: (e) => console.log("status", e.status),
});
console.log(final.status);
await av.verifications.sendLink(v.id, {
  channel: "EMAIL",          // or "SMS"
  to: "client@example.com",
  link: v.hostedUrl!,
});

Decide manually

await av.verifications.decide(v.id, "approved", "Reviewed by agent");

Verify a webhook

The webhooks helper checks the X-AveTrust-Signature header (HMAC-SHA256) — no network call.

const event = av.webhooks.constructEvent(
  rawBody,                                  // the raw request body (string/Buffer)
  req.headers["x-avetrust-signature"],
  process.env.AVETRUST_WEBHOOK_SECRET!,
);
console.log(event.type, event.data.status);

Next steps

On this page