This section provides comprehensive technical documentation for all classes, methods, types, and utilities in the SurrealDB JavaScript SDK. The API reference is organized by functionality to help you quickly find what you need.
The core classes provide the foundation for connecting to SurrealDB and managing database sessions.
Query builder classes are returned by query methods and provide chainable configuration options before execution. View all query builders →
Custom data type classes for SurrealDB-specific types with type safety and utility methods. View type mapping →
Utility functions and classes for building queries and working with SurrealDB data. View all utilities →
Error classes for handling different types of failures in the SDK.
TypeScript type definitions and interfaces used throughout the SDK.
Getting Started:
Surreal instanceconnect() to establish connectionselect(), create(), etc.Authentication:
signup() - Sign up new userssignin() - Sign in with credentialsauthenticate() - Authenticate with tokensQuerying Data:
query() - Raw SurrealQLselect() - Select records (SelectPromise)create() - Create records (CreatePromise)insert() - Insert recordsupdate() - Update recordsdelete() - Delete recordsReal-time Features:
live() - Subscribe to live queriesTransactions:
beginTransaction() - Start transactionscommit() - Commit changescancel() - Roll back changesThis API reference is for the JavaScript SDK version 2.x. For version 1.x documentation, see the v1 documentation.
Found an error or want to improve the documentation? Submit an issue or pull request in the docs.surrealdb.com repository.