# Android TV API

{% columns %}
{% column %}

<figure><img src="/files/2aUK1DDjmBsts0gST3ny" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/OMG6XqCQC1YTOSk0N2qw" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

Чтобы передать подписку на телевизор пользователя, необходимо знать 5-значный код, сгенерированный устройством. Этот код отображается при первом запуске приложения на Android TV — достаточно выбрать пункт **Web Import**.

После этого необходимо выполнить **POST-запрос** на адрес:\
`https://check.happ.su/sendtv/[uid]`\
где **\[uid]** — это 5-значный код, отображённый на экране телевизора.

Запрос должен быть в формате JSON:

```json
{ "data": "base64" }
```

Значение `base64` — это конфигурация сервера или подписки, закодированная в формате Base64.

#### Пример запроса с использованием `curl`:

```bash
curl -X POST https://check.happ.su/sendtv/QWET5 \
  -H "Content-Type: application/json" \
  -d '{"data":"aHR0cHM6Ly90ZXN0LXN1YnMuaGFwcC5zdS9wYWdlLnBocD9pZD14Y3huV254Uw=="}'
```

В этом примере:

* `QWET5` — это UID телевизора (тот самый 5-значный код).
* Значение поля `"data"` — это пример конфигурации, закодированной в Base64


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.happ.su/main/ru/dev-docs/android-tv-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
