ScribeberryScribeberry Docs

Authentication

API keys, temporary tokens, and how to authenticate with the Scribeberry API.

Scribeberry uses API key authentication for all API access. There are two types of credentials depending on your use case.

πŸ”‘ Need an API key? Go to Console β†’ Settings β†’ API Keys to create or manage your project's keys.

API Keys

Every project gets API keys that start with sk_test_ (sandbox) or sk_live_ (production). These are permanent, full-access keys that should only be used server-side.

Using API Keys

Include your API key in the Authorization header:

curl -H "Authorization: Bearer sk_test_abc123..." \
  https://sandbox.api.scribeberry.com/api/v1/templates

With the SDK:

import { Scribeberry } from '@scribeberry/sdk';
 
const sb = new Scribeberry({ apiKey: 'sk_test_abc123...' });

Key Prefixes

PrefixEnvironmentUsage
sk_test_SandboxDevelopment and testing
sk_live_ProductionLive production traffic
sb_rt_BothTemporary realtime token (see below)

🚫 Danger: Never expose sk_test_ or sk_live_ keys in client-side code, browser JavaScript, mobile apps, or public repositories. These keys have full access to your project.

Temporary Realtime Tokens

For browser-side realtime transcription, you need a short-lived token that's safe to expose to end users. This is the sb_rt_ token.

How it works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   1. createToken()    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your Server β”‚ ─────────────────────▢│  Scribeberry    β”‚
β”‚  (sk_live_)  β”‚ ◀─────────────────────│  API            β”‚
β”‚              β”‚   2. sb_rt_token       β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ 3. Pass token                           β”‚
       β–Ό                                         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   4. WebSocket + audio          β”‚
β”‚  Browser     β”‚ ───────────────────────────────▢│
β”‚  (sb_rt_)    β”‚ ◀───────────────────────────────│
β”‚              β”‚   5. Transcript events           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                  β”‚
  1. Your server calls POST /api/v1/realtime/tokens with your API key
  2. Scribeberry returns a temporary sb_rt_ token (valid for up to 1 hour)
  3. Your server passes the token to the browser
  4. The browser connects via WebSocket using the temp token
  5. Transcription events stream back in real-time

Creating a Token (Server-Side)

server.ts
import { Scribeberry } from '@scribeberry/sdk';
 
const sb = new Scribeberry({ apiKey: 'sk_live_...' });
 
// Create a token valid for 1 hour
const { token, wsUrl, expiresAt } = await sb.realtime.createToken({
  expiresInSeconds: 3600,
});
 
// Return to your frontend
res.json({ token, wsUrl, expiresAt });

The easiest approach: provide a getRealtimeToken callback. The SDK handles token fetching and auto-refresh.

import { Scribeberry } from '@scribeberry/sdk';
 
const sb = new Scribeberry({
  getRealtimeToken: async () => {
    const res = await fetch('/api/realtime-token', { method: 'POST' });
    return res.json(); // { token, expiresAt }
  },
});
 
const session = sb.realtime.transcribe({ language: 'en-US' });
session.on('final', (segment) => console.log(segment.text));

Using the Token (Browser β€” Manual)

Alternatively, pass a static token directly:

import { Scribeberry } from '@scribeberry/sdk';
 
const sb = new Scribeberry({ apiKey: 'sb_rt_abc123...' });
 
const session = sb.realtime.transcribe({ language: 'en-US' });
session.on('final', (segment) => console.log(segment.text));

Token Restrictions

Temporary tokens have intentional limitations:

CapabilityAPI Key (sk_*)Temp Token (sb_rt_*)
REST API (templates, notes)βœ…βŒ
WebSocket realtime transcriptionβœ…βœ…
Create other tokensβœ…βŒ
Maximum lifetimePermanent1 hour
Safe for browserβŒβœ…

Key Management

Rotating Keys

You can rotate API keys from the Scribeberry Console β†’ Settings β†’ API Keys. When you rotate a key:

  1. A new key is generated immediately
  2. The old key remains valid for a grace period
  3. Update your server configuration with the new key
  4. The old key is automatically revoked after the grace period

Best Practices

  1. Use environment variables β€” never hardcode keys in source code
  2. Separate keys per environment β€” use sk_test_ for development, sk_live_ for production
  3. Use temp tokens for browsers β€” never send permanent keys to the client
  4. Monitor usage β€” check the Console dashboard for unusual activity
  5. Rotate regularly β€” rotate production keys every 90 days

On this page