TAŇBA-OOH Разработчикам

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, monthday
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

ИмяТипОбязательныйОписаниеПример
fromstring (date)даFirst day of the answer."2026-09-01"
tostring (date)даLast day of the answer."2026-09-30"
grainstringдаLength of one period. day, month
measuredbooleanдаAlways false while the inputs of the model are assumptions and not counts.false
itemsarray of AudienceEstimateдаOne row for each period, structure and approval with plays.
items[].periodstringдаThe day (YYYY-MM-DD) or the month (YYYY-MM), by the grain."2026-09"
items[].structurestringдаCode of the structure."ALM-0012"
items[].approval_numberstringдаNumber of the approval the plays belong to."TNB-2026-000123"
items[].playsintegerдаPlays in the period.14210
items[].complete_playsintegerдаPlays that ran to the end; only these enter the estimate.13980
items[].impressionsnumberдаEstimated people who noticed the screen, from the model named in model. Not measured.21870.4
items[].modelstring | nullдаCode of the model version that gave the estimate; null when no model exists."audience-v1-draft"
items[].model_statusstring | 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))
}