# SDK Overview

URL: https://docs.boldvideo.com/sdk



`@boldvideo/bold-js` is Bold's official TypeScript/JavaScript SDK. It wraps the [REST API](/api) with typed methods, handles SSE streaming for AI features, and works in Node.js and the browser. Keep your API key server-side (see [Authentication](/api/authentication)).

## Installation

<CodeBlockTabs defaultValue="npm">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="npm">
      npm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="pnpm">
      pnpm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="yarn">
      yarn
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="bun">
      bun
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="npm">
    ```bash
    npm install @boldvideo/bold-js
    ```
  </CodeBlockTab>

  <CodeBlockTab value="pnpm">
    ```bash
    pnpm add @boldvideo/bold-js
    ```
  </CodeBlockTab>

  <CodeBlockTab value="yarn">
    ```bash
    yarn add @boldvideo/bold-js
    ```
  </CodeBlockTab>

  <CodeBlockTab value="bun">
    ```bash
    bun add @boldvideo/bold-js
    ```
  </CodeBlockTab>
</CodeBlockTabs>

## Quick start

```typescript
import { createClient } from '@boldvideo/bold-js';

const bold = createClient(process.env.BOLD_API_KEY!);

// Fetch videos
const { data: videos } = await bold.videos.list();

// Stream an AI answer
const stream = await bold.ai.chat({ prompt: 'What videos cover pricing?' });
for await (const event of stream) {
  if (event.type === 'text_delta') process.stdout.write(event.delta);
}
```

Get your API key under [Settings → Developer](https://app.boldvideo.io/settings/developer). The key dialog can generate this exact snippet for you.

## Client options

```typescript
const bold = createClient('your-api-key', {
  baseURL: 'https://custom-endpoint.example.com', // optional
  debug: true,                                    // optional
  headers: { 'X-Custom': 'value' }                // optional
});
```

| Option    | Type                     | Description             |
| --------- | ------------------------ | ----------------------- |
| `baseURL` | `string`                 | Custom API endpoint     |
| `debug`   | `boolean`                | Enable debug logging    |
| `headers` | `Record<string, string>` | Additional HTTP headers |

## What's in the box

<Cards>
  <Card title="Videos" href="/sdk/videos" description="List, fetch, and search videos" />

  <Card title="Playlists" href="/sdk/playlists" description="Curated playlists with videos" />

  <Card title="Viewers & Progress" href="/sdk/viewers" description="Members, lookup, and watch progress" />

  <Card title="AI Methods" href="/sdk/ai-methods" description="Chat, search, recommendations" />

  <Card title="Streaming" href="/sdk/streaming" description="Handle SSE events" />

  <Card title="Community" href="/sdk/community" description="Posts, comments, reactions" />

  <Card title="Session Management" href="/sdk/session-management" description="Device limits & password-sharing prevention" />

  <Card title="Analytics" href="/sdk/analytics" description="Report playback from custom players" />
</Cards>

## Response conventions

* All responses are **camelCase** (`video.playbackId`, not `playback_id`)
* Resource methods return a `{ data }` envelope: `const { data: videos } = await bold.videos.list()`
* AI methods return an async-iterable stream by default; pass `stream: false` for plain JSON

## Rather start from a working app?

The [Next.js starter](/sdk/nextjs-starter) is a complete video portal built on this SDK (player, search, AI chat, dark mode), deployable in minutes.
