> ## Documentation Index
> Fetch the complete documentation index at: https://onlytraffic.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Статистика фанов

> Acquired-fans counters per pricing model — all-time (`count`), last 30 days (`monthly`, fixed window regardless of `from`/`to`), over the requested period (`period_sum`) — plus a daily dataset.

Shared-link (limited access) CPL campaigns are included: their fans are counted from daily parser snapshots.

Cached for 15 minutes.

Сколько фанов вы привели, с разбивкой по моделям оплаты. Это те же данные, что в виджете **Fans** в дашборде партнёра.

В ответе три панели: `total`, `revshare` и `cpl`. Каждая панель содержит:

| Поле         | Описание                                                                      |
| ------------ | ----------------------------------------------------------------------------- |
| `count`      | Фаны за всё время                                                             |
| `monthly`    | Фаны за последние 30 дней. Это окно фиксировано и не зависит от `from` / `to` |
| `period_sum` | Фаны за период `from` / `to`                                                  |
| `dataset`    | Число фанов по дням за период `from` / `to`, готово для графика               |

## Период

`from` и `to` принимают Unix timestamp или дату `Y-m-d`.

* По умолчанию: последние 14 дней.
* Максимальный диапазон: 366 дней.
* Дата `to` в будущем считается текущим моментом.

<Note>
  В цифры входят CPL-кампании, работающие по общей ссылке (ограниченный доступ). Фаны по таким кампаниям считаются по ежедневным снимкам аккаунта.
</Note>

<Info>Ответы кэшируются на 15 минут.</Info>


## OpenAPI

````yaml api/openapi-partners.json GET /api/marketer/stats/fans
openapi: 3.0.2
info:
  title: OnlyTraffic Marketer API
  version: 2.1.0
  description: >-
    Partner (marketer) API for OnlyTraffic.


    **Authentication:** pass your API key in the `Authorization` header
    (`Authorization: your-api-key` or `Authorization: Bearer your-api-key`).
    Create keys in the partner cabinet: Tools -> API
    (https://partners.onlytraffic.com/tools/api). Up to 5 named keys per
    account, each **Full** or **Read-only**, with an optional expiry. Keys start
    with `ot_partners_` and are shown once, at creation. Read-only keys cannot
    call the `POST` endpoints (`error_code` 403, message `This API key is
    read-only`). An older legacy key keeps working with full access until you
    delete it on the same page.


    **Pagination:** all list endpoints accept `offset` (default 0) and `limit`
    (default 50, max 1000) as query parameters or JSON body fields.


    **Dates:** every timestamp field has two variants — an ISO 8601 string
    (`*_at`) and a Unix timestamp integer (`*_at_ts` / `*_ts`).


    **Writes:** a Full-access key reads and writes. Write endpoints are `POST`
    with a JSON body, accept public ids only (`revc_…`, `cplo_…`) and answer
    with the updated object in `data`. Rate limit: 120 requests per minute for
    reads, 30 per minute for writes, per account (shared by all its keys).
servers:
  - url: https://partners.onlytraffic.com
security: []
tags:
  - name: RevShare
    description: RevShare campaigns and financial data
  - name: CPL
    description: Cost-Per-Lead orders placed against your offers
  - name: CPC
    description: Cost-Per-Click orders and the category catalog
  - name: Subscribers
    description: Fans acquired through your campaigns
  - name: Stats
    description: Dashboard-style statistics widgets (fans, income, conversion)
  - name: Write
    description: >-
      Write API: start / stop / update campaigns and accept / reject / stop CPL
      campaigns (same key, same rules as the cabinet)
paths:
  /api/marketer/stats/fans:
    get:
      tags:
        - Stats
      summary: Fans statistics
      description: >-
        Acquired-fans counters per pricing model — all-time (`count`), last 30
        days (`monthly`, fixed window regardless of `from`/`to`), over the
        requested period (`period_sum`) — plus a daily dataset.


        Shared-link (limited access) CPL campaigns are included: their fans are
        counted from daily parser snapshots.


        Cached for 15 minutes.
      parameters:
        - $ref: '#/components/parameters/stats_from'
        - $ref: '#/components/parameters/stats_to'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                oneOf:
                  - title: Success
                    type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - success
                      data:
                        $ref: '#/components/schemas/StatsFans'
                  - $ref: '#/components/schemas/ErrorResponse'
              example:
                status: success
                data:
                  total:
                    count: 11534
                    monthly: 2612
                    period_sum: 1258
                    dataset:
                      - date: '2026-07-15'
                        count: 38
                      - date: '2026-07-16'
                        count: 139
                    label: Total
                  revshare:
                    count: 4936
                    monthly: 720
                    period_sum: 310
                    dataset:
                      - date: '2026-07-15'
                        count: 12
                      - date: '2026-07-16'
                        count: 40
                    label: RevShare
                  cpl:
                    count: 6598
                    monthly: 1892
                    period_sum: 948
                    dataset:
                      - date: '2026-07-15'
                        count: 26
                      - date: '2026-07-16'
                        count: 99
                    label: CPL
      security:
        - api_key: []
components:
  parameters:
    stats_from:
      name: from
      in: query
      schema:
        oneOf:
          - type: integer
          - type: string
            format: date
        example: '2026-06-01'
      description: >-
        Dataset period start — unix timestamp or Y-m-d. Default: 14 days ago.
        Max range: 366 days.
    stats_to:
      name: to
      in: query
      schema:
        oneOf:
          - type: integer
          - type: string
            format: date
        example: '2026-07-01'
      description: >-
        Dataset period end — unix timestamp or Y-m-d. Default: now (values in
        the future are clamped to now).
  schemas:
    StatsFans:
      type: object
      description: Fans widget data, one panel per pricing model.
      properties:
        total:
          $ref: '#/components/schemas/StatsFansPanel'
        revshare:
          $ref: '#/components/schemas/StatsFansPanel'
        cpl:
          $ref: '#/components/schemas/StatsFansPanel'
    ErrorResponse:
      title: Error
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          description: Human-readable error description.
        error_code:
          type: integer
          description: >-
            403: access denied (missing / unknown / expired / revoked key, or
            the account is not an active partner: `Error! Access denied`; a
            Read-only key calling a write endpoint: `This API key is
            read-only`). 404: not found. 422: bad request params (message says
            what is wrong). 429: rate limit exceeded (a `Retry-After` header is
            set) or another campaign start is still running. 500: server error.
            503: the platform did not answer a write in time, retry later.
    StatsFansPanel:
      type: object
      properties:
        count:
          type: integer
          description: All-time fans count.
        monthly:
          type: integer
          description: Fans acquired in the last 30 days (fixed window).
        period_sum:
          type: integer
          description: Fans acquired over the requested from/to period.
        dataset:
          type: array
          description: One entry per day of the requested period.
          items:
            type: object
            properties:
              date:
                type: string
                format: date
              count:
                type: integer
        label:
          type: string
  securitySchemes:
    api_key:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        API key from the partner cabinet, Tools -> API
        (https://partners.onlytraffic.com/tools/api): up to 5 named keys per
        account, each Full or Read-only, `ot_partners_` prefix, shown once at
        creation. Raw value or `Bearer` form. Read-only keys cannot call the
        `POST` endpoints (403 `This API key is read-only`); expired or revoked
        keys get 403 `Error! Access denied`.

````