> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://mediakind.ferndocs.com/platform/sdk-typescript/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mediakind.ferndocs.com/_mcp/server. # TypeScript SDK ## Install **`npm`** ```bash title="npm" npm install @mediakind/sdk ``` **`pnpm`** ```bash title="pnpm" pnpm add @mediakind/sdk ``` **`yarn`** ```bash title="yarn" yarn add @mediakind/sdk ``` ## Authenticate The client reads a bearer token. Create one in the mk.io web application — see [API tokens](/mkio/how-to/managing-your-organization/api-tokens) — and keep it in the environment rather than in source. ```typescript import { MediaKind } from "@mediakind/sdk"; const client = new MediaKind({ apiToken: process.env.MEDIAKIND_API_TOKEN, }); ``` ## Namespaces Every API is reachable from the one client. The first segment selects the API: | Namespace | API | | ----------------------- | ----------------------- | | `client.media` | mk.io Media API | | `client.live` | mk.io Live API | | `client.management` | mk.io Management API | | `client.templates` | mk.io Templates API | | `client.channels` | Beam Channels API | | `client.fleets` | Beam Fleets API | | `client.infrastructure` | Beam Infrastructure API | | `client.vos` | Harmonic VOS API | ```typescript // list on-demand assets const assets = await client.media.assets.list(); // inspect a Beam device fleet const devices = await client.fleets.devices.list(); // drive a VOS playout backend const services = await client.vos.playoutBackend.list(); ``` ## Error handling Failed requests throw a typed error carrying the HTTP status and the parsed body. ```typescript import { MediaKindError } from "@mediakind/sdk"; try { await client.media.assets.get("does-not-exist"); } catch (err) { if (err instanceof MediaKindError) { console.error(err.statusCode, err.body); } throw err; } ``` > **Note** > > This SDK is generated from the same specs that produce this site's API > reference, so the two never drift. See the > [source repository](https://github.com/fern-demo/harmonic-mediakind-ts-sdk). > Install, authenticate, and call every MediaKind API from one client.