# Ads

### Stream Ads

<mark style="color:blue;">`GET`</mark> `http://api.komoverse.dev/v2/stream-ads`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| x-api-key<mark style="color:red;">\*</mark>     | String | Api key      |
| Authorization<mark style="color:red;">\*</mark> | Bearer | Token bearer |

{% tabs %}
{% tab title="200: OK Successfull Showing List Ads" %}

```json
{
    "status": "Success",
    "data": [
        {
            "title_ads": "One Heart",
            "business_name": "Honda",
            "website_ads": "https://www.astra-honda.com/",
            "target_country_ads": [
                "AFG",
                "ARG",
                "AUS"
            ],
            "id_ads": "3a80a5792c584ec1a1016019de33957b",
            "cloudflare_watch_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/watch",
            "cloudflare_hls_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/manifest/video.m3u8",
            "cloudflare_dash_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/manifest/video.mpd",
            "cloudflare_mp4_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/downloads/default.mp4"
        },
        {
            "title_ads": "Iphone 14 Pro",
            "business_name": "Apple",
            "website_ads": "https://www.apple.com/",
            "target_country_ads": [
                "AFG",
                "ARG",
                "AUS",
                "IDN",
                "PHL"
            ],
            "id_ads": "035831e9a68b42629d57e0f18ed35d3c",
            "cloudflare_watch_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/watch",
            "cloudflare_hls_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/manifest/video.m3u8",
            "cloudflare_dash_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/manifest/video.mpd",
            "cloudflare_mp4_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/downloads/default.mp4"
        }
    ]
}
```

{% endtab %}

{% tab title="403: Forbidden Error not fill x-api-key" %}

```json
{
    "status": "error",
    "messages": {
        "apiKeyRequired": "An API key is required to perform this request. If you wish to use the KOMO API in your application, contact the Komoverse team to reach out for an agreement."
    }
}
```

{% endtab %}

{% tab title="403: Forbidden Error not fill authorization bearer token" %}

```json
{
    "status": "error",
    "messages": {
        "tokenRequired": "A login token is required to perform this request."
    }
}
```

{% endtab %}
{% endtabs %}

### Update Click and Views Ads

<mark style="color:orange;">`PUT`</mark> `http://api.komoverse.dev/v2/stream-ads/{id_ads}`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| x-api-key<mark style="color:red;">\*</mark>     | String | API key      |
| Authorization<mark style="color:red;">\*</mark> | Bearer | Bearer Token |

#### Request Body

| Name                                    | Type    | Description  |
| --------------------------------------- | ------- | ------------ |
| views<mark style="color:red;">\*</mark> | Integer | Number views |
| click<mark style="color:red;">\*</mark> | Integer | Number click |

{% tabs %}
{% tab title="201: Created Successfully update click and views" %}

```json
{
    "message": "Update Ads Successfully!",
    "status": "success"
}
```

{% endtab %}

{% tab title="400: Bad Request Missing a body request" %}

```json
{
    "status": "error",
    "message": {
        "views": [
            "The views field is required."
        ],
        "click": [
            "The click field is required."
        ]
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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://docs.komoverse.io/player-api-reference/ads.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.
