Overview
The Velt Node SDK exposes two independent backends:
Self-hosting backend (
sdk.selfHosting.*) simplifies backend implementation by 90%. Instead of writing custom database queries and storage logic, you:
- Pass your DB and storage configs to the SDK
- Call the relevant SDK method with the raw request payload
- Return the resulting response directly to the client
sdk.api.*) provides parity with Velt’s REST APIs. 19 services, fully-typed TypeScript request objects, and raw Velt API responses. No database or AWS configuration needed.
Installation
Install the driver for the database you self-host on. The core package carries no database driver.database config whose driver is not installed fails at initialize() with the command to run, for example MongoDB support requires 'npm install mongodb' or PostgreSQL support requires 'npm install pg'.
Requirements
- Node.js 18+
- TypeScript 5.x (optional; JavaScript is fully supported)
- For self-hosting, one of:
- MongoDB 6+ (Percona Server or MongoDB Atlas) with
mongodb^6 - PostgreSQL 14+ with
pg^8.16
- MongoDB 6+ (Percona Server or MongoDB Atlas) with
@aws-sdk/client-s3^3 andjose^5 (forverifyToken) as optional peer dependencies
Quick Start
Initialize the SDK
- Self-hosting
- REST API
Self-hosting initialization (MongoDB or PostgreSQL, plus optional AWS S3):
Shutdown
Callawait sdk.close() when your process exits to release the database connection pool.
Configuration
Environment Variables
Self-Hosting Configuration
- Database
- AWS (Attachments)
- Complete Example
- Resolver Auth
Configure the database that stores comments, reactions, and user data.
type selects the backend: mongodb (default) or postgresql. Every sdk.selfHosting.* method behaves the same on both.database_name overrides the database named in connection_string on both backends. pool_min_size and pool_max_size apply to both and are validated at initialize().How PostgreSQL storage works- One table per collection (
comment_annotations,reaction_annotations,recorder_annotations,notifications,activities,attachments,users) with a single JSONBdatacolumn that holds the document, plus expression indexes on the fields the SDK queries. Thecollectionsoption renames these tables. - On first connection the SDK creates the schema, tables, and indexes (
manage_schema: true). The role needsCREATEon the schema. Concurrent application starts coordinate through a per-schema advisory lock, so they do not race; a process that waits more than 60 seconds skips setup and logs a warning. - For locked-down roles set
manage_schema: falseand apply the DDL yourself. Generate it for your exact config and hand it to a migration role:
schemais the PostgreSQL schema that holds the tables. It is unrelated to theuser_schemaoption, which maps user fields.sslmodefollows libpq names:disable,allow,prefer,require,verify-ca,verify-full. In Node,prefer(the default) connects without TLS, because node-postgres cannot fall back from TLS to plaintext.requireencrypts without verifying the certificate (it verifies the CA when you setsslrootcert), andverify-caandverify-fullverify it. An unknownsslmodefails atinitialize(). For any database that is not on the same host, setsslmode: 'verify-full'withsslrootcert: '/path/to/ca.pem'.- Each process opens its own connection pool, so a Node
cluster, PM2, or several containers open one pool per worker. - The SDK does not migrate data between MongoDB and PostgreSQL.
Self-Hosting Backend
Each self-hosting service is loaded asynchronously on first access viaawait sdk.selfHosting.getXxx(). The service is cached after the first call.
await sdk.selfHosting.database returns the connected DatabaseAdapter: the raw adapter for the configured database (MongoDBAdapter or PostgresAdapter), with find, findOne, insertOne, updateOne, updateMany, deleteOne, and deleteMany. The first access connects and creates indexes; later accesses return the same adapter. Use it for a readiness check or to write data the resolvers do not write, such as seeding users. Pass collection names as configured in collections. On PostgreSQL the adapter accepts the query operators the SDK itself uses: equality, $in, $nin, $eq, $ne, $exists, and top-level $and and $or.
Comments
Access viaawait sdk.selfHosting.getComments().
getComments
- Fetches comments for a document from your database.
- Params: GetCommentsRequest (SH)
- Returns: VeltSelfHostingResponse
saveComments
- Saves (creates or updates) comment annotations to your database.
- Params: SaveCommentsRequest (SH)
- Returns: VeltSelfHostingResponse
Resolver contract: WhensaveCommentsruns as a save-resolver handler, the inboundeventmay be aResolverActionsor aCommentResolverSaveEventmember (or a raw string), and the request may includetargetComment?: PartialComment— the comment the action occurred on (request context only, never persisted). SeeSaveCommentResolverRequest.
deleteComment
- Deletes a single comment annotation from your database.
- Params: DeleteCommentRequest (SH)
- Returns: VeltSelfHostingResponse
Reactions
Access viaawait sdk.selfHosting.getReactions().
getReactions
- Fetches reactions for a document from your database.
- Params: GetReactionsRequest (SH)
- Returns: VeltSelfHostingResponse
saveReactions
- Persists reactions to your database.
- Params: SaveReactionsRequest (SH)
- Returns: VeltSelfHostingResponse
- The reacting user is set via
from(renamed fromuserin v1.0.5, matching the frontendPartialReactionAnnotation.from).
deleteReaction
- Deletes a single reaction from your database.
- Params: DeleteReactionRequest (SH)
- Returns: VeltSelfHostingResponse
Attachments
Access viaawait sdk.selfHosting.getAttachments().
getAttachment
- Fetches an attachment record by organization and attachment ID.
- Params: positional —
organizationId(string),attachmentId(number) - Returns: VeltSelfHostingResponse
saveAttachment
- Persists attachment metadata, optionally uploading the file body to S3.
- Params: SaveAttachmentRequest (SH) plus optional positional
fileData(Buffer),fileName(string),mimeType(string) - Returns: VeltSelfHostingResponse
deleteAttachment
- Deletes an attachment record (and S3 object, if applicable).
- Params: DeleteAttachmentRequest (SH)
- Returns: VeltSelfHostingResponse
Users
Access viaawait sdk.selfHosting.getUsers().
getUsers
- Fetches users from your database.
- Params: GetUsersSelfHostingRequest (SH)
- Returns: VeltSelfHostingResponse
resolveUserIdsByEmail
- Resolves a list of email addresses to their user IDs. Backs the frontend’s anonymous-user data provider.
- Params: ResolveUserIdsByEmailRequest
- Returns: VeltSelfHostingResponse
user_schema field mappings are honoured. Repeated addresses are de-duplicated and empty entries are dropped. Like getUsers, the lookup does not filter by organization.
Response
data is a map of email to user ID. Addresses that do not match a user are absent from the map:
Recorder
Access viaawait sdk.selfHosting.getRecorder().
getRecorderAnnotations
- Fetches recorder annotations from your database.
- Params: GetRecorderAnnotationsRequest (SH)
- Returns: VeltSelfHostingResponse
saveRecorderAnnotation
- Saves a single recorder annotation.
- Params: SaveRecorderAnnotationRequest (SH)
- Returns: VeltSelfHostingResponse
deleteRecorderAnnotation
- Deletes a recorder annotation.
- Params: DeleteRecorderAnnotationRequest (SH)
- Returns: VeltSelfHostingResponse
Notifications
Access viaawait sdk.selfHosting.getNotifications().
getNotifications
- Fetches notifications for a user from your database.
- Params: GetNotificationsSelfHostingRequest (SH)
- Returns: VeltSelfHostingResponse
saveNotifications
- Persists one or more notifications to your database.
- Params: SaveNotificationsRequest (SH)
- Returns: VeltSelfHostingResponse
deleteNotification
- Deletes a notification from your database.
- Params: DeleteNotificationRequest (SH)
- Returns: VeltSelfHostingResponse
Activities
Access viaawait sdk.selfHosting.getActivities().
getActivities
- Fetches activity logs from your database.
- Params: GetActivitiesSelfHostingRequest (SH)
- Returns: VeltSelfHostingResponse
saveActivities
- Persists activity log entries to your database.
- Params: SaveActivitiesRequest (SH)
- Returns: VeltSelfHostingResponse
verifyToken
sdk.selfHosting.verifyToken verifies the auth credential the Velt frontend forwards to endpoint-based resolvers. It is database-free (it does not open or query MongoDB), fail-closed (every error path returns { verified: false }, never throws), and authentication only (claims are returned verbatim; it makes no authorization decision).
Optional dependency:npm install jose@^5(optionalpeerDependency, pinned^5for Node 18 — jose v6 needs the WebCrypto global absent on Node 18). Ifjoseis missing and the built-in JWT path is used,verifyTokenreturns{ verified: false, errorCode: 'DEPENDENCY_MISSING' }. The customverifycallback path needs no dependency.
Configuration
ConfigureresolverAuth on VeltSDK.initialize. Provide the built-in jwt path, a custom verify callback, or both. When both are set, the custom callback takes priority.
- JWT / JWKS
- Custom verify callback
Usage
CallverifyToken from your endpoint-based resolver route, then branch on result.verified.
options override the configured resolverAuth (the jwt block is deep-merged):
- Params: inline options object with
headers,token, and per-callResolverAuthConfigoverrides. This parameter shape is not exported as a named SDK type. - Returns:
VerifyTokenResult
ResolverAuthService class (also exported from @veltdev/node) for advanced callers who need to construct it directly; sdk.selfHosting.verifyToken is the standard entry point.
Error codes
On failure,result.errorCode is one of the ResolverAuthErrorCode values (also exported as the readonly string[] const RESOLVER_AUTH_ERROR_CODES).
Security guarantees
alg=noneis always rejected, even if present in the allowlist.- Mixed symmetric+asymmetric allowlists are refused (prevents HS/RS confusion).
- A PEM placed in
jwt.secretis refused. - JWKS is fetched only over HTTPS —
httpis rejected pre-fetch, and a redirect downgrade is rejected. - JWKS responses are cached per URL with a 5-minute TTL (not per
kid). - The token-header
algis checked against the allowlist before any JWKS fetch. - The
errorfield is generic and code-based — it never contains the token or secret.
REST API Backend
Thesdk.api.* namespace gives you parity with Velt’s REST APIs across 19 services, including token generation with sdk.api.accessControl.generateToken. Each method takes a fully-typed TypeScript request object and returns the raw Velt API response. You only need apiKey and authToken; initialize without a database block.
Every sdk.api.* method requires an organizationId in its request payload. Velt enforces data isolation per-organization server-side.
Field Allowlist
The REST add/update methods onactivities, commentAnnotations, and notifications accept an optional second argument, FieldFilterOptions. Pass { filterUnknownFields: true } to narrow the request to exactly the fields the corresponding Velt backend endpoint accepts. See the note at the top of each service section for the behavior summary; the per-endpoint field lists are below.
Exported filter utilities
The field-allowlist module is exported from@veltdev/node so advanced callers can reuse the same logic.
pickKnownFields(data, keys)— keeps only own-enumerable keys present inkeys; values kept by reference (no recursion); non-object/array/null inputs returned unchanged.filterRequest(request, spec)— applies aFilterSpecrecursively; never mutates input; fail-open (returns the original request on any error).- Eight per-method specs are exported:
ADD_ACTIVITIES_SPEC,UPDATE_ACTIVITIES_SPEC,ADD_COMMENT_ANNOTATIONS_SPEC,UPDATE_COMMENT_ANNOTATIONS_SPEC,ADD_COMMENTS_SPEC,UPDATE_COMMENTS_SPEC,ADD_NOTIFICATIONS_SPEC,UPDATE_NOTIFICATIONS_SPEC.
Allowlisted fields per endpoint
WhenfilterUnknownFields: true, only these keys survive (unknown keys dropped):
The comment-annotation specs above reference two comment-data key sets:
- Annotation-level
commentData/comments(ANNOTATION_COMMENT_DATA_KEYS):commentText,commentHtml,commentId,from,lastUpdated,createdAt,taggedUserContacts,isCommentResolverUsed,isCommentTextAvailable,triggerNotification,triggerActivities,agent— carries the trigger flags but notcontext/attachments. - Comments-endpoint
commentData/comments(COMMENT_DATA_KEYS):commentText,commentHtml,commentId,from,lastUpdated,createdAt,taggedUserContacts,isCommentResolverUsed,isCommentTextAvailable,context,attachments,agent— carriescontext/attachmentsbut not the trigger flags.
UPDATE_NOTIFICATIONS_SPEC intentionally excludes isRead/isArchived — they are absent from the backend UpdateNotificationsSchemaV2 and unsupported by /v2/notifications/update, so they are dropped when filtering is on.Organizations
Namespace:sdk.api.organizations
addOrganizations
- Creates one or more organizations.
- Params: AddOrganizationsRequest
- Returns: VeltApiResponse
getOrganizations
- Retrieves organizations. Optionally filter by IDs with pagination.
- Params: GetOrganizationsRequest
- Returns: GetOrganizationsResponse
updateOrganizations
- Updates organization properties.
- Params: UpdateOrganizationsRequest
- Returns: VeltApiResponse
deleteOrganizations
- Deletes one or more organizations.
- Params: DeleteOrganizationsRequest
- Returns: VeltApiResponse
updateOrganizationDisableState
- Enables or disables one or more organizations.
- Params: UpdateOrganizationDisableStateRequest
- Returns: VeltApiResponse
Folders
Namespace:sdk.api.folders
addFolder
- Creates one or more folders inside an organization.
- Params: AddFolderRequest
- Returns: VeltApiResponse
getFolders
- Retrieves folders. Optionally filter by folder ID with depth control.
- Params: GetFoldersRequest
- Returns: GetFoldersResponse
updateFolder
- Updates folder properties.
- Params: UpdateFolderRequest
- Returns: VeltApiResponse
deleteFolder
- Deletes a folder.
- Params: DeleteFolderRequest
- Returns: VeltApiResponse
updateFolderAccess
- Updates access type for one or more folders.
- Params: UpdateFolderAccessRequest
- Returns: VeltApiResponse
Documents
Namespace:sdk.api.documents
addDocuments
- Creates one or more documents.
- Params: AddDocumentsRequest
- Returns: VeltApiResponse
getDocuments
- Retrieves documents with optional filters and pagination.
- Params: GetDocumentsRequest
- Returns: GetDocumentsResponse
updateDocuments
- Updates document properties.
- Params: UpdateDocumentsRequest
- Returns: VeltApiResponse
deleteDocuments
- Deletes one or more documents.
- Params: DeleteDocumentsRequest
- Returns: VeltApiResponse
moveDocuments
- Moves documents into a folder.
- Params: MoveDocumentsRequest
- Returns: VeltApiResponse
updateDocumentAccess
- Updates access type for one or more documents.
- Params: UpdateDocumentAccessRequest
- Returns: VeltApiResponse
updateDocumentDisableState
- Enables or disables one or more documents.
- Params: UpdateDocumentDisableStateRequest
- Returns: VeltApiResponse
migrateDocuments
- Starts a document migration job.
- Params: MigrateDocumentsRequest
- Returns: MigrateDocumentsResponse
Note:migrateDocumentsis asynchronous and returns amigrationId. Poll completion withmigrateDocumentsStatus.
migrateDocumentsStatus
- Polls the status of a migration job.
- Params: MigrateDocumentsStatusRequest
- Returns: MigrateDocumentsStatusResponse
getDocumentsCount
- Return a document count for an organization (optionally scoped to a folder, or narrowed by metadata filters).
- Params: GetDocumentsCountRequest
- Returns: VeltApiResponse
filters cannot be combined with excludeFolderDocs — the API rejects the combination.
Response
filters is supplied, the response data also carries filtersApplied. A false value means the filtered aggregate could not be computed and count is an unfiltered fallback, so check it if you need the count to be exact:
Users
Namespace:sdk.api.users
addUsers
- Adds one or more users to an organization, document, or folder.
- Params: AddUsersRequest
- Returns: VeltApiResponse
getUsers
- Retrieves users with optional filters and pagination.
- Params: GetUsersRequest
- Returns: GetUsersResponse
updateUsers
- Updates user properties.
- Params: UpdateUsersRequest
- Returns: VeltApiResponse
deleteUsers
- Removes users from an organization.
- Params: DeleteUsersRequest
- Returns: VeltApiResponse
getUsersCount
- Count users in an org (optionally scoped to a document or all documents).
- Params: GetUsersCountRequest
- Returns: VeltApiResponse
getDocUsers
- Get document-level users (optionally including involved documents).
- Params: GetDocUsersRequest
- Returns: VeltApiResponse
addUserInvite
- Create an org/doc/folder user invite.
- Params: AddUserInviteRequest
- Returns: VeltApiResponse
respondToUserInvite
- Accept/reject/withdraw an invite.
- Params: RespondToUserInviteRequest
- Returns: VeltApiResponse
getUserInvites
- List invites for an org (paged).
- Params: GetUserInvitesRequest
- Returns: VeltApiResponse
getUserInvitations
- List invitations for a specific email (paged, filterable).
- Params: GetUserInvitationsRequest
- Returns: VeltApiResponse
getInvitedPendingUsersCount
- Count pending invited users by invite type.
- Params: GetInvitedPendingUsersCountRequest
- Returns: VeltApiResponse
User Groups
Namespace:sdk.api.userGroups
addUserGroups
- Creates one or more user groups.
- Params: AddUserGroupsRequest
- Returns: VeltApiResponse
addUsersToGroup
- Adds users to an existing group.
- Params: AddUsersToGroupRequest
- Returns: VeltApiResponse
deleteUsersFromGroup
- Removes users from a group, or removes all users.
- Params: DeleteUsersFromGroupRequest
- Returns: VeltApiResponse
Notifications
Namespace:sdk.api.notifications
Filtering unknown fields: The add/update methods below accept an optional
options?: FieldFilterOptions second argument. When { filterUnknownFields: true } is passed, unknown/custom keys are dropped before the request is sent, narrowing the payload to exactly the fields the Velt backend endpoint accepts. Open-typed objects (actionUser, context, metadata, user objects) pass through whole. Filtering is fail-open: if it errors, the original payload is sent, so a write is never blocked. UPDATE_NOTIFICATIONS_SPEC intentionally excludes isRead/isArchived — they are unsupported by /v2/notifications/update, so they are dropped when filtering is on. See Field Allowlist for the full per-endpoint field list.addNotifications
- Adds one or more notifications targeted to specific users.
- Params: AddNotificationsRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
getNotifications
- Gets notifications for a user with optional filters and pagination.
- Params: GetNotificationsRequest
- Returns: GetNotificationsResponse
- Velt filters results by comment visibility: a notification for a private comment is returned only to users who can see that comment.
updateNotifications
- Updates existing notifications (e.g., mark as read).
- Params: UpdateNotificationsRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
deleteNotifications
- Deletes one or more notifications.
- Params: DeleteNotificationsRequest
- Returns: VeltApiResponse
getNotificationConfig
- Gets notification preferences for a user.
- Params: GetNotificationConfigRequest
- Returns: GetNotificationConfigResponse
setNotificationConfig
- Sets notification preferences for one or more users.
- Params: SetNotificationConfigRequest
- Returns: VeltApiResponse
Comment Annotations
Namespace:sdk.api.commentAnnotations
Filtering unknown fields: The add/update methods below accept an optional
options?: FieldFilterOptions second argument. When { filterUnknownFields: true } is passed, request entity collections are narrowed to only the fields the Velt backend endpoint accepts, dropping unknown/custom keys before the request is sent. Open-typed objects (from, context, metadata, user objects) pass through whole — their nested contents are never filtered. Filtering is fail-open: if it errors, the original payload is sent, so a write is never blocked. See Field Allowlist for the full per-endpoint field list.addCommentAnnotations
- Creates comment annotations on a document.
- Params: AddCommentAnnotationsRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
getCommentAnnotations
- Retrieves comment annotations for a document with optional filters and pagination.
- Params: GetCommentAnnotationsRequest
- Returns: GetCommentAnnotationsResponse
agentId, executionId, agentType, agentSource, agentSuggestions, or agentComments. Supply at most one per request.
Agent filtering is annotation-scoped and requires advanced queries to be enabled on your workspace. When they are not enabled, the API fails closed rather than returning unfiltered results.
getCommentAnnotationsCount
- Gets total and unread annotation counts per document.
- Params: GetCommentAnnotationsCountRequest
- Returns: GetCommentAnnotationsCountResponse
updateCommentAnnotations
- Updates fields on existing annotations (e.g., resolve them).
- Params: UpdateCommentAnnotationsRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
deleteCommentAnnotations
- Deletes comment annotations.
- Params: DeleteCommentAnnotationsRequest
- Returns: VeltApiResponse
agentSuggestions, agentId, and agentUrls narrow a delete to agent-authored annotations. They combine, so you can scope a sweep precisely — for example, “this agent’s still-pending suggestions on these pages”, which leaves a concurrent crawl’s freshly-created annotations untouched.
agentUrls matches annotations scoped to any of the supplied pages.
Response
addComments
- Adds comments to an existing annotation.
- Params: AddCommentsRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
getComments
- Retrieves comments within a specific annotation.
- Params: GetCommentsRequest
- Returns: GetCommentsResponse
updateComments
- Updates comments within a specific annotation.
- Params: UpdateCommentsRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
deleteComments
- Deletes individual comments from an annotation.
- Params: DeleteCommentsRequest
- Returns: VeltApiResponse
Activities
Namespace:sdk.api.activities
Filtering unknown fields: The add/update methods below accept an optional
options?: FieldFilterOptions second argument. When { filterUnknownFields: true } is passed, request entity collections are narrowed to only the fields the Velt backend endpoint accepts, dropping unknown/custom keys before the request is sent. Open-typed objects (actionUser, entityData, context, metadata) pass through whole — their nested contents are never filtered. Filtering is fail-open: if it errors, the original payload is sent, so a write is never blocked. See Field Allowlist for the full per-endpoint field list.addActivities
- Logs activity events.
- Params: AddActivitiesRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
getActivities
- Retrieves activity events with optional filters and pagination.
- Params: GetActivitiesRequest
- Returns: GetActivitiesResponse
updateActivities
- Updates existing activity events.
- Params: UpdateActivitiesRequest
- Returns: VeltApiResponse
- Accepts an optional
options?: FieldFilterOptionssecond argument — pass{ filterUnknownFields: true }to drop unknown fields before sending (see the note above).
deleteActivities
- Deletes activity events for a document.
- Params: DeleteActivitiesRequest
- Returns: VeltApiResponse
Access Control
Namespace:sdk.api.accessControl
addPermissions
- Grants a user access to one or more resources.
- Params: AddPermissionsRequest
- Returns: VeltApiResponse
getPermissions
- Retrieves permissions for users on resources.
- Params: GetPermissionsRequest
- Returns: GetPermissionsResponse
skipResourceExistenceValidation: true to skip that check and return whatever permissions exist:
removePermissions
- Revokes a user’s access to one or more resources.
- Params: RemovePermissionsRequest
- Returns: VeltApiResponse
generateSignature
- Generates a signed payload for the Permission Provider flow.
- Params: GenerateSignatureRequest
- Returns: GenerateSignatureResponse
generateToken
- Generates a JWT auth token for a user with embedded permissions.
- Calls
POST /v2/auth/generate_token, the endpoint documented in the Generate Token REST API and used by the JWT guide. - Expects
GenerateTokenRequest { userId: string; userProperties: { name?, email?, photoUrl?, color?, textColor?, ... }; permissions: { resources?: Resource[] } }, passed as a request object like every othersdk.api.*method. - Returns the raw Velt API envelope
VeltApiResponse:{ result: { status, message, data: { token } } }. - Params: GenerateTokenRequest
- Returns: GenerateTokenResponse
CRDT
Namespace:sdk.api.crdt
Supports text, map, array, and xml CRDT data types.
addCrdtData
- Stores CRDT (Yjs) editor data for a document.
- Params: AddCrdtDataRequest
- Returns: VeltApiResponse
getCrdtData
- Retrieves CRDT data for a document, optionally filtered by editor.
- Params: GetCrdtDataRequest
- Returns: GetCrdtDataResponse
updateCrdtData
- Updates existing CRDT editor data.
- Params: UpdateCrdtDataRequest
- Returns: VeltApiResponse
deleteCrdtData
- Delete CRDT editor data for a document. Omit
editorIdsto delete CRDT data for all editors of the document. - Params: DeleteCrdtDataRequest
- Returns: VeltApiResponse
Presence
Namespace:sdk.api.presence
addPresence
- Adds users to presence on a document.
- Params: AddPresenceRequest
- Returns: VeltApiResponse
updatePresence
- Updates presence status for one or more users.
- Params: UpdatePresenceRequest
- Returns: VeltApiResponse
deletePresence
- Removes users from presence on a document.
- Params: DeletePresenceRequest
- Returns: VeltApiResponse
Livestate
Namespace:sdk.api.livestate
broadcastEvent
- Broadcasts an ephemeral live-state event to all clients on a document.
- Params: BroadcastEventRequest
- Returns: VeltApiResponse
Recordings
Namespace:sdk.api.recordings
getRecordings
- Retrieves recording metadata for an organization or document with optional filtering and pagination.
- Params: GetRecordingsRequest
- Returns: GetRecordingsResponse
Rewriter
Namespace:sdk.api.rewriter
Supports OpenAI, Anthropic, and Gemini models.
askAi
- Calls the Velt AI rewriter with a model, prompt, and text.
- Params: AskAiRequest
- Returns: AskAiResponse
Note: askAi may take several seconds to respond. The SDK does not enforce a client-side timeout.
GDPR
Namespace:sdk.api.gdpr
deleteAllUserData
- Requests deletion of all data associated with one or more users.
- Params: DeleteAllUserDataRequest
- Returns: VeltApiResponse
Note:deleteAllUserDatais asynchronous and returns a job ID. Poll completion withgetDeleteUserDataStatus.
getAllUserData
- Exports all data for a single user (paginated).
- Params: GetAllUserDataRequest
- Returns: GetAllUserDataResponse
veltUserIds to export data for a set of Velt-side user IDs instead of the single userId, veltAllOrganizations to span every organization rather than just organizationId, and uniqueId as a correlation value echoed back on the response:
getDeleteUserDataStatus
- Polls the status of a deletion job.
- Params: GetDeleteUserDataStatusRequest
- Returns: GetDeleteUserDataStatusResponse
Workspace
Namespace:sdk.api.workspace
createWorkspace
- Creates a new Velt workspace.
- Params: CreateWorkspaceRequest
- Returns: VeltApiResponse
getWorkspace
- Retrieves details for the current workspace.
- Params: empty object
{} - Returns: GetWorkspaceResponse
createApiKey
- Creates a new API key for the workspace.
- Params: CreateApiKeyRequest
- Returns: VeltApiResponse
updateApiKey
- Renames an existing API key.
- Params: UpdateApiKeyRequest
- Returns: VeltApiResponse
getApiKeys
- Lists all API keys with optional pagination.
- Params: GetApiKeysRequest
- Returns: GetApiKeysResponse
getApiKeyMetadata
- Gets metadata for the current API key.
- Now posts to
/v2/workspace/apikeyconfig/get(previously/v2/workspace/apikeymetadata/get); the method name and signature (GetApiKeyMetadataRequest, which is{}) are unchanged — no caller changes required. - Params: empty object
{} - Returns: GetApiKeyMetadataResponse
resetAuthToken
- Rotates the auth token for an API key.
- Params: ResetAuthTokenRequest
- Returns: VeltApiResponse
getAuthTokens
- Lists auth tokens for an API key.
- Params: GetAuthTokensRequest
- Returns: GetAuthTokensResponse
addDomains
- Adds allowed domains to the workspace allow-list.
- Params: AddDomainsRequest
- Returns: VeltApiResponse
deleteDomains
- Removes allowed domains.
- Params: DeleteDomainsRequest
- Returns: VeltApiResponse
getDomains
- Lists allowed domains.
- Params: empty object
{} - Returns: GetDomainsResponse
getEmailStatus
- Checks email verification status for an owner.
- Params: GetEmailStatusRequest
- Returns: GetEmailStatusResponse
sendLoginLink
- Sends a passwordless login link to a user.
- Params: SendLoginLinkRequest
- Returns: VeltApiResponse
getEmailConfig
- Retrieves email service configuration.
- Params: empty object
{} - Returns: GetEmailConfigResponse
updateEmailConfig
- Updates email service configuration.
- Params: UpdateEmailConfigRequest
- Returns: VeltApiResponse
getWebhookConfig
- Retrieves webhook configuration.
- Params: empty object
{} - Returns: GetWebhookConfigResponse
updateWebhookConfig
- Updates webhook configuration.
- Params: UpdateWebhookConfigRequest
- Returns: VeltApiResponse
getRequestedDomains
- List requested additional domains.
- Params: GetRequestedDomainsRequest
- Returns: VeltApiResponse
acceptRejectAdditionalUrlRequest
- Accept/reject an additional-URL request.
- Params: AcceptRejectAdditionalUrlRequest
- Returns: VeltApiResponse
createDomainRequest
- Create a domain request.
- Params: CreateDomainRequest
- Returns: VeltApiResponse
copyApiKey
- Copy configuration from one API key to another.
- Params: CopyApiKeyRequest
- Returns: VeltApiResponse
updateApiKeyConfig
- Update API key config (private comments, JWT, AI model keys, etc.).
- Params: UpdateApiKeyConfigRequest
- Returns: VeltApiResponse
getNotificationConfig
- Get workspace notification service config.
- Params: GetWorkspaceNotificationConfigRequest
- Returns: VeltApiResponse
updateNotificationConfig
- Update notification service config.
- Params: UpdateWorkspaceNotificationConfigRequest
- Returns: VeltApiResponse
getPermissionProviderConfig
- Get permission-provider config.
- Params: GetPermissionProviderConfigRequest
- Returns: VeltApiResponse
updatePermissionProviderConfig
- Update permission-provider config.
- Params: UpdatePermissionProviderConfigRequest
- Returns: VeltApiResponse
getActivityConfig
- Get activity service config.
- Params: GetActivityConfigRequest
- Returns: VeltApiResponse
updateActivityConfig
- Update activity service config.
- Params: UpdateActivityConfigRequest
- Returns: VeltApiResponse
ensureWorkspaceAuthToken
- Ensure a workspace auth token exists.
- Params: EnsureWorkspaceAuthTokenRequest
- Returns: VeltApiResponse
getAdvancedWebhookConfig
- Get advanced webhook config.
- Params: GetAdvancedWebhookConfigRequest
- Returns: VeltApiResponse
updateAdvancedWebhookConfig
- Update advanced webhook config.
- Params: UpdateAdvancedWebhookConfigRequest
- Returns: VeltApiResponse
getAdvancedWebhookEndpoints
- List advanced webhook endpoints (paged).
- Params: GetAdvancedWebhookEndpointsRequest
- Returns: VeltApiResponse
createAdvancedWebhookEndpoint
- Create an advanced webhook endpoint.
- Params: CreateAdvancedWebhookEndpointRequest
- Returns: VeltApiResponse
updateAdvancedWebhookEndpoint
- Update an advanced webhook endpoint.
- Params: UpdateAdvancedWebhookEndpointRequest
- Returns: VeltApiResponse
deleteAdvancedWebhookEndpoint
- Delete an advanced webhook endpoint.
- Params: DeleteAdvancedWebhookEndpointRequest
- Returns: VeltApiResponse
getAdvancedWebhookEndpointSecret
- Get an endpoint’s signing secret.
- Params: GetAdvancedWebhookEndpointSecretRequest
- Returns: VeltApiResponse
Custom agent config supports the
rest-api context-gathering strategy and the mcp-tools execution strategy. Secret-bearing REST API and MCP auth fields are encrypted at rest and redacted on read paths. Create and update-version payloads reject server-managed fields such as managedBy, metadata.type, metadata.category, metadata.internal, and metadata.apiKey; strategies that require instructions (ai, service+ai, stagehand-agent) reject empty instructions.Approval Workflows
Namespace:sdk.api.approval
A new service for defining approval/review workflows (graphs of agent, human, webhook, and notification nodes) and dispatching/resolving their executions and steps. 14 methods (routes live under /v2/workflow/*). Every type is Approval-prefixed. ApprovalService is also exported directly from @veltdev/node.
Routing and loops
Routing is expressed entirely as edges. Each edge carries a semanticon role — 'approve', 'reject', 'custom' (with a when predicate), or 'exhausted' — and endpoints may be a bare node ID or an object targeting a node or a parallel group.
Loops are edges too: an on: 'reject' back-edge carrying a loop object sends work back for rework with an iteration cap.
Notification nodes
Anotification node sends a formatted email or Slack message built from upstream step output.
recipients is required when channel is 'email'; slackTarget is required when it is 'slack'. format accepts 'text', 'html', or 'slack-blocks' — the last is valid only for Slack.
Triggers
A trigger starts an execution. Each trigger drives at most one mechanism —inboundWebhook, schedule, and appTrigger are mutually exclusive, and the API rejects a trigger that combines them.
appTrigger carries no secret — the connected app is authenticated at the app-level webhook. payloadFilters resolve dot-paths against the provider’s raw webhook body, so you can gate on a specific workflow name plus its conclusion.
createDefinition
- Create a workflow definition (nodes, edges, groups, triggers).
- Params: ApprovalCreateDefinitionRequest
- Returns: VeltApiResponse
updateDefinition
- Update a definition (create shape + optimistic
ifVersion). - Params: ApprovalUpdateDefinitionRequest
- Returns: VeltApiResponse
deleteDefinition
- Delete a definition.
- Params: ApprovalDeleteDefinitionRequest
- Returns: VeltApiResponse
purge: true removes the definition and its version snapshots outright. Both paths free the definition ID for re-creation, and the response echoes purged so you can tell which ran.
getDefinition
- Get a single definition.
- Params: ApprovalGetDefinitionRequest
- Returns: VeltApiResponse
listDefinitions
- List definitions (paged).
- Params: ApprovalListDefinitionsRequest
- Returns: VeltApiResponse
dispatchExecution
- Dispatch (start) an execution of a definition.
- Params: ApprovalDispatchExecutionRequest
- Returns: VeltApiResponse
cancelExecution
- Cancel a running execution.
- Params: ApprovalCancelExecutionRequest
- Returns: VeltApiResponse
getExecution
- Get a single execution.
- Params: ApprovalGetExecutionRequest
- Returns: VeltApiResponse
getExecutionEvents
- Get a page of an execution’s lifecycle events.
- Params: ApprovalGetExecutionEventsRequest
- Returns: VeltApiResponse
listExecutions
- List executions.
- Params: ApprovalListExecutionsRequest
- Returns: VeltApiResponse
cancelStep
- Admin step-level cancel.
- Params: ApprovalCancelStepRequest
- Returns: VeltApiResponse
resolveStep
- Admin force-resolve a hung step.
- Params: ApprovalResolveStepRequest
- Returns: VeltApiResponse
recordAgentResolution
- Record one resolution against a blocking-agent step’s aggregator.
- Params: ApprovalRecordAgentResolutionRequest
- Returns: VeltApiResponse
recordReviewerDecision
- Record one reviewer’s decision against a human step’s aggregator.
- Params: ApprovalRecordReviewerDecisionRequest
- Returns: VeltApiResponse
Node & Graph Types
These node/graph/config interfaces are referenced by the request types above. They are not standalone data-model entries.Error Handling
The SDK exports five typed error classes:errorCode field:
INVALID_INPUT— Request data is malformed or missing required fieldsINTERNAL_ERROR— Server-side error during processingNOT_FOUND— Requested resource was not found
Data Models
Key interfaces and serializer helpers exported from@veltdev/node. All symbols are available at the package top level:
PartialUser and PartialAttachment referenced in the interfaces below are minimal pass-through shapes. PartialUser is { userId: string } (any additional fields the frontend sends are preserved but not strongly typed). Full user/attachment shapes are documented in the central Data Models reference.PartialCommentAnnotation
Represents a single comment annotation thread. Used as the payload shape when reading or writing annotation data in self-hosting event handlers.
Serializers:
PartialTargetTextRange
The text selection an annotation is anchored to. New interface in v1.0.2.
Serializers:
resolvedByUserId Semantics
resolvedByUserId on PartialCommentAnnotation is a three-state field. TypeScript has no sentinel value, so the three states map to property presence and value:
Use
Object.hasOwn (or 'resolvedByUserId' in annotation) to distinguish absent from explicit null:
PartialComment
A single comment within an annotation thread. Round-trip serializers preserve unknown keys, so custom fields added by your application are not dropped.
Serializers (new in v1.0.2):
BaseMetadata
Contextual identifiers attached to annotations and events. Provides both Velt-internal IDs and your application’s client-facing IDs for the same resources.
Serializers (exposed on public surface in v1.0.2):
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.

