Quickstart

The fastest path from zero to a working call. In a few minutes you will define a schema, write a record, search it, and ground a model on it — one continuous thread. Everything here uses the Node SDK and synthetic data (fictional names and values only).

You need a Vectros API key (an sk_*, ssk_*, or st_* credential) and the API base URL. If you don't have a key yet, request access from the Vectros site; once approved, mint one from the developer portal or the CLI.

1. Install and construct a client

npm install @vectros-ai/sdk
import { VectrosClient } from '@vectros-ai/sdk';

const client = new VectrosClient({
  token: process.env.VECTROS_API_KEY!,          // sk_*, ssk_*, or st_*
  environment: 'https://api.vectros.ai',        // or your staging base URL
});

Sub-clients are grouped by area: client.schemas, client.records, client.documents, client.folders, client.search, client.inference, client.identity.

2. Define a schema

A schema is the typed shape of a record. Give it a typeName, declare its fields, and set an index mode so its instances are searchable.

await client.schemas.createSchema({
  typeName: 'note',
  displayName: 'Note',
  indexMode: 'HYBRID',               // index instances for keyword + semantic search
  allowedSurfaces: ['record'],       // required, non-empty
  fields: [
    { fieldId: 'title', fieldType: 'string', required: true,  searchable: true },
    { fieldId: 'body',  fieldType: 'string', required: true,  searchable: true },
  ],
});

Creating a schema is idempotent by typeName — running this twice is safe; the second call returns the existing schema.

3. Write a record

Write an instance of your type. You can address the type by typeName alone (no schema id needed) on SDK 0.26+.

const record = await client.records.createRecord({
  typeName: 'note',
  payload: {
    title: 'Onboarding checklist',
    body: 'Reset the staging database before each demo run.',
  },
});

The record comes back with indexStatus: 'PENDING_INDEX'. Indexing is asynchronous — the record is not searchable the instant the call returns. In app code you usually just write and move on; in a demo, poll until it surfaces (search for a unique phrase) rather than sleeping a fixed interval.

4. Search your content

One search call spans records and documents, in keyword, semantic, or hybrid mode (hybrid is the default).

const results = await client.search.content({
  query: 'how do I prepare for a demo',
  mode: 'HYBRID',
  limit: 10,
});

for (const hit of results.results ?? []) {
  console.log(hit.sourceType, hit.documentId, hit.chunkText);
}

search.content is not cursor-paginated — page with limit / offset (limit ≤ 100, offset ≤ 200), or narrow with a createdAfter window for deterministic pulls.

5. Ground a model on it

The same indexed content grounds inference. A RAG call retrieves the relevant passages and streams back a citation-grounded answer.

const stream = await client.inference.ragInference({
  query: 'What should I do before a demo?',
});

for await (const event of stream) {
  if (event.event === 'content_delta') process.stdout.write(event.delta);
  if (event.event === 'search_results') console.log('grounded on', event.results?.length, 'passages');
}

The answer is grounded only in your own indexed content, and the citations point back to the source records. (Inference is served from a US region by default; entitled tenants can opt an individual request into a lower-cost global region with allowGlobalRegion — see the Search & RAG reference.)

Where to go next

You've touched four of the pillars in one thread. To go deeper, pick the path that fits how you're building: