# Android TV API

{% columns %}
{% column %}

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

{% column %}

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

To transfer a subscription to a user’s TV, you need to know the 5-digit code generated when the app is first launched on the Android TV. The user can get this code by selecting the **Web Import** option in the app interface.

After that, you must send a **POST** request to:\
`https://check.happ.su/sendtv/[uid]`\
where **\[uid]** is the 5-digit code displayed on the TV.

The request body should be in JSON format:

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

The `data` field contains the server or subscription configuration encoded in **Base64**.

#### Example `curl` request:

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

In this example, `12345` is the TV’s UID, and `data` holds the Base64-encoded configuration string.


---

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