Quickstart

Send your first event to Vanta in under a minute.

Create a project

Open the Vanta dashboard and create a project. A project scopes all of your data to one app or service, so you will usually create one project per product.

Get your API key

After creating the project, generate an API key. Keys start with vk_. The full key is shown exactly once; copy it and store it somewhere safe.

Install the SDK

Initialize your project if it does not exist yet, then install the Node.js SDK.

bash
npm init -y
npm install @vanta-dev/node

Track your first event

Create a file named track.ts with the following content. It builds a client from your API key, records a signup event for a user, flushes, and closes.

typescript
import { Vanta } from '@vanta-dev/node'

const vanta = new Vanta({
  apiKey: process.env.VANTA_API_KEY,
})

await vanta.track({
  event: 'user.signup',
  userId: '123',
})

await vanta.shutdown()

Run it from your terminal:

bash
node track.ts

The event is delivered to the Vanta API using the key from your environment. The client reads VANTA_API_KEY automatically, so make sure it is set before running.

See it in the dashboard

Open your project in the dashboard and switch to the live event stream. Your user.signup event should appear within a moment.

See how fields map to stored data

The event name and user ID you pass to track are stored as the event type and the user who performed it, while contents such as data are stored as structured properties. Use the builder below to see the mapping.

Event fields
SDK code
await vanta.track({
  event: 'checkout.completed',
  userId: 'user_123',
  data: {
    amount: 49.99,
    currency: 'USD',
  },
})
What gets stored
{
  "type": "checkout.completed",
  "userId": "user_123",
  "data": {
    "amount": 49.99,
    "currency": "USD"
  }
}

Custom event names must not start with $. That prefix is reserved for Vanta's internal event types.

Identify a user

Call identify to record profile details for a user so they persist across events.

typescript
await vanta.identify({
  userId: '123',
  email: 'sarah@example.com',
  name: 'Sarah',
  properties: {
    plan: 'free',
  },
})

Now that you have sent an event, learn how projects, API keys, and environments work, then explore the core concepts.