# Quickstart

> **TL;DR** — **Part A** (about 5 minutes, server only): create a key, read your configuration, list your catalog. Then [play from your own video space](https://docs.wandura.ai/developers/quickstart#own-space), which is how new integrations play films. **Part B** is for apps already on the frozen ticket path: get a first ticket and play an episode on a real phone.

Every command in Part A uses one environment variable, `WANDURA_API_KEY`. Part B adds `UNION_INFO` and `DRM_KEK`, copied from your app.

## Before you start
- A member account with the **Admin** or **Developer** role in your organisation on [partner.wandura.ai](https://partner.wandura.ai). No access yet? See [Before you start](https://docs.wandura.ai/developers/before-you-start#get-onboarded).
- At least one film licensed to your organisation, or the catalog is empty.
- To play films: your own video space set up by Wandura, and the Player SDK in your app with a licence for your app IDs. See [Your own video space](https://docs.wandura.ai/developers/concepts/own-space) and [Player SDK](https://docs.wandura.ai/developers/player-sdk).

## Part A — your first calls (server only)
### Step 1: Create a key
**Needs:** the Admin or Developer role.

1. Sign in to partner.wandura.ai and open **Developers** → **Create a key**.
2. Label it, for example `quickstart`, and pick **Sync catalog to your CMS**. The key gets `metadata:read`: it reads metadata and cannot play any video.
3. Select **Create key** and copy it now: it is shown once.

```bash
export WANDURA_API_KEY="wnd_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

**If it fails:** no **Developers** page means your role is not Admin or Developer: ask your organisation Admin. **Next:** step 2.

### Step 2: Read your configuration
**Needs:** the key from step 1 (any scope works).

```bash
curl -s https://www.wandura.ai/api/delivery/v1/config \
  -H "Authorization: Bearer $WANDURA_API_KEY"
```

**Expect** `200` with your key's scopes, your limits and the API version your key is pinned to (shortened):

```json
{
  "api": { "status": "beta", "version": "2026-10-02", "pinned_version": "2026-10-02", "latest_version": "2026-10-02" },
  "key": { "scopes": ["metadata:read"] },
  "rate_limits": { "window_seconds": 60, "doors": { "catalog": { "limit": 3000, "unit": "requests" } } }
}
```

**If it fails:** `401` = the variable is empty or the key was mistyped (`echo ${#WANDURA_API_KEY}` should print 41). `503` = retry after `Retry-After`. **Next:** step 3.

### Step 3: List your catalog
**Needs:** a key with `metadata:read`.

```bash
curl -s https://www.wandura.ai/api/delivery/v1/catalog \
  -H "Authorization: Bearer $WANDURA_API_KEY"
```

**Expect** `200` with `films` (in display order) and `episodes` (shortened):

```json
{
  "films": [
    { "id": "3f6c1a52-8d0e-4b7a-9c21-5e4f2a7b9d10", "title": "The Heiress Returns", "slug": "the-heiress-returns", "display_order": 10, "free_until_episode": 1 }
  ],
  "episodes": [
    { "id": "b2a4d6e8-1c3f-4a5b-8d7e-9f0a1b2c3d4e", "film_id": "3f6c1a52-8d0e-4b7a-9c21-5e4f2a7b9d10", "episode_no": 1, "status": "published", "stream_ready": true, "poster_url": null }
  ]
}
```

Pick an episode with `"stream_ready": true` and note its `id` for Part B. Large catalog? Page it with `limit`; see [Catalog sync](https://docs.wandura.ai/developers/guides/catalog-sync).

**If it fails:** an **empty** `200` (`"films": []`) means no licence is active for your organisation yet, not a broken key: ask Wandura in your team's Discord channel. `403` = the key lacks `metadata:read`. **Next:** build the [catalog sync job](https://docs.wandura.ai/developers/guides/catalog-sync), or go on to [Play from your own video space](https://docs.wandura.ai/developers/quickstart#own-space).

## Play from your own video space
Your server does not ask Wandura for a ticket. Once Wandura has set up your space, your playback domain and your space key:

1. **On your server**, list the playlists and videos in your space with your space key, and get playback info for an episode. The links sit on your own playback domain.
2. **In your app**, play the link: films through the Player SDK, fitness clips with any standard player.
3. **Join the metadata**: [Get series metadata](https://docs.wandura.ai/developers/reference/series-get) gives each episode's video ID in your space (`episodes[].vid`), with the cast and artwork, using the key from step 1. From the space side, each copied episode carries `wd:series:<code>` and `wd:ep:<nn>` tags.

Those calls are the video platform's own; ask in your team's Discord channel if you need help with them. Formats, your key's rights, usage and metadata: [Your own video space](https://docs.wandura.ai/developers/concepts/own-space).

## Part B — first ticket on a real device (frozen path)
> **This path is frozen.** It keeps working and apps already on it need change nothing, but Wandura is no longer adding to it. New integrations should use [your own video space](https://docs.wandura.ai/developers/concepts/own-space), where your app reads straight from the video platform in your organisation's space. New playback keys can no longer be created on **Developers**; existing ones keep working.

**Needs:** your app on a real iPhone or Android phone with the Player SDK started and its licence check passed, and your playback key on your backend. Simulators and emulators do not produce usable device values.

> **Warning:** Every ticket Wandura issues is recorded, and with `"intent": "play"` it counts as a view of the film. Do these steps with a real device and a real test viewer, not with made-up values.

### Step 4: Read the device values in your app
In your app, after the Player SDK has started, read the **device ID** and the **device public key** (the exact calls are in the Player SDK guide on the portal), and log them once in a debug build. On your backend shell:

```bash
export UNION_INFO="<device ID logged by your debug build>"
export DRM_KEK="<device public key logged by your debug build>"
```

**If it fails:** a value such as `(null)` or an empty string means the SDK had not started or its licence check failed. See [Player SDK](https://docs.wandura.ai/developers/player-sdk#common-problems).

### Step 5: Request a ticket
From your backend, for the episode you picked in step 3:

```bash
curl -s -X POST https://www.wandura.ai/api/delivery/v1/playback \
  -H "Authorization: Bearer $WANDURA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "episode_id": "b2a4d6e8-1c3f-4a5b-8d7e-9f0a1b2c3d4e",
    "union_info": "'"$UNION_INFO"'",
    "drm_kek": "'"$DRM_KEK"'",
    "viewer_ref": "qa-viewer-1:device-1",
    "intent": "play"
  }'
```

If `UNION_INFO` and `DRM_KEK` are empty, Wandura answers `409` `sdk_required` and issues nothing.

**Expect** `200`:

```json
{
  "vid": "v0d2f8c1a9e4b7",
  "play_auth_token": "placeholder-play-token",
  "expires_at": "2026-10-02T12:30:00.000Z",
  "protection": "private-encrypted",
  "subtitles": [
    { "lang": "en", "url": "https://cdn.example.com/subtitles/ep1-en.vtt", "format": "webvtt" }
  ]
}
```

**If it fails:** `400` `invalid_device_info` = a device value looks empty (`fields` says which). `403` `not_entitled` = the film is not licensed to this organisation. `404` `not_ready` = wrong `episode_id`, or the episode is not ready. All codes: [Errors](https://docs.wandura.ai/developers/concepts/errors#playback-errors).

### Step 6: Play it
Return `vid`, `play_auth_token` and `subtitles` to the same device. There, give the video ID and the token to the Player SDK and start playback; the SDK fetches the encrypted stream and its keys itself. A standard HLS player cannot play these episodes: it loads the playlist and stalls.

**Expect** the episode to start within a few seconds. **If it fails:** see [Player SDK · common problems](https://docs.wandura.ai/developers/player-sdk#common-problems). The ticket expires at `expires_at` (30 minutes); asking again for the same episode on the same device with the same `viewer_ref` returns the same ticket while it has more than 5 minutes left.

## Next steps
- [Your own video space](https://docs.wandura.ai/developers/concepts/own-space): how your app plays films and fitness clips.
- [Integration roadmap](https://docs.wandura.ai/developers/integration-guide): the full path to go-live.
- [Playback flow and paywall](https://docs.wandura.ai/developers/guides/playback-flow) (frozen path): the backend endpoint your app calls, with code.
- [Security](https://docs.wandura.ai/developers/concepts/security): before any key reaches a server you share.
