# Welcome!

{% hint style="info" %}
Every endpoint is limited to one per minute per user due to internal limitations, thanks for your understanding.&#x20;
{% endhint %}

## <mark style="color:$primary;">Welcome to OQ API</mark>

Welcome to the OQ API. Get daily calculated broadcast measurements. Designed to give you a detailed insight into the world of television. Get the Data basis to calculate your return of investment on a global scale.

## <mark style="color:$primary;">Want to jump right in?</mark>

Feeling like an eager beaver? Jump in to the quick start docs and get making your first request:

{% content-ref url="/pages/2I12ruV9f6qyHU6qbII3" %}
[Quick Start](/quick-start)
{% endcontent-ref %}

## <mark style="color:$primary;">Want to deep dive?</mark>

Dive a little deeper and start exploring our API reference to get an idea of everything that's possible with the API:

{% content-ref url="/pages/KkASnjTqviwAy9C9tdX9" %}
[tv-api.oloqiqi.com](/reference/tv-api.oloqiqi.com)
{% endcontent-ref %}


# Quick Start

Learn in one step how to use the API on a basic level

{% hint style="info" %}
**Good to know:** A quick start guide can be good to help folks get up and running with your API in a few steps. Some people prefer diving in with the basics rather than meticulously reading every page of documentation!
{% endhint %}

## <mark style="color:$primary;">Get your API keys</mark>

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

You can generate an API key from your Dashboard at any time.

## <mark style="color:$primary;">First curl request</mark>

The API generally works via curl requests. Most endpoints need the POST method to work. Later youll get a detailed report.

{% tabs %}
{% tab title="Python" %}

```python
# Install via pip
pip install requests

# Use requests to initialize curl
def fetch_calculated_tv_data(api_key, keywords, channels, broadcast_id):

    url = f"http://tv-api.oloqiqi.com/kpis/{broadcast_id}"
    headers = {
        "Content-Type": "application/json",
        'Authorization': f'Bearer {api_key}'
    }
    
    response = requests.post(url, headers=headers, json=payload)
    
    if response.status_code == 200:
        return response.json()  # Successfully retrieved data
    else:
        return response.json()  # An error occurred
```

{% endtab %}

{% tab title="Curl" %}

<pre class="language-markup" data-full-width="true"><code class="lang-markup"><a data-footnote-ref href="#user-content-fn-1">curl</a> -X GET http://api.oloqiqi.com/kpi/ broadcast ID \
-H "Content-Type: application/json" \
-H "Authorization: Bearer API_KEY" \
</code></pre>

{% endtab %}
{% endtabs %}

[^1]:


# tv-api.oloqiqi.com

Dive into the specifics of each API endpoint by checking out our complete documentation.

{% hint style="info" %}
**Token:** The output is automatically tailored for your Token. Info endpoints like /countries will only return the data you have access to.
{% endhint %}

## <mark style="color:$primary;">TV KPIs</mark>

Get daily calculated broadcast measurements. Designed to give you a detailed insight into the world of television. Get the Data basis to calculate your return of investment on a global scale.

{% content-ref url="/pages/bOy0ZSRGFrSg2wgYLABJ" %}
[/kpis](/reference/tv-api.oloqiqi.com/kpis)
{% endcontent-ref %}

## <mark style="color:$primary;">TV broadcasts</mark>

Get the info about what broadcasts are available.

{% content-ref url="/pages/zKoINrplv5yoOiNc6Hqf" %}
[/broadcasts](/reference/tv-api.oloqiqi.com/broadcasts)
{% endcontent-ref %}

## <mark style="color:$primary;">TV channels</mark>

Get all the channels availeble.

{% content-ref url="/pages/XosVedFFE4QDWm1Tzb40" %}
[/channels](/reference/tv-api.oloqiqi.com/channels)
{% endcontent-ref %}

## <mark style="color:$primary;">Countries</mark>

Get all the countries available.

{% content-ref url="/pages/W39OHPXQN5kUwV7ooPSn" %}
[/markets](/reference/tv-api.oloqiqi.com/markets)
{% endcontent-ref %}


# /kpis

the Endpoint /kpis

## <mark style="color:$primary;">Get measured tv broadcast data from all over the place !</mark>

<mark style="color:green;">`GET`</mark> `/kpis/<broadcast_id>`

**Headers**

| Name          | Value                   |
| ------------- | ----------------------- |
| Content-Type  | `application/json`      |
| Authorization | Bearer `<Your API key>` |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "data": [
    {
      "c_ave_eur":94774.0,
      "channel_name":"COMEDY CENTRAL",
      "channel_type":"Entertainment",
      "country_en":"Netherlands",
      "desc":"Homer helpt Moe na een eenzame Valentijnsdag met het vinden van een vriendin. Moe is wanhopig als blijkt dat de dames zich meer tot Homer aangetrokken voelen. Marge besluit de middelbare leeftijd te omarmen, nadat ze haar eerste grijze haar ontdekt.",
      "cR":0.18898,
      "c_impressions":9.449,
      "iso_a2":"NL",
      "item_duration":1500,
      "c_media_index":0.283,
      "start_local":"Tue, 19 Mar 2024 22:55:00 GMT",
      "sub_title":"The Blue and the Gray",
      "title":"The Simpsons"
    }
  ],
  "message": "Matching content found",
  "success": true
}

```

{% endtab %}

{% tab title="400" %}

```json
{
    "error":"Unauthorized"
}
```

{% endtab %}
{% endtabs %}


# /broadcasts

## <mark style="color:$primary;">Get rate cards for every channel availeble</mark>

<mark style="color:green;">`GET`</mark> `/broadcasts/<channel_id>`

**Headers**

| Name          | Value                   |
| ------------- | ----------------------- |
| Content-Type  | `application/json`      |
| Authorization | Bearer `<Your API key>` |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{ 
  "data": [
    {
      "channel_name":"COMEDY CENTRAL",
      "channel_type":"Entertainment",
      "country_en":"Netherlands",
      "desc":"Homer raakt geobsedeerd door een comedy uit de jaren tachtig, en begint zich te gedragen als de vader uit de serie. Homer's vaderlijke adviezen pakken echter rampzalig uit, als Bart besluit de nucleaire geheimen van zijn vader aan China te verkopen.",
      "iso_a2":"NL",
      "item_duration":1800,
      "start_local":"Mon, 18 Mar 2024 23:20:00 GMT",
      "sub_title":"Homer the Father",
      "title":"The Simpsons"
       }
  ],
  "message": "Matching content found",
  "success": true
}
  
```

{% endtab %}

{% tab title="400" %}

```json
{   
    "error":"Unauthorized"
}
```

{% endtab %}
{% endtabs %}


# /channels

## <mark style="color:$primary;">Get all the channels availeble</mark>

<mark style="color:green;">`GET`</mark> `/channels/<iso_a2>/all`

**Headers**

| Name          | Value                   |
| ------------- | ----------------------- |
| Content-Type  | `application/json`      |
| Authorization | Bearer `<Your API key>` |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "data": [
    {
      "channel": "ARD DAS ERSTE",
      "country_en": "Austria",
      "iso_a2": "AT"
    },
    {
      "channel": "ARD Das Erste",
      "country_en": "Germany",
      "iso_a2": "DE"
    }
  ],
  "message": "Matching content found",
  "success": true
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "error":"Unauthorized"
}
```

{% endtab %}
{% endtabs %}


# /markets

## <mark style="color:$primary;">Get all the countries and markets availeble</mark>

<mark style="color:green;">`GET`</mark> `/countries`

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "data": [
    {
      "country_en": "Germany",
      "iso_a2": "DE"
    },
    {
      "country_en": "USA",
      "iso_a2": "US"
    }
  ],
  "message": "Matching content found",
  "success": true
}

```

{% endtab %}

{% tab title="400" %}

```json
{
    "error":"Unauthorized"
}
```

{% endtab %}
{% endtabs %}


