---
title: "Streaming API v2"
description: "What the Streaming API v2 is for, how your app, your gateway, the panel and the streaming nodes fit together, and what you need to start."
---

The Streaming API v2 lets you build your own client app (TV, mobile or web)
for an Xtream AI panel: sign in a subscriber line, browse its catalog, read
its EPG and play its channels, movies and episodes.

It is **not** the Xtream Codes API. For players that speak Xtream Codes
(IPTV Smarters, TiviMate, …) use the panel's `player_api.php` instead.

Machine-readable contract: [`openapi.yaml`](/docs/api-v2/openapi.yaml).

- [1. How it fits together](#1-how-it-fits-together)
- [2. Quickstart: run a gateway](/docs/streaming-api-v2-gateway)
- [3. Conventions](/docs/streaming-api-v2-conventions)
- [4. Errors](/docs/streaming-api-v2-errors)
- [5. Sessions](/docs/streaming-api-v2-sessions)
- [6. Endpoints](/docs/streaming-api-v2-endpoints)
- [7. Playback](/docs/streaming-api-v2-playback)
- [8. Checklist for a well-behaved app](/docs/streaming-api-v2-checklist)

## 1. How it fits together

```
 your app ──HTTPS──► your gateway ──HTTPS──► panel (API)
    │
    └──────────── playback, direct ────────► streaming nodes
```

- **Your app never talks to the panel.** It talks to a **gateway**, a small
  reverse proxy that you run. The panel only answers gateways registered on
  the API key; any other origin gets a plain `404` page, as if the API did not
  exist.
- **The API key lives in the gateway**, never in the app. The gateway adds it
  to every request.
- **Playback does not go through the gateway.** The app plays straight from
  the panel's streaming nodes, with short-lived tokens it builds itself
  (section 7).

What you need from the reseller who gives you access:

1. An **API key** (`X-API-KEY`), created in the panel.
2. Your gateway's **public IP** (or CIDR) registered on that key
   ("Authorized gateways").
3. The panel's **API base URL**, e.g. `https://panel.example.com/api/v2/`.

A key without global access only serves the reseller's own lines.
