Skip to main content

Overview

The RecallrAI client is the entry point for all SDK operations. It manages authentication and provides methods for user management.

Initialization

import { RecallrAI } from "recallrai";

const client = new RecallrAI({
  apiKey: "rai_yourapikey",
  projectId: "project-uuid",
  baseUrl: "https://api.recallrai.com",
  timeout: 60,
});

Methods

createUser()

import { UserAlreadyExistsError } from "recallrai";

try {
  const user = await client.createUser("user123", { name: "John Doe", role: "admin" });
  console.log(`Created user: ${user.userId}`);
} catch (error) {
  if (error instanceof UserAlreadyExistsError) {
    console.log(`Error: ${error.message}`);
  }
}
userId
string
required
Unique identifier for the user. Must be unique within your project.
metadata
object
Optional metadata to associate with the user.
Returns: User Raises: UserAlreadyExistsError

getUser()

import { UserNotFoundError } from "recallrai";

try {
  const user = await client.getUser("user123");
  console.log(`User metadata:`, user.metadata);
} catch (error) {
  if (error instanceof UserNotFoundError) {
    console.log(`Error: ${error.message}`);
  }
}
userId
string
required
The ID of the user to retrieve.
Returns: User Raises: UserNotFoundError

listUsers()

const userList = await client.listUsers({
  offset: 0,
  limit: 10,
  metadataFilter: { role: "admin" },
});

console.log(`Total users: ${userList.total}`);
console.log(`Has more: ${userList.hasMore}`);
offset
number
Number of users to skip. Default: 0
limit
number
Maximum number of users to return. Default: 10
metadataFilter
object
Filter users by metadata fields.
Returns: UserList with users, total, and hasMore.