SDK Installation
Install and configure the Scribeberry SDK for Node.js and browser environments.
The @scribeberry/sdk package is a universal TypeScript SDK that works in both Node.js and browser environments. It provides a type-safe client for the entire Scribeberry API surface.
Installation
Requirements
- Node.js 18 or later (uses native
fetchandWebSocket) - TypeScript 5.0+ recommended (full type declarations included)
- Browsers: All modern browsers (Chrome, Firefox, Safari, Edge)
Basic Setup
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | API key (sk_test_*, sk_live_*) or temp token (sb_rt_*) |
baseUrl | string | https://api.scribeberry.com | API base URL |
timeout | number | 30000 | Request timeout in milliseconds |
Runtime Behavior
The SDK automatically adapts to its environment:
Node.js
- Uses native
fetch(Node 18+) withcross-fetchfallback - Uses the
wspackage for WebSocket connections - Full API access (REST + WebSocket)
Browser
- Uses native
fetchandWebSocket - Warns if a permanent API key (
sk_*) is detected createToken()is blocked (server-only operation)- Temp tokens (
sb_rt_*) restrict access to WebSocket only
Package Exports
Without the SDK (cURL / HTTP)
If you prefer to call the API directly:
All REST endpoints are documented in the API Reference.