Overview
The Velt Python SDK exposes two independent backends:| Backend | Namespace | Use case |
|---|---|---|
| Self-hosting | sdk.selfHosting.* | Store Velt data in your own MongoDB + AWS S3 |
| REST API | sdk.api.* | Call Velt’s REST APIs directly — no database required |
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
- Pass the raw request object directly to SDK methods
- Return the resulting response object straight to the client
sdk.api.*) provides parity with Velt’s REST APIs. 18 services, typed @dataclass request objects, and raw Velt API responses. No database or AWS configuration needed.
Installation
Requirements
- Python 3.8+
- Django 4.2.26+ (only if using the self-hosting backend)
- MongoDB (Percona Server or MongoDB Atlas) for self-hosting
requestsfor REST API calls (installed automatically)- Optional
velt-py[auth]extra (PyJWT>=2.8.0, cryptography>=42.0.0) — required only for the built-in JWT/JWKS verifier path ofverifyToken. Install withpip install 'velt-py[auth]'. Core install (pip install velt-py), the custom-callback verify path, and all non-auth features need no new dependency.
Quick Start
Initialize the SDK
- Self-hosting
- REST API
Self-hosting initialization (MongoDB + optional AWS):
Configuration
Environment Variables
The SDK reads the following environment variables automatically. These can be used instead of (or in addition to) config dict keys.| Variable | Config key equivalent | Purpose |
|---|---|---|
VELT_API_KEY | apiKey | Velt API key for authenticating REST API calls |
VELT_AUTH_TOKEN | authToken | Velt auth token for authenticating REST API calls |
VELT_WORKSPACE_ID | — | Default workspace ID for workspace-scoped operations |
VELT_WORKSPACE_AUTH_TOKEN | — | Auth token scoped to a specific workspace |
Self-Hosting Configuration
- Database
- AWS (Attachments)
- Collections
- User Schema
- Resolver Auth
- Complete Example
Configure MongoDB connection for storing comments, reactions, and user data.
Self-Hosting Backend
The SDK provides methods that accept the raw request from the frontend and return the properly formatted response. All self-hosting service classes — theBaseService base class plus seven resolver services — are importable from velt_py.services.self_hosting. As of v0.1.12, RecorderService, NotificationService, and ActivityService are also exported — previously they were wired into SelfHostingBackend but missing from the package’s __all__.
Comments
getComments
- Fetches comments from your database for a document.
- Params: GetCommentResolverRequest
- Returns: VeltSelfHostingResponse
saveComments
- Saves new or updated comments to your database.
- Params: SaveCommentResolverRequest
- Returns: VeltSelfHostingResponse
As of v0.1.14, when used as a save-resolver handler the inboundeventmay be aResolverActionsOR aCommentResolverSaveEventmember (or a raw string for forward-compat), and the request may carrytargetComment(request context only — never persisted). See theSaveCommentResolverRequestentry under Data Models for these additions.
deleteComment
- Deletes a comment from your database.
- Params: DeleteCommentResolverRequest
- Returns: VeltSelfHostingResponse
Reactions
getReactions
- Fetches reactions from your database for a document.
- Params: GetReactionResolverRequest
- Returns: VeltSelfHostingResponse
saveReactions
- Saves new or updated reactions to your database.
- Params: SaveReactionResolverRequest
- Returns: VeltSelfHostingResponse
deleteReaction
- Deletes a reaction from your database.
- Params: DeleteReactionResolverRequest
- Returns: VeltSelfHostingResponse
Users
getUsers
- Fetches users from your database.
- Params: GetUserResolverRequest
- Returns: VeltSelfHostingResponse
Attachments
saveAttachment
- Uploads an attachment file to S3 and saves the metadata.
- Params: SaveAttachmentResolverRequest
- Returns: VeltSelfHostingResponse
- Django
- Flask
- FastAPI
deleteAttachment
- Deletes an attachment file from S3 and removes its metadata.
- Params: DeleteAttachmentResolverRequest
- Returns: VeltSelfHostingResponse
- Django
- Flask
- FastAPI
Token
getToken
- Generates a Velt auth token for a user. Self-hosting variant.
- Params: positional —
organizationId,userId,email(optional),isAdmin(optional) - Returns: VeltSelfHostingResponse
Note:getTokentakes positional / keyword arguments — it does NOT accept a dataclass request object. Signature:getToken(organizationId, userId, email=None, isAdmin=False).
Resolver Token Verification
sdk.selfHosting.verifyToken(headers=None, token=None, **overrides) -> VerifyTokenResult authenticates the credential the Velt frontend forwards to your resolver endpoints. New in v0.1.14. It is opt-in via the resolver_auth config block, framework-agnostic, and fail-closed — it returns a structured VerifyTokenResult and never raises for a verification outcome. It is authentication only: it never consults apiKey, organizationId, or the resolver database; resolver services keep their own scoping. result.claims is informational — assert tenant claims against the resolver payload’s organizationId yourself if you need tenant isolation.
The built-in JWT/JWKS verifier requires the optional extra: pip install 'velt-py[auth]'. The custom-callback (verify) path needs no new dependency. Configure resolver_auth in the Resolver Auth config tab.
- Params:
headers— Incoming request headers; the token is extracted from the configured header.token— A raw JWT string, passed directly instead ofheaders.**overrides— One-offjwt/verify/header/schemethat merge over the configuredresolver_authwithout changing global config.
- Returns:
VerifyTokenResult— see the Data Models entry for fields.
result.errorCode)
| Code | When |
|---|---|
MISSING_TOKEN | No token found in header / not passed, empty, or wrong scheme. |
EXPIRED | Token exp is in the past. |
INVALID_SIGNATURE | Signature did not verify against the resolved key. |
CLAIM_MISMATCH | issuer, audience, or a required claim failed the check. |
ALGORITHM_NOT_ALLOWED | Token alg is not in the configured allowlist. |
KEY_RESOLUTION_FAILED | JWKS fetch / public_key / secret could not yield a usable key. |
VERIFICATION_FAILED | Generic verification failure not covered above. |
NOT_CONFIGURED | resolver_auth is not configured. |
DEPENDENCY_MISSING | Built-in verifier used without the velt-py[auth] extra installed. |
Authorization, case-insensitive), stripping the configured scheme prefix (default Bearer); or pass token='<raw_jwt>'. Missing, empty, or wrong-scheme credentials → MISSING_TOKEN.
Built-in JWT path — key resolution
jwt.secret→ symmetric HS256/384/512. A PEM string insecretis rejected to prevent PEM-as-HMAC forgery.jwt.public_key→ static RSA/EC key for RS* / ES*.jwt.jwks_url→ fetched over HTTPS, cached in-process by(url, kid). A fetch failure, non-2xx response, or unresolvablekid→KEY_RESOLUTION_FAILEDwithout raising.
- Fail-closed — never
verified=Trueunless a token was present and fully verified. - Algorithm pinning — the allowlist is always required and passed to PyJWT;
alg=noneis rejected unconditionally even if listed; mixed symmetric + asymmetric allowlists are rejected (HS/RS confusion). - HTTPS-only JWKS —
jwks_urlmust behttps://; a redirect downgrade https→http is rejected; 3xx responses are rejected; cache is scoped by(url, kid), notkidalone. - No credential leakage — the token, secret, and claims never appear in error strings or logs.
- Authentication only — never consults
apiKey,organizationId, or the resolver database.
**overrides kwargs merge over the configured resolver_auth, letting you supply a one-off jwt, verify, header, or scheme without mutating global config.
When resolver_auth is not configured
verifyToken returns verified=False with errorCode='NOT_CONFIGURED'. It does not raise and does not silently pass.
ResolverAuthService
Newly exported in velt_py.services.self_hosting.__all__ — the DB-free service backing verifyToken. Direct use is optional.
Framework Examples
- Django
- Flask
- FastAPI
SDK Initialization (velt_sdk.py)API Endpoints (views.py)Configuration (settings.py)
REST API Backend
Thesdk.api.* namespace gives you parity with Velt’s REST APIs across 18 services. Each method takes a typed @dataclass request object and returns the raw Velt API response.
You only need apiKey and authToken — no database or AWS config.
result key (success) or an error key (failure). See VeltApiResponse.
Organizations
addOrganizations
- Creates one or more organizations.
- Params: AddOrganizationsRequest
- Returns: VeltApiResponse
getOrganizations
- Retrieves organizations by ID, with optional pagination.
- Params: GetOrganizationsRequest
- Returns: GetOrganizationsResponse
updateOrganizations
- Updates properties of one or more organizations.
- Params: UpdateOrganizationsRequest
- Returns: VeltApiResponse
deleteOrganizations
- Deletes one or more organizations.
- Params: DeleteOrganizationsRequest
- Returns: VeltApiResponse
updateOrganizationDisableState
- Enables or disables access to one or more organizations.
- Params: UpdateOrganizationDisableStateRequest
- Returns: VeltApiResponse
Folders
addFolder
- Creates one or more folders inside an organization.
- Params: AddFolderRequest
- Returns: VeltApiResponse
getFolders
- Retrieves folders within an organization.
- Params: GetFoldersRequest
- Returns: GetFoldersResponse
updateFolder
- Updates properties of one or more folders.
- Params: UpdateFolderRequest
- Returns: VeltApiResponse
deleteFolder
- Deletes a folder.
- Params: DeleteFolderRequest
- Returns: VeltApiResponse
updateFolderAccess
- Updates the access type of one or more folders.
- Params: UpdateFolderAccessRequest
- Returns: VeltApiResponse
Documents
addDocuments
- Creates one or more documents inside an organization.
- Params: AddDocumentsRequest
- Returns: VeltApiResponse
getDocuments
- Retrieves documents within an organization.
- Params: GetDocumentsRequest
- Returns: GetDocumentsResponse
updateDocuments
- Updates properties of one or more documents.
- Params: UpdateDocumentsRequest
- Returns: VeltApiResponse
deleteDocuments
- Deletes one or more documents.
- Params: DeleteDocumentsRequest
- Returns: VeltApiResponse
moveDocuments
- Moves documents into a target folder.
- Params: MoveDocumentsRequest
- Returns: VeltApiResponse
updateDocumentAccess
- Updates the access type of one or more documents.
- Params: UpdateDocumentAccessRequest
- Returns: VeltApiResponse
updateDocumentDisableState
- Enables or disables access to one or more documents.
- Params: UpdateDocumentDisableStateRequest
- Returns: VeltApiResponse
migrateDocuments
- Starts a job to migrate a document to a new document ID.
- Params: MigrateDocumentsRequest
- Returns: MigrateDocumentsResponse
Note: This call is asynchronous. Poll status via migrateDocumentsStatus.
migrateDocumentsStatus
- Polls the status of a document migration job.
- Params: MigrateDocumentsStatusRequest
- Returns: MigrateDocumentsStatusResponse
getDocumentsCount
- Gets the document count for an organization. Optionally exclude folder docs or scope to a folder.
- Params:
GetDocumentsCountRequest(fromvelt_py.models.document) - Returns: VeltApiResponse
Users
addUsers
- Adds one or more users to an organization.
- Params: AddUsersRequest
- Returns: VeltApiResponse
getUsers
- Retrieves users in an organization or document.
- Params: GetUsersRequest
- Returns: GetUsersResponse
- Now also supports optional
includeInvolvedDocumentsandsearchKey(free-text search) filters.
updateUsers
- Updates metadata for one or more users.
- Params: UpdateUsersRequest
- Returns: VeltApiResponse
deleteUsers
- Removes users from an organization.
- Params: DeleteUsersRequest
- Returns: VeltApiResponse
getUsersCount
- Gets the user count for an organization. Optionally scope to a document, a user, or all documents.
- Params:
GetUsersCountRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
getDocUsers
- Gets document-level users. Optionally filter by user IDs (max 20; max 5 with
includeInvolvedDocuments), include involved documents, and paginate. - Params:
GetDocUsersRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
addUserInvite
- Creates a user invitation (organization, document, or folder).
- Params:
AddUserInviteRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
respondToInvite
- Responds to a user invitation (accept, reject, or withdraw).
- Params:
RespondUserInviteRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
getInvitedUsers
- Gets invited users for an organization (paginated).
- Params:
GetInvitedUsersRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
getUserInvitations
- Gets invitations for a specific user email (paginated).
- Params:
GetUserInvitationsRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
getInvitedPendingUsersCount
- Gets the count of pending invited users.
- Params:
GetInvitedPendingUsersCountRequest(fromvelt_py.models.user_api) - Returns: VeltApiResponse
User Groups
addUserGroups
- Creates one or more user groups inside an organization.
- Params: AddUserGroupsRequest
- Returns: VeltApiResponse
addUsersToGroup
- Adds users to an existing group.
- Params: AddUsersToGroupRequest
- Returns: VeltApiResponse
deleteUsersFromGroup
- Removes users from a group, or empties the group entirely when
deleteAllisTrue. - Params: DeleteUsersFromGroupRequest
- Returns: VeltApiResponse
Notifications
Filtering unknown fields:
updateNotifications accepts an optional filter_unknown_fields: bool = False keyword (backed by velt_py.models.field_allowlists). When True, unknown/custom top-level keys are dropped before the request is sent, while open-typed fields (context, metadata, entityData, user objects) pass through whole. Filtering is fail-open: if it errors, the original payload is sent, so a write is never blocked. addNotifications is not affected — its top-level fields are already fixed. On updateNotifications, isRead / isArchived are not accepted by /v2/notifications/update (the backend strips them anyway), so with the flag on they are dropped client-side.addNotifications
- Sends a notification to one or more users on a document.
- Params: AddNotificationsRequest
- Returns: VeltApiResponse
getNotifications
- Retrieves notifications for a user or document.
- Params: GetNotificationsRequest
- Returns: GetNotificationsResponse
updateNotifications
- Updates fields on existing notifications (e.g., mark as read).
- Params: UpdateNotificationsRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
deleteNotifications
- Deletes one or more notifications.
- Params: DeleteNotificationsRequest
- Returns: VeltApiResponse
getNotificationConfig
- Gets notification preferences (inbox/email/slack channels) for a user.
- Params: GetNotificationConfigRequest
- Returns: GetNotificationConfigResponse
setNotificationConfig
- Sets notification preferences for one or more users.
- Params: SetNotificationConfigRequest
- Returns: VeltApiResponse
Comment Annotations
Filtering unknown fields: The add/update methods below accept an optional
filter_unknown_fields: bool = False keyword (backed by velt_py.models.field_allowlists). When True, request entity collections are filtered to only the fields the Velt API accepts, dropping unknown/custom top-level keys before the request is sent. Open-typed fields (context, metadata, entityData, 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.addCommentAnnotations
- Creates one or more comment annotations on a document.
- Params: AddCommentAnnotationsRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
getCommentAnnotations
- Retrieves comment annotations on a document.
- Params: GetCommentAnnotationsRequest
- Returns: GetCommentAnnotationsResponse
getCommentAnnotationsCount
- Counts total and unread annotations across one or more documents.
- Params: GetCommentAnnotationsCountRequest
- Returns: GetCommentAnnotationsCountResponse
updateCommentAnnotations
- Updates annotation fields (e.g., change status).
- Params: UpdateCommentAnnotationsRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
deleteCommentAnnotations
- Deletes one or more comment annotations.
- Params: DeleteCommentAnnotationsRequest
- Returns: VeltApiResponse
addComments
- Adds reply comments to an existing annotation.
- Params: AddCommentsRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
getComments
- Retrieves individual comments inside an annotation.
- Params: GetCommentsRequest
- Returns: GetCommentsResponse
updateComments
- Updates fields on individual comments inside an annotation.
- Params: UpdateCommentsRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
deleteComments
- Deletes one or more comments from an annotation, or all comments if
commentIdsis omitted. - Params: DeleteCommentsRequest
- Returns: VeltApiResponse
Activities
Filtering unknown fields: The add/update methods below accept an optional
filter_unknown_fields: bool = False keyword (backed by velt_py.models.field_allowlists). When True, request entity collections are filtered to only the fields the Velt API accepts, dropping unknown/custom top-level keys before the request is sent. Open-typed fields (context, metadata, entityData, 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.addActivities
- Logs one or more activity events.
- Params: AddActivitiesRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
getActivities
- Retrieves activities with optional filters and pagination.
- Params: GetActivitiesRequest
- Returns: GetActivitiesResponse
updateActivities
- Updates fields on existing activities.
- Params: UpdateActivitiesRequest
- Returns: VeltApiResponse
- Accepts the optional
filter_unknown_fields=Truekeyword (see the note above).
deleteActivities
- Deletes activities by document, target entity, or specific IDs.
- Params: DeleteActivitiesRequest
- Returns: VeltApiResponse
Access Control
addPermissions
- Grants resource-level permissions to a user.
- Params: AddPermissionsRequest
- Returns: VeltApiResponse
getPermissions
- Retrieves permissions for one or more users.
- Params: GetPermissionsRequest
- Returns: GetPermissionsResponse
removePermissions
- Revokes resource-level permissions from a user.
- Params: RemovePermissionsRequest
- Returns: VeltApiResponse
generateSignature
- Generates a signed payload for Velt’s Permission Provider flow.
- Params: GenerateSignatureRequest
- Returns: GenerateSignatureResponse
generateToken
- Generates a Velt JWT token bound to a user and a set of resource permissions.
- Params: GenerateTokenRequest
- Returns: GenerateTokenResponse
CRDT
addCrdtData
- Stores CRDT data (text, map, array, or xml) for an editor on a document.
- Params: AddCrdtDataRequest
- Returns: VeltApiResponse
getCrdtData
- Retrieves CRDT data for one or all editors on a document.
- Params: GetCrdtDataRequest
- Returns: GetCrdtDataResponse
updateCrdtData
- Updates existing CRDT data for an editor.
- Params: UpdateCrdtDataRequest
- Returns: VeltApiResponse
deleteCrdtData
- Deletes CRDT editor data. Optionally target specific
editorIds; omit to delete all editors for a document. - Params:
DeleteCrdtDataRequest(fromvelt_py.models.crdt) - Returns: VeltApiResponse
Presence
addPresence
- Adds users to a document’s presence list.
- Params: AddPresenceRequest
- Returns: VeltApiResponse
updatePresence
- Updates presence status for one or more users on a document.
- Params: UpdatePresenceRequest
- Returns: VeltApiResponse
deletePresence
- Removes users from a document’s presence list.
- Params: DeletePresenceRequest
- Returns: VeltApiResponse
Livestate
broadcastEvent
- Broadcasts an event payload to all clients subscribed to a livestate ID on a document.
- Params: BroadcastEventRequest
- Returns: VeltApiResponse
Recordings
getRecordings
- Retrieves recording metadata, optionally scoped to a document or set of recording IDs.
- Params: GetRecordingsRequest
- Returns: GetRecordingsResponse
Rewriter
askAi
- Sends a model, prompt, and text to Velt’s AI rewriter and returns the transformed text.
- Params: AskAiRequest
- Returns: AskAiResponse
Note: This call may take several seconds and has no client-side timeout. Wrap calls in your own timeout if needed.
GDPR
deleteAllUserData
- Requests deletion of all data associated with one or more users.
- Params: DeleteAllUserDataRequest
- Returns: VeltApiResponse
Note: This call is asynchronous and returns ajobId. Poll status viagetDeleteUserDataStatus.
getAllUserData
- Exports all data associated with a user, paginated.
- Params: GetAllUserDataRequest
- Returns: GetAllUserDataResponse
getDeleteUserDataStatus
- Polls the status of a
deleteAllUserDatajob. - Params: GetDeleteUserDataStatusRequest
- Returns: GetDeleteUserDataStatusResponse
Workspace
createWorkspace
- Creates a new workspace.
- Params: CreateWorkspaceRequest
- Returns: VeltApiResponse
getWorkspace
- Retrieves details about the current workspace.
- Params: GetWorkspaceRequest
- Returns: GetWorkspaceResponse
createApiKey
- Creates a new API key in the workspace.
- Params: CreateApiKeyRequest
- Returns: VeltApiResponse
updateApiKey
- Updates an existing API key (e.g., rename it).
- Params: UpdateApiKeyRequest
- Returns: VeltApiResponse
getApiKeys
- Lists all API keys in the workspace.
- Params: GetApiKeysRequest
- Returns: GetApiKeysResponse
getApiKeyMetadata
- Gets metadata for the API key the SDK is authenticated with.
- Params: GetApiKeyMetadataRequest
- Returns: GetApiKeyMetadataResponse
- Fixed in v0.1.11: now targets the canonical
/v2/workspace/apikeyconfig/getendpoint (was/v2/workspace/apikeymetadata/get, retained as a legacy backend alias). Method signature is unchanged — no call-site change needed.
resetAuthToken
- Rotates the auth token associated with 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.
- Params: AddDomainsRequest
- Returns: VeltApiResponse
deleteDomains
- Removes allowed domains from the workspace.
- Params: DeleteDomainsRequest
- Returns: VeltApiResponse
getDomains
- Lists allowed domains for the workspace.
- Params: GetDomainsRequest
- Returns: GetDomainsResponse
getEmailStatus
- Checks email verification status for a workspace owner.
- Params: GetEmailStatusRequest
- Returns: GetEmailStatusResponse
sendLoginLink
- Sends a login link email to a user.
- Params: SendLoginLinkRequest
- Returns: VeltApiResponse
getEmailConfig
- Retrieves the workspace’s email service configuration.
- Params: GetEmailConfigRequest
- Returns: GetEmailConfigResponse
updateEmailConfig
- Updates the workspace’s email service configuration.
- Params: UpdateEmailConfigRequest
- Returns: VeltApiResponse
getWebhookConfig
- Retrieves the workspace’s webhook configuration.
- Params: GetWebhookConfigRequest
- Returns: GetWebhookConfigResponse
updateWebhookConfig
- Updates the workspace’s webhook configuration.
- Params: UpdateWebhookConfigRequest
- Returns: VeltApiResponse
getRequestedDomains
- Gets requested (pending) domains.
- Params:
GetRequestedDomainsRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
createDomainRequest
- Creates a domain access request.
- Params:
CreateDomainRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
acceptRejectAdditionalUrlRequest
- Accepts or rejects an additional-URL request.
- Params:
AcceptRejectAdditionalUrlRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
copyApiKey
- Copies configuration from one API key to another (workspace-scoped).
- Params:
CopyApiKeyRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
updateApiKeyMetadata
- Updates API key app configuration (private comments, JWT, default access, AI keys).
- Params:
UpdateApiKeyMetadataRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
getNotificationConfig
- Gets the workspace notification service config.
- Params:
GetWorkspaceNotificationConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
updateNotificationConfig
- Updates the workspace notification service config.
- Params:
UpdateWorkspaceNotificationConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
getPermissionProviderConfig
- Gets the permission provider config.
- Params:
GetPermissionProviderConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
updatePermissionProviderConfig
- Updates the permission provider config.
- Params:
UpdatePermissionProviderConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
getActivityConfig
- Gets the activity logs config.
- Params:
GetActivityConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
updateActivityConfig
- Updates the activity logs config.
- Params:
UpdateActivityConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
getAdvancedWebhookConfig
- Gets the advanced (Svix) webhook config.
- Params:
GetAdvancedWebhookConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
updateAdvancedWebhookConfig
- Updates the advanced (Svix) webhook config.
- Params:
UpdateAdvancedWebhookConfigRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
getAdvancedWebhookEndpoints
- Lists advanced webhook endpoints.
- Params:
GetAdvancedWebhookEndpointsRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
createAdvancedWebhookEndpoint
- Creates an advanced webhook endpoint.
- Params:
CreateAdvancedWebhookEndpointRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
updateAdvancedWebhookEndpoint
- Updates an advanced webhook endpoint.
- Params:
UpdateAdvancedWebhookEndpointRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
deleteAdvancedWebhookEndpoint
- Deletes an advanced webhook endpoint.
- Params:
DeleteAdvancedWebhookEndpointRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
getAdvancedWebhookEndpointSecret
- Gets an advanced webhook endpoint’s signing secret.
- Params:
GetAdvancedWebhookEndpointSecretRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
ensureWorkspaceAuthToken
- Ensures a workspace auth token exists (workspace-scoped).
- Params:
EnsureWorkspaceAuthTokenRequest(fromvelt_py.models.workspace) - Returns: VeltApiResponse
Workflow
A new service for the Approval Engine / workflow orchestration: definitions, executions, lifecycle events, and step resolution (/v2/workflow/*). 14 methods. Request types are imported from velt_py.models.workflow.
createDefinition
- Creates a workflow definition.
- Params:
CreateWorkflowDefinitionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
updateDefinition
- Updates a workflow definition. Supports optimistic concurrency via
ifVersion. - Params:
UpdateWorkflowDefinitionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
deleteDefinition
- Deletes a workflow definition.
- Params:
DeleteWorkflowDefinitionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
getDefinition
- Gets a workflow definition.
- Params:
GetWorkflowDefinitionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
listDefinitions
- Lists workflow definitions.
- Params:
ListWorkflowDefinitionsRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
dispatchExecution
- Dispatches a workflow execution.
- Params:
DispatchExecutionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
cancelExecution
- Cancels a workflow execution.
- Params:
CancelExecutionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
getExecution
- Gets a workflow execution.
- Params:
GetExecutionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
getExecutionEvents
- Gets lifecycle events for an execution (paginated).
- Params:
GetExecutionEventsRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
listExecutions
- Lists workflow executions.
- Params:
ListExecutionsRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
cancelStep
- Cancels a step within an execution.
- Params:
CancelStepRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
resolveStep
- Resolves a step (admin/reviewer override).
- Params:
ResolveStepRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
recordAgentResolution
- Records an agent resolution against a blocking-agent step.
- Params:
RecordAgentResolutionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
recordReviewerDecision
- Records a reviewer decision against a human step.
- Params:
RecordReviewerDecisionRequest(fromvelt_py.models.workflow) - Returns: VeltApiResponse
Token
getToken
- Generates a Velt auth token for a user.
- Params: positional —
organizationId,userId,email(optional),isAdmin(optional) - Returns: VeltApiResponse
Note:getTokentakes positional / keyword arguments — it does NOT accept a dataclass request object. Signature:getToken(organizationId, userId, email=None, isAdmin=False).
Data Isolation
Everysdk.api.* method requires an organizationId in its request payload. Velt’s API enforces data isolation server-side — requests without a valid organizationId will be rejected.
Error Handling
The SDK raises typed exceptions for different failure modes. All exceptions extendVeltSDKError.
| Exception | When raised |
|---|---|
VeltSDKError | Base class; catch for any SDK-level error |
VeltValidationError | SDK-level validation (e.g., missing required config); sdk.api.* methods do not validate request payloads locally |
VeltTokenError | Token generation or authentication failure |
VeltApiError | REST API errors (network failures, unexpected responses) |
from velt_py.exceptions import VeltSDKError, VeltValidationError, VeltTokenError, VeltApiError
Common self-hosting error codes returned in the response 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
Python-SDK-specific dataclasses used by the self-hosting backend. These are not in the shared API reference because they are only relevant tosdk.selfHosting.* implementations.
PartialCommentAnnotation
Represents a partial update payload for a comment annotation. Starting in v0.1.10, from, assignedTo, targetTextRange, and resolvedByUserId are first-class typed fields (previously silent pass-through via extra_fields).
from_— Python alias for the JSON keyfrom(reserved keyword). Serialized asfromin the Mongo document.assignedTo— Typed asPartialUser. Omit to leave unchanged; the Mongo write skips the field whenNone.targetTextRange— TypedPartialTargetTextRangefor the selected text snippet a comment is anchored to.resolvedByUserId— See UNSET sentinel for the difference between absent (UNSET) and explicitNone.extra_fields— Retained as a catch-all because the frontend contract includes[key: string]: anyfor customer-configuredfieldsToRemoveandadditionalFields.
PartialReactionAnnotation
Represents a partial update payload for a reaction annotation. Starting in v0.1.12, the reaction-author field is from_ (wire key from), replacing the former user field — aligning with the velt-sdk contract and PartialCommentAnnotation.
from_— Python alias for the JSON keyfrom(reserved keyword); serialized asfrom. Replaces the formeruserfield (renamed in v0.1.12 to match the velt-sdk contract and the comment models). Constructing withuser=no longer works — usefrom_=.- Backward-compatible reads:
from_dict()accepts either the canonicalfromkey or the legacyuserkey (fromwins when both are present) and populatesfrom_.to_dict()always emitsfrom. No data migration is required for reaction documents already stored underuser.
PartialTargetTextRange
Anchors a comment to a selected text snippet.
UNSET Sentinel
UNSET is a sentinel value exported from velt_py.models.comment. It signals that a field was not included in the incoming request payload and should be skipped entirely during the MongoDB write.
| Value | Payload | Mongo write |
|---|---|---|
UNSET | Field absent | Field skipped — no change |
None | Field present, value null | Field written as null |
BaseMetadata
Base metadata attached to every comment annotation. Starting in v0.1.10, sdkVersion and documentMetadata are fully modeled and preserved in MongoDB writes. These fields were previously sent by the frontend on every annotation save but silently dropped.
BaseMetadata is populated automatically from the incoming request payload. The fix applies transparently to all saveComments calls.
VerifyTokenResult
Structured result returned by sdk.selfHosting.verifyToken. New in v0.1.14. Module: velt_py.models.resolver_auth; exported from velt_py and velt_py.models.
verified—Trueonly when a token was present and fully verified, or a custom callback returned non-Noneclaims.claims— Decoded payload when verified; otherwiseNone.error— Generic, code-based message; never contains the token or secret.errorCode— One of:MISSING_TOKEN,EXPIRED,INVALID_SIGNATURE,CLAIM_MISMATCH,ALGORITHM_NOT_ALLOWED,KEY_RESOLUTION_FAILED,VERIFICATION_FAILED,NOT_CONFIGURED,DEPENDENCY_MISSING.
CommentResolverSaveEvent
Enum of comment save-resolver actions the frontend forwards to your save handler. New in v0.1.14. A (str, Enum) exported from velt_py and velt_py.models; wire values are byte-identical to the upstream frontend enum.
| Member | Wire value |
|---|---|
STATUS_CHANGE | comment_annotation.status_change |
PRIORITY_CHANGE | comment_annotation.priority_change |
ASSIGN | comment_annotation.assign |
ACCESS_MODE_CHANGE | comment_annotation.access_mode_change |
CUSTOM_LIST_CHANGE | comment_annotation.custom_list_change |
APPROVE | comment_annotation.approve |
ACCEPT | comment.accept |
REJECT | comment.reject |
SUGGESTION_ACCEPT | comment_annotation.suggestion_accept |
SUGGESTION_REJECT | comment_annotation.suggestion_reject |
REACTION_ADD | comment.reaction_add |
REACTION_DELETE | comment.reaction_delete |
SUBSCRIBE | comment_annotation.subscribe |
UNSUBSCRIBE | comment_annotation.unsubscribe |
SaveCommentResolverRequest.from_dict tries ResolverActions FIRST (preserving every existing value), then CommentResolverSaveEvent, then keeps the raw string for unknown future values.
Distinctness — CommentResolverSaveEvent.REACTION_ADD (comment.reaction_add) is distinct from ResolverActions.REACTION_ADD (reaction.add, the reaction-resolver action); the parse order routes each correctly.
SaveCommentResolverRequest
The full shared shape is documented in the API reference. This entry covers only the v0.1.14 additions — additive; existing payloads parse byte-identically.
targetComment: Optional[PartialComment]— The comment the action occurred on, resolved by the frontend fromcommentId.from_dictparses it fail-open (a malformed/partial dict never raises).to_dictemits it only when notNone.saveCommentsNEVER persists it (request context only).event: Optional[Union[ResolverActions, CommentResolverSaveEvent, str]]— Widened. Every existingResolverActionsvalue still parses to the same member. Parse order:ResolverActionsfirst, thenCommentResolverSaveEvent, then raw string for unknown future values.

