# GET /v1/stats/subid

Obter estatísticas por subid

Pops, receita e eCPM agrupados por sub1, sub2 e sub3, por no máximo 90 dias; JSON ou CSV. A receita por subid é uma alocação, em proporção aos pops, da receita informada por /v1/stats para cada zona e país, e não uma medição separada (`revenue_allocated` é sempre true); os totais são iguais aos totais de /v1/stats para o mesmo intervalo e filtros. As linhas são ordenadas por receita; as linhas além de `limit` são unidas em uma única linha cujo subid é `~other`. Um subid nulo significa que nenhum subid foi enviado. Exige o escopo publisher:read (chave de API ou sessão web). Nível de limite de taxa: stats.

- Escopo exigido: `publisher:read`
- Limite de taxa: `stats` — 30 requisições por janela de 60 s por chave de API ou sessão web

## Parâmetros

| Nome | Em | Tipo | Obrigatório |
|---|---|---|---|
| `from` | query | string | sim |
| `to` | query | string | sim |
| `group_by` | query | ("sub1" \| "sub2" \| "sub3")[] | não |
| `site_id` | query | integer | não |
| `zone_id` | query | integer | não |
| `sub1` | query | string | não |
| `sub2` | query | string | não |
| `sub3` | query | string | não |
| `limit` | query | integer | não |
| `format` | query | "json" \| "csv" | não |

## Resposta

```
{ count_basis?: "valid" | "legacy" | "mixed"; currency: "USD"; estimated_from: string | null; forecast_basis_version?: "forecast-basis-v1"; forecast_generation?: string; forecast_updated_at?: string | null; measurement_definition?: { complete: boolean; includes_direct: boolean; includes_legacy: boolean; tag_valid_after_ms: integer[] }; measurement_generation?: string; measurement_status?: "ok" | "stale" | "updating"; measurement_updated_at?: string | null; money_basis_version?: string; money_generation?: string; revenue_allocated: true; rows: { ecpm: string | null; pops: integer; revenue: string; status?: "estimated" | "reported" | "final" | "mixed"; sub1?: string | null; sub2?: string | null; sub3?: string | null }[]; totals: { ecpm: string | null; pops: integer; revenue: string; status?: "estimated" | "reported" | "final" | "mixed" }; truncated?: boolean; updated_at?: string | null }
```

## Erros

As rotas com limite de taxa retornam `RateLimit-Limit`, `RateLimit-Remaining` e `RateLimit-Reset` (segundos até o fim da janela); um 429 também traz `Retry-After`. Os headers podem estar ausentes enquanto o limitador estiver temporariamente indisponível (as requisições passam nesse caso).

| Status | Significado |
|---|---|
| 401 | Chave de API ausente, inválida ou revogada. |
| 403 | A chave não tem o escopo exigido, ou a operação não é permitida para este ator. |
| 429 | Limite de taxa excedido; aguarde `Retry-After` segundos. |
| 400 | Default Response |
| 404 | Default Response |
| 503 | Default Response |

Documentação HTML: https://agimone.com/pt/developers/api/#get-subid-stats
API 2026-10
