Analytics
Run a BI dataset (JSON or CSV)
GET
/api/v1/analitico/{dataset}https://tenka.app.br/api/v1/analitico/{dataset}Runs a BI dataset with the same governance as the dashboard: the key owner's row rules before any filter, value columns only with See Values, declared row ceiling. Returns JSON or CSV (Power BI and Metabase read it directly).
With formato=csv the response is text/csv (BOM, comma, doubled quotes), not JSON.
Key scope
Any key of the account (read is enough).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Authorization | header | string | yes | Bearer followed by the key. Alternative: X-API-Key header. |
dataset | path | string | yes | Dataset key (see the analytics catalog). |
formato | query | string | no | json (default) or csv — CSV with BOM, comma, doubled quotes; Power BI and Metabase read it directly. |
colunas | query | string | no | Keys or labels separated by commas; empty = the dataset columns. Company-created fields (cc_*) only when asked by name; sensitive ones only with See Values. |
filtros | query | string | no | campo=valor;campo2>valor2;campo3~contem (also <, >=, <=). Filterable columns only; the rest comes back in ignorados. |
agrupamento | query | string | no | Text or date column to group by (one row per value, metrics aggregated). |
funcao | query | string | no | With agrupamento: SOMA (default) | MEDIA | CONTAGEM | MAIOR | MENOR | MEDIANA. |
fonte | query | string | no | snapshot = the daily picture (instant, with atualizadoEm; only without row rule, filter and grouping — otherwise the API answers live and says so in fonte). |
atualizar | query | string | no | 1 with fonte=snapshot: refreshes the picture before answering. |
pagina | query | integer | no | Page (starts at 1) over the queried set. |
tamanho | query | integer | no | Rows per page, up to the ceiling (default = the ceiling). |
Response fields
| Name | Type | Description |
|---|---|---|
dataset | string | The queried dataset. |
colunas | array | The columns. |
data | array | The records of the page. |
count | integer | How many records came in this page. |
pagina | integer | Returned page (starts at 1). |
tamanho | integer | Rows per page. |
totalNaConsulta | integer | Total rows of the whole query. |
temMais | boolean | There is another page. |
verValores | boolean | true when value columns were returned. |
regrasDeLinhaAplicadas | integer | How many of the key owner's row rules applied. |
fonte | string | Live or snapshot (the daily picture). |
atualizadoEm | string (date and time) | Incremental mode only: when the record was last created or changed. |
agrupamento | string | The grouped column, when grouping was used. |
ignorados | string | Ignored filters or columns, with the reason. |
truncado | boolean | true when the result exceeded the row ceiling. |
aviso | string | Text notice about the response. |
mascara | string | Notice when sensitive columns were omitted. |
Status codes
| HTTP | Description |
|---|---|
| 200 | JSON {dataset, colunas, data, count, truncado, regrasDeLinhaAplicadas, verValores} ou text/csv |
| 404 | dataset not found |
Error messages
| HTTP | Message (erro field) | When it happens |
|---|---|---|
| 401 | chave de API ausente ou inválida | No key header, revoked key or typo. |
| 401 | chave sem empresa vinculada | The key exists but is not linked to an account. Create another one in Settings › API. |
| 403 | conta de demonstração: a API pública está desligada na vitrine | The call reached the demo account, where the public API is turned off. |
| 403 | identidade da chave de API irregular | The account refuses keys with irregular identity (deactivated person or ownerless key). The body brings motivo and comoResolver. |
| 429 | limite de requisições excedido (120/min) | The key went over its per-minute limit. Wait for Retry-After. |
| 400 | informe o dataset | The dataset key is missing from the URL. |
| 404 | dataset não encontrado: {dataset} | The dataset does not exist or is not available to the account. Check the catalog. |
| 500 | a consulta não rodou | The analytics query failed. Try fewer columns or another filter. |