# :icon-device-camera-video: Streaming for Partners

This page is for partners who show MangoPlay live tables inside their own product.
It is not an operator integration: there are no players and no wallet here, only the
video and what is happening at the table.

The full contract, with schemas and copy-ready examples, is published as an OpenAPI
specification: [Partner Streaming API reference](https://api-docs.mangoplay.com/partner-stream.html).

## What you get

| | |
| --- | --- |
| **Room list** | `GET /api/v1/open/partner/rooms` — every room that is live, each with a ready-to-play signed stream URL |
| **Live events** | a WebSocket that pushes round opened, betting closed, result, round cancelled, and room maintenance |

MangoPlay issues you a `PartnerCode` and a `PartnerSecret`. Both go in the HTTP
headers on REST calls, and in the handshake on the WebSocket. Keep the secret on your
server — anyone holding it can pull your stream links.

## A working integration, in order

1. **Call `/rooms`** and render what comes back. A room with no `stream` field exists
   but has no video configured yet; a room with `isBreak: true` is between dealers and
   the video keeps flowing.
2. **Open the WebSocket.** On connect you receive events for every room you may see,
   including rooms added later. Narrow it with `subscribe` if you only want some.
3. **Refresh the links before they expire.** `stream.expire` is the exact epoch second
   each link dies (`streamTtlSec` is 300 today). Call `/rooms` again before then and
   swap the URL in your player. An expired link is rejected by the CDN, not renewed.
4. **Drive your table UI from the events,** not from a poll.

## Two things that decide whether your integration behaves

!!!warning Count down locally, do not wait for the event
`partner.round.opened` carries `bettingEndTime`. Close your betting UI from that
timestamp. We also send `partner.round.betting_closed` when the time arrives — or
earlier, if the dealer closes the round early — but treat it as a convenience. If it
arrives late or not at all after a restart or a network blip, your countdown is still
correct.
!!!

!!!warning Expect the same event twice
A duplicate is possible on our side where a lost event is not, so we chose duplicates.
De-duplicate on `roundNo` together with `event`.
!!!

## When something does not work

Every authentication failure answers the same way — `404` with
`{"code": 4040, "message": "Partner not found."}` — whether the code is unknown, the
secret is wrong, or the account is suspended. A different answer per case would let
anyone probe which partner codes exist.

Our side logs which one it actually was. If you are stuck, send us the time of the
attempt and your `PartnerCode` and we can tell you: [contact us](https://mangoplay.com/contact-us/).
