> This page is for Platform.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mediakind.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mediakind.ferndocs.com/_mcp/server.

# Python SDK

## Install

```bash
pip install mediakind
```

## 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.

```python
import os
from mediakind import MediaKind

client = MediaKind(api_token=os.environ["MEDIAKIND_API_TOKEN"])
```

An asynchronous client is available with the same surface:

```python
import asyncio, os
from mediakind import AsyncMediaKind

client = AsyncMediaKind(api_token=os.environ["MEDIAKIND_API_TOKEN"])

async def main() -> None:
    assets = await client.media.assets.list()
    print(assets)

asyncio.run(main())
```

## Namespaces

Every API is reachable from the one client. The first attribute 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        |

```python
assets = client.media.assets.list()
devices = client.fleets.devices.list()
services = client.vos.playout_backend.list()
```

## Error handling

Failed requests raise a typed error carrying the HTTP status and the parsed body.

```python
from mediakind.core import ApiError

try:
    client.media.assets.get("does-not-exist")
except ApiError as err:
    print(err.status_code, err.body)
```

> **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-python-sdk).