Estimated audience of the complete plays
GET /api/v1/stats/audience
https://app.tanba-ooh.kz/api/v1/stats/audience
Технический текст справочника написан на английском.
Scope read:stats. Own organisation; the authority sees the city. For each period, structure and approval: the plays, the complete plays and an estimate of the people who noticed the screen. The estimate is not measured: it comes from a versioned model whose inputs are assumptions until counted figures replace them, and it is information only. The bill counts plays. Incomplete plays add nothing to the estimate. Days are Asia/Almaty days; a month uses the model that applies to it.
Аутентификация
Ключ API в заголовке Authorization или сессия консоли.
Право доступа: read:stats
Параметры
| Имя | Где | Тип | Обязательный | Описание | Пример |
|---|---|---|---|---|---|
from | запрос | string (date) | нет | First day (default 29 days back). | 2026-09-01 |
to | запрос | string (date) | нет | Last day (default today). | 2026-09-30 |
grain | запрос | string | нет | Length of one period: day or month. day, month | day |
structure | запрос | string | нет | Code of one structure. | ALM-0012 |
approval | запрос | string | нет | Number of one approval. | TNB-2026-000123 |
Ответы
200 The estimate for each period, structure and approval.
application/json
| Имя | Тип | Обязательный | Описание | Пример |
|---|---|---|---|---|
from | string (date) | да | First day of the answer. | "2026-09-01" |
to | string (date) | да | Last day of the answer. | "2026-09-30" |
grain | string | да | Length of one period. day, month | |
measured | boolean | да | Always false while the inputs of the model are assumptions and not counts. | false |
items | array of AudienceEstimate | да | One row for each period, structure and approval with plays. | |
items[].period | string | да | The day (YYYY-MM-DD) or the month (YYYY-MM), by the grain. | "2026-09" |
items[].structure | string | да | Code of the structure. | "ALM-0012" |
items[].approval_number | string | да | Number of the approval the plays belong to. | "TNB-2026-000123" |
items[].plays | integer | да | Plays in the period. | 14210 |
items[].complete_plays | integer | да | Plays that ran to the end; only these enter the estimate. | 13980 |
items[].impressions | number | да | Estimated people who noticed the screen, from the model named in model. Not measured. | 21870.4 |
items[].model | string | null | да | Code of the model version that gave the estimate; null when no model exists. | "audience-v1-draft" |
items[].model_status | string | null | да | Whether that version is a draft (placeholder assumptions) or published. draft, published, <nil> |
Пример
{
"from": "2026-09-01",
"to": "2026-09-30",
"grain": "month",
"measured": false,
"items": [
{
"period": "2026-09",
"structure": "ALM-0012",
"approval_number": "TNB-2026-000123",
"plays": 14210,
"complete_plays": 13980,
"impressions": 21870.4,
"model": "audience-v1-draft",
"model_status": "draft"
}
]
}
Ошибки
Ошибки приходят документом problem (application/problem+json) со стабильным полем code.
| Статус | Значение |
|---|---|
| 401 | Нет действительной сессии или ключа API (unauthenticated, session_expired, invalid_api_key). |
| 403 | Роль или право ключа этого не допускает (forbidden, key_scope_denied, key_route_denied). |
| 422 | Ошибки полей (validation_failed). |
| default | Ошибка в виде документа problem. |
Примеры кода
curl
curl 'https://app.tanba-ooh.kz/api/v1/stats/audience' \
-H 'Authorization: Bearer YOUR_API_KEY'
Python
import requests
response = requests.get(
"https://app.tanba-ooh.kz/api/v1/stats/audience",
headers={
"Authorization": "Bearer YOUR_API_KEY",
},
)
print(response.status_code, response.text)
Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://app.tanba-ooh.kz/api/v1/stats/audience", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(data))
}