Skip to main content

Overview

The Velt Node SDK exposes two independent backends:
BackendNamespaceUse case
Self-hostingsdk.selfHosting.*Store Velt data in your own MongoDB + AWS S3
REST APIsdk.api.*Call Velt’s REST APIs directly — no database required
Self-hosting backend (sdk.selfHosting.*) simplifies backend implementation by 90%. Instead of writing custom database queries and storage logic, you:
  1. Pass your DB and storage configs to the SDK
  2. Call the relevant SDK method with the raw request payload
  3. Return the resulting response directly to the client
REST API backend (sdk.api.*) provides feature parity with the Velt Python SDK. 17 services, fully-typed TypeScript request objects, and raw Velt API responses. No database or AWS configuration needed.

Installation

For self-hosting, also install the optional peer dependencies you plan to use:

Requirements

  • Node.js 18+
  • TypeScript 5.x (optional — JavaScript is fully supported)
  • MongoDB 6+ (Percona Server or MongoDB Atlas) for self-hosting
  • mongodb ^6 and @aws-sdk/client-s3 ^3 as optional peer dependencies

Quick Start

Initialize the SDK

Self-hosting initialization (MongoDB + optional AWS):
REST API-only initialization (no database needed):
The database section is optional when using only sdk.api.*. Set VELT_API_KEY and VELT_AUTH_TOKEN environment variables as an alternative to passing credentials in the config object.

Shutdown

Call await sdk.close() when your process exits to release the database connection pool.

Configuration

Environment Variables

VariableConfig key equivalentPurpose
VELT_API_KEYapiKeyVelt API key for authenticating REST API calls
VELT_AUTH_TOKENauthTokenVelt auth token for authenticating REST API calls
VELT_WORKSPACE_IDDefault workspace ID for workspace-scoped operations
VELT_WORKSPACE_AUTH_TOKENAuth token scoped to a specific workspace
AWS_ACCESS_KEY_IDAWS access key for S3 attachments
AWS_SECRET_ACCESS_KEYAWS secret key for S3 attachments
AWS_REGIONAWS region for S3
AWS_S3_BUCKET_NAMES3 bucket name for attachments
AWS_S3_ENDPOINT_URLCustom S3 endpoint (e.g., for MinIO)

Self-Hosting Configuration

Configure MongoDB connection for storing comments, reactions, and user data.

Self-Hosting Backend

Each self-hosting service is loaded asynchronously on first access via await sdk.selfHosting.getXxx(). The service is cached after the first call. The token service is the exception — it is available as a direct synchronous property via sdk.selfHosting.token.

Comments

Access via await sdk.selfHosting.getComments().

getComments

Response

saveComments

Response

deleteComment

Response

Reactions

Access via await sdk.selfHosting.getReactions().

getReactions

Response

saveReactions

Response

deleteReaction

Response

Attachments

Access via await sdk.selfHosting.getAttachments().

getAttachment

  • Fetches an attachment record by organization and attachment ID.
  • Params: positional — organizationId (string), attachmentId (number)
  • Returns: VeltSelfHostingResponse
Response

saveAttachment

Response

deleteAttachment

Response

Users

Access via await sdk.selfHosting.getUsers().

getUsers

Response

Recorder

Access via await sdk.selfHosting.getRecorder().

getRecorderAnnotations

Response

saveRecorderAnnotation

Response

deleteRecorderAnnotation

Response

Notifications

Access via await sdk.selfHosting.getNotifications().

getNotifications

Response

saveNotifications

Response

deleteNotification

Response

Activities

Access via await sdk.selfHosting.getActivities().

getActivities

Response

saveActivities

Response

Token

Access via the synchronous sdk.selfHosting.token property (no await).

getToken

  • Generates a Velt auth token for a user.
  • Params: positional — organizationId (string), userId (string), email (string, optional), isAdmin (boolean, optional)
  • Returns: VeltSelfHostingResponse
Note: getToken takes positional arguments — not a request object.
Response

REST API Backend

The sdk.api.* namespace provides 17 services covering all Velt REST API operations. No database or AWS configuration is required — only apiKey and authToken. Every sdk.api.* method requires an organizationId in its request payload. Velt enforces data isolation per-organization server-side.

Organizations

Namespace: sdk.api.organizations

addOrganizations

Response

getOrganizations

Response

updateOrganizations

Response

deleteOrganizations

Response

updateOrganizationDisableState

Response

Folders

Namespace: sdk.api.folders

addFolder

Response

getFolders

Response

updateFolder

Response

deleteFolder

Response

updateFolderAccess

Response

Documents

Namespace: sdk.api.documents

addDocuments

Response

getDocuments

Response

updateDocuments

Response

deleteDocuments

Response

moveDocuments

Response

updateDocumentAccess

Response

updateDocumentDisableState

Response

migrateDocuments

Note: migrateDocuments is asynchronous and returns a migrationId. Poll completion with migrateDocumentsStatus.
Response

migrateDocumentsStatus

Response

Users

Namespace: sdk.api.users

addUsers

Response

getUsers

Response

updateUsers

Response

deleteUsers

Response

User Groups

Namespace: sdk.api.userGroups

addUserGroups

Response

addUsersToGroup

Response

deleteUsersFromGroup

Response

Notifications

Namespace: sdk.api.notifications

addNotifications

Response

getNotifications

Response

updateNotifications

Response

deleteNotifications

Response

getNotificationConfig

Response

setNotificationConfig

Response

Comment Annotations

Namespace: sdk.api.commentAnnotations

addCommentAnnotations

Response

getCommentAnnotations

Response

getCommentAnnotationsCount

Response

updateCommentAnnotations

Response

deleteCommentAnnotations

Response

addComments

Response

getComments

Response

updateComments

Response

deleteComments

Response

Activities

Namespace: sdk.api.activities

addActivities

Response

getActivities

Response

updateActivities

Response

deleteActivities

Response

Access Control

Namespace: sdk.api.accessControl

addPermissions

Response

getPermissions

Response

removePermissions

Response

generateSignature

Response

generateToken

Response

CRDT

Namespace: sdk.api.crdt Supports text, map, array, and xml CRDT data types.

addCrdtData

Response

getCrdtData

Response

updateCrdtData

Response

Presence

Namespace: sdk.api.presence

addPresence

Response

updatePresence

Response

deletePresence

Response

Livestate

Namespace: sdk.api.livestate

broadcastEvent

Response

Recordings

Namespace: sdk.api.recordings

getRecordings

Response

Rewriter

Namespace: sdk.api.rewriter Supports OpenAI, Anthropic, and Gemini models.

askAi

Note: askAi may take several seconds to respond. The SDK does not enforce a client-side timeout.
Response

GDPR

Namespace: sdk.api.gdpr

deleteAllUserData

Note: deleteAllUserData is asynchronous and returns a job ID. Poll completion with getDeleteUserDataStatus.
Response

getAllUserData

Response

getDeleteUserDataStatus

Response

Workspace

Namespace: sdk.api.workspace

createWorkspace

Response

getWorkspace

  • Retrieves details for the current workspace.
  • Params: empty object {}
  • Returns: GetWorkspaceResponse
Response

createApiKey

Response

updateApiKey

Response

getApiKeys

Response

getApiKeyMetadata

Response

resetAuthToken

Response

getAuthTokens

Response

addDomains

Response

deleteDomains

Response

getDomains

Response

getEmailStatus

Response
Response

getEmailConfig

Response

updateEmailConfig

Response

getWebhookConfig

Response

updateWebhookConfig

Response

Token

Namespace: sdk.api.token

getToken

  • Generates a Velt auth token for a user via REST.
  • Params: positional — organizationId (string), userId (string), email (string, optional), isAdmin (boolean, optional)
  • Returns: VeltApiResponse
Note: getToken takes positional arguments — not a request object.
Response

Error Handling

The SDK exports five typed error classes:
ClassExtendsWhen thrown
VeltSDKErrorErrorBase class for all SDK errors
VeltDatabaseErrorVeltSDKErrorMongoDB connection or query failures
VeltValidationErrorVeltSDKErrorMissing or invalid request parameters
VeltTokenErrorVeltSDKErrorToken generation failures
VeltApiErrorVeltSDKErrorREST API call failures
Common self-hosting error codes returned in the response errorCode field:
  • INVALID_INPUT — Request data is malformed or missing required fields
  • INTERNAL_ERROR — Server-side error during processing
  • NOT_FOUND — Requested resource was not found

Distribution

The package ships both CommonJS (CJS) and ES Module (ESM) bundles with rolled-up .d.ts type definitions, making it compatible with all modern Node.js project setups.