Back to Docs

API Reference

Complete reference for all Brainboard SDK methods.

BrainboardClient

The main client for interacting with the Brainboard API.

import { BrainboardClient } from 'codiris-brainboard-sdk';

const client = new BrainboardClient({
  apiKey: 'brb_live_your-api-key',  // Required
  baseUrl: 'https://app.codiris.ai/api',  // Optional
  workspaceId: 'workspace-id',      // Optional - default workspace
  userId: 'user-id',                // Optional
  userEmail: 'user@example.com',    // Optional
  userName: 'User Name',            // Optional
  externalUserId: 'your-user-123',  // Optional - isolate boards per user
  debug: false,                     // Optional - enable logging
});

Board Methods

listBoards

List all boards accessible to the user.

listBoards(options?): Promise<APIResponse<PaginatedResponse<Board>>>
const { data } = await client.listBoards({
  status: 'active',
  search: 'project',
  page: 1,
  pageSize: 20,
});

console.log(`Found ${data.total} boards`);

getBoard

Get a single board by ID.

getBoard(boardId: string): Promise<APIResponse<Board>>
const { data: board } = await client.getBoard('board_xxxxx');
console.log(board.name);

createBoard

Create a new board.

createBoard(input: CreateBoardInput): Promise<APIResponse<Board>>
const { data: board } = await client.createBoard({
  name: 'Sprint Planning',
  description: 'Sprint 42 planning session',
  settings: {
    gridEnabled: true,
    snapToGrid: true,
  },
});

updateBoard

Update an existing board.

updateBoard(boardId: string, input: UpdateBoardInput): Promise<APIResponse<Board>>
await client.updateBoard('board_xxxxx', {
  name: 'Updated Name',
  isStarred: true,
});

deleteBoard

Delete a board (moves to trash).

deleteBoard(boardId: string): Promise<APIResponse<void>>
await client.deleteBoard('board_xxxxx');

duplicateBoard

Create a copy of a board.

duplicateBoard(boardId: string, name?: string): Promise<APIResponse<Board>>
const { data: newBoard } = await client.duplicateBoard(
  'board_xxxxx',
  'Copy of My Board'
);

Object Methods

getObjects

Get all objects on a board.

getObjects(boardId: string): Promise<APIResponse<BoardObject[]>>
const { data: objects } = await client.getObjects('board_xxxxx');
objects.forEach(obj => {
  console.log(`${obj.type} at (${obj.x}, ${obj.y})`);
});

createObject

Create a new object on a board.

createObject(boardId: string, input: CreateObjectInput): Promise<APIResponse<BoardObject>>
const { data: sticky } = await client.createObject(boardId, {
  type: 'sticky',
  x: 100,
  y: 100,
  width: 200,
  height: 200,
  text: 'My idea',
  fill: '#ffeb3b',
});

createObjects

Create multiple objects at once.

createObjects(boardId: string, inputs: CreateObjectInput[]): Promise<APIResponse<BoardObject[]>>
const { data: objects } = await client.createObjects(boardId, [
  { type: 'sticky', x: 100, y: 100, text: 'Note 1' },
  { type: 'sticky', x: 320, y: 100, text: 'Note 2' },
  { type: 'sticky', x: 540, y: 100, text: 'Note 3' },
]);

updateObject

Update an object.

updateObject(boardId: string, objectId: string, input: UpdateObjectInput): Promise<APIResponse<BoardObject>>
await client.updateObject(boardId, objectId, {
  text: 'Updated text',
  fill: '#22c55e',
});

deleteObject

Delete an object.

deleteObject(boardId: string, objectId: string): Promise<APIResponse<void>>
await client.deleteObject(boardId, objectId);

Member Methods

getMembers

Get all members of a board.

getMembers(boardId: string): Promise<APIResponse<BoardMember[]>>
const { data: members } = await client.getMembers(boardId);
members.forEach(member => {
  console.log(`${member.email} - ${member.role}`);
});

inviteMember

Invite a user to a board. Roles: owner, admin, editor, commenter, viewer.

inviteMember(boardId: string, email: string, role?: MemberRole): Promise<APIResponse<BoardMember>>
await client.inviteMember(boardId, 'user@example.com', 'editor');

removeMember

Remove a member from a board.

removeMember(boardId: string, memberId: string): Promise<APIResponse<void>>
await client.removeMember(boardId, memberId);

Comment Methods

getComments

Get comments on a board or specific object.

getComments(boardId: string, objectId?: string): Promise<APIResponse<BoardComment[]>>
const { data: comments } = await client.getComments(boardId);

addComment

Add a comment to a board or object.

addComment(boardId: string, content: string, objectId?: string, parentId?: string): Promise<APIResponse<BoardComment>>
// Comment on the board
await client.addComment(boardId, 'Great work!');

// Comment on an object
await client.addComment(boardId, 'Can we clarify this?', objectId);

// Reply to a comment
await client.addComment(boardId, 'Sure!', objectId, parentId);

AI Methods

generateContent

Generate content using AI.

generateContent(request: AIGenerateRequest): Promise<APIResponse<AIGenerateResponse>>
const { data } = await client.generateContent({
  prompt: 'Create a user journey map for e-commerce checkout',
  type: 'diagram',
  boardId: 'board_xxxxx',
});

// Add generated objects to the board
if (data.objects) {
  await client.createObjects(boardId, data.objects);
}

chat

Chat with AI about board content with optional source grounding.

chat(boardId: string, messages: AIChatMessage[], useSourceGrounding?: boolean): Promise<APIResponse<AIChatMessage>>
const { data: response } = await client.chat(
  boardId,
  [{ role: 'user', content: 'What are the main themes?' }],
  true // Enable source grounding for citations
);

console.log(response.content);
console.log(response.sources); // Cited objects

executeCommand

Execute a natural language command on the board.

executeCommand(boardId: string, command: string, selectedObjectIds?: string[]): Promise<APIResponse<{ operations: BoardOperation[] }>>
// Global command
await client.executeCommand(boardId, 'make all sticky notes blue');

// Command on selected objects
await client.executeCommand(boardId, 'align to the left', ['obj_1', 'obj_2']);

generateAudioOverview

Generate an AI-narrated audio summary. Styles: summary (2-3 min), podcast (5-7 min), deep-dive (8-10 min).

generateAudioOverview(boardId: string, style?: 'summary' | 'podcast' | 'deep-dive'): Promise<APIResponse<AIAudioOverview>>
const { data: audio } = await client.generateAudioOverview(boardId, 'podcast');

console.log(audio.audioUrl);
console.log(audio.script);
console.log(audio.duration);

Sharing Methods

generateShareLink

Generate a shareable link for a board.

generateShareLink(boardId: string, options?: { canEdit?: boolean; expiresAt?: string; password?: string }): Promise<APIResponse<{ shareUrl: string; shareToken: string }>>
// Read-only link
const { data } = await client.generateShareLink(boardId);

// Editable link with expiration
const { data: editLink } = await client.generateShareLink(boardId, {
  canEdit: true,
  expiresAt: '2024-12-31T23:59:59Z',
});

console.log(data.shareUrl);

revokeShareLink

Revoke an existing share link.

revokeShareLink(boardId: string): Promise<APIResponse<void>>
await client.revokeShareLink(boardId);

Response Format

All API methods return a consistent response format:

interface APIResponse<T> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
}

// Usage
const response = await client.getBoard('board_xxxxx');

if (response.success) {
  console.log(response.data.name);
} else {
  console.error(response.error);
}