Nbh Developer SDK & Public API
Integrate rich Google Keep style notes, real-time collaboration rooms, high-DPI canvas sketches, sovereign phone speech recognition, and dual-key Beeta AI into any web application or microservice in under 60 seconds.
import { NbhSDK } from "https://nbhweb.pages.dev/src/sdk.js";
// 1. Create a note with embedded LaTeX formula and drawing
const note = await NbhSDK.notes.create({
title: "Neural Optimization Notes",
content: "Loss function: $$L(\\theta) = \\frac{1}{N}\\sum_{i=1}^N (y_i - \\hat{y}_i)^2$$",
type: "rtf"
});
// 2. Query Beeta AI with stream cascade
await NbhSDK.ai.stream("Summarize this algorithm in 3 steps", (chunk) => {
console.log("AI Token:", chunk);
});
// 3. Join a live collaborative editing session
const room = await NbhSDK.rooms.joinRoom("NE7849");
console.log("Connected to Room:", room.roomId);
API Key System & Domain Whitelisting
All SDK calls and REST endpoints enforce cryptographic API Key authentication combined with strict origin domain whitelisting to safeguard your data against unauthorized CORS origins.
Live API Key & Security Controls
Manage production secrets and permitted host origins.
X-Nbh-Client-Origin: https://myapp.example.com
Installation & CDN Setup
Use ESM modules, browser CDN script tags, or install in Node.js environments.
<!-- Browser CDN -->
<script type="module" src="https://nbhweb.pages.dev/src/sdk.js"></script>
<script>
// Globally available on window.NbhSDK
const notes = await window.NbhSDK.notes.list();
</script>
Notes & Documents API (Full CRUD)
Programmatically create, read, update, delete, restore, export, and publicly share notes with 0ms optimistic latency and automated Google Drive cloud backup.
// List all active workspace notes
const notes = await window.NbhSDK.notes.list({ folder: "Engineering" });
// Retrieve a single note by unique ID or slug
const note = await window.NbhSDK.notes.get("note_174129");
console.log(note.title, note.content);
const newNote = await window.NbhSDK.notes.create({
title: "Distributed Mesh Architecture",
content: "<h2>Decentralized Synchronization</h2><p>Zero-latency CRDT state engine.</p>",
type: "rtf",
tags: ["architecture", "mesh"],
folder: "Engineering"
});
// Update existing note
await window.NbhSDK.notes.update("note_174129", {
title: "Updated Architecture v2",
content: "New revised content..."
});
// Move note to trash
await window.NbhSDK.notes.delete("note_174129");
// Restore note from trash
await window.NbhSDK.notes.restore("note_174129");
// Export note to Markdown, Plaintext, HTML or JSON
const markdown = await window.NbhSDK.notes.export("note_174129", "md");
Tasks & Checklists API (Full CRUD)
Manage interactive todo checklists, subtasks, priorities, and completion state across all notes.
// 1. Create a task / todo
const task = await window.NbhSDK.tasks.create({
text: "Ship production SDK endpoints",
completed: false,
priority: "high"
});
// 2. Query all tasks
const todos = await window.NbhSDK.tasks.list({ completed: false });
// 3. Toggle completion
await window.NbhSDK.tasks.toggle(task.id);
// 4. Update task
await window.NbhSDK.tasks.update(task.id, { text: "Deploy SDK v1.1.0", priority: "urgent" });
// 5. Delete or clear completed
await window.NbhSDK.tasks.delete(task.id);
await window.NbhSDK.tasks.clearCompleted();
Realtime Collaboration Rooms & Sync API
Programmatic multi-user co-editing sessions, room lifecycle management, document delta sync, real-time presence indicators, and live messaging.
// 1. Create a collaborative room
const room = await window.NbhSDK.collab.createRoom("Engineering War Room");
console.log("Room ID:", room.roomId);
// 2. Join a room with user profile
await window.NbhSDK.collab.joinRoom(room.roomId, {
name: "Alex Chen",
avatar: "developer"
});
// 3. Subscribe to remote document sync changes
window.NbhSDK.collab.onDocumentChange((event) => {
console.log("Document delta updated by remote peer:", event.delta);
});
// 4. Broadcast document delta sync
await window.NbhSDK.collab.syncDocument({
ops: [{ retain: 10 }, { insert: " Realtime collaboration in sync!" }]
});
// 5. Send chat message to room peers
await window.NbhSDK.collab.sendMessage("Hey team, reviewing the architecture doc now.");
// 6. Inspect active peer presence
const peers = await window.NbhSDK.collab.getPresence();
console.log("Connected Peers:", peers.length);
// 7. Leave room session
window.NbhSDK.collab.leaveRoom();
Beeta AI & LLM Inference Engine
Zero-latency AI reasoning with streaming cascades, text summarization, action item extraction, code reviews, and tone polish.
// Stream AI reasoning token by token
await window.NbhSDK.ai.stream("Synthesize key insights for project launch", (chunk) => {
process.stdout.write(chunk);
});
// Executive Summarization
const summary = await window.NbhSDK.ai.summarize(note.content);
// Extract Action Items into checklist
const todos = await window.NbhSDK.ai.actionItems(note.content);
// Code Review & Security Audit
const review = await window.NbhSDK.ai.codeReview("function verify(token){ return jwt.verify(token); }");
Sovereign Phone Whisper Speech API
Edge voice-to-text inference powered by local sovereign compute nodes with sub-50ms latency.
// Check node health status
const status = await window.NbhSDK.speech.checkStatus();
console.log("Speech Engine Status:", status.online, status.latency);
// Start live microphone stream
const session = window.NbhSDK.speech.startDictation((transcript) => {
console.log("Live Words:", transcript);
});
// Stop dictation
window.NbhSDK.speech.stopDictation();
Device Pairing Mesh API
Connect mobile phones, tablets, and desktop workstations seamlessly with instant 6-character exchange.
// Generate 6-digit pair code
const code = window.NbhSDK.devices.generatePairingCode();
// Connect to paired device
await window.NbhSDK.devices.pairWithDevice(code);
// Transmit note payload to target device
await window.NbhSDK.devices.sendNoteToDevice(code, {
title: "Cross Device Note",
content: "Synced instantly across devices."
});
Media & Canvas Drawing API
Insert drawings, responsive sketches, images, and embedded media directly into active documents.
import { NbhCanvas, NbhSDK } from "https://nbhweb.pages.dev/src/sdk.js";
// 1. Drop-in Multiplayer Collaborative Whiteboard in 1 line
const collabCanvas = NbhCanvas.mountCollab("#collab-canvas-container", {
width: "100%",
height: 480,
theme: "dark",
roomId: "room_alpha_99",
onStroke: (strokeData) => {
// Broadcast stroke to custom socket/peers if needed
},
onInsert: (dataUrl) => {
// Insert directly into document at caret position
console.log("Inserted canvas drawing to document:", dataUrl);
},
onShareNetuark: async (dataUrl) => {
// 1-click share to NeTuArk social network
await NbhSDK.canvas.shareToNetuark("feed", dataUrl, "Live canvas snapshot!");
}
});
// 2. Single-player standard mount
const canvas = NbhCanvas.mount("#my-canvas", {
theme: "dark",
initialTool: "pen" // 'pen' | 'marker' | 'eraser' | 'line' | 'rect' | 'circle'
});
// 3. Insert drawing to live NbhDocument
const doc = new NbhDocument({ title: "Math Notes" });
doc.insertDrawing(canvas.getDataUrl(), "Calculus Diagram");
await doc.save();
// Insert drawing canvas data URL into active editor note
window.NbhSDK.media.insertDrawing(canvasDataUrl);
// Share drawing directly to NeTuArk DM or Feed
await window.NbhSDK.canvas.shareToNetuark("user@netuark.pages.dev", canvasDataUrl, "Here is the architecture whiteboard");
Complete REST API Reference (CRUD Matrix)
Standard HTTP endpoints for integrating backend microservices, scripts, and third-party tools.