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

# Brand Analytics

> Get analytics for a brand (running-ads distribution, creative velocity) as a series of analytics rows. A successful call returns **one row per day** (`date`, `active_count`, `inactive_count`, and per-format counts).

**Important:** the `id` parameter must be a page_id / `ad_library_id` (obtained from the `getBrandsByDomain` response), NOT a Foreplay `brand_id`. Passing a `brand_id` returns HTTP 406. Flow: `getBrandsByDomain(domain)` -> `ad_library_id` -> `brand/analytics(id=ad_library_id)`.

**Date window:** the window between `start_date` and `end_date` must be ≤ 30 days. A larger range returns HTTP 406 `Date range too large`.

**Cost estimation:** each returned row is 1 billed item ($0.02625). Because the response is one row per day, a 30-day window can bill up to ~30 items.

Billed $0.02625 per item returned in `data[]` (1 credit per item); empty results and 4xx/5xx errors are not charged.



## OpenAPI

````yaml openapi/zh/foreplay.json GET /apis/v1/foreplay/brand/analytics
openapi: 3.1.0
info:
  description: ''
  title: foreplay
  version: '1'
  x-aisa-capabilities:
    idempotency: Idempotency-Key
    max_price: X-AISA-Max-Price-USD
    quote:
      header: X-AISA-Cost-Mode
      value: quote
  x-aisa-configured-paths:
    - /apis/v1/foreplay/brand/analytics
    - /apis/v1/foreplay/brand/getAdsByBrandId
    - /apis/v1/foreplay/brand/getBrandsByDomain
    - /apis/v1/foreplay/discovery/ads
  x-aisa-document:
    facts_hash: 45ce32b5d2de49bb641c368c8d52e3cc198d5f8fd4d550b370b8c779bbf9f41e
    generator_version: '2'
    protocol_version: '1'
    schema_version: '1'
    composer_version: '13'
    response_pending: []
    document_hash: sha256:127fa77e132696034d322cbb9cdac88d3512ed201b72998f687dde3a2766f106
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: foreplay
  x-aisa-catalogs:
    foreplay:
      title: foreplay
      description: ''
      x-aisa-document:
        facts_hash: 45ce32b5d2de49bb641c368c8d52e3cc198d5f8fd4d550b370b8c779bbf9f41e
        generator_version: '2'
        protocol_version: '1'
        schema_version: '1'
      x-aisa-plans:
        builder: 1
        display_plan: payg
        payg: 1
        similarweb_payg: 1
        team: 1
        version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
servers:
  - url: https://api.aisa.one
security:
  - bearerAuth: []
paths:
  /apis/v1/foreplay/brand/analytics:
    get:
      tags:
        - foreplay
      summary: Brand Analytics
      description: >-
        Get analytics for a brand (running-ads distribution, creative velocity)
        as a series of analytics rows. A successful call returns **one row per
        day** (`date`, `active_count`, `inactive_count`, and per-format counts).


        **Important:** the `id` parameter must be a page_id / `ad_library_id`
        (obtained from the `getBrandsByDomain` response), NOT a Foreplay
        `brand_id`. Passing a `brand_id` returns HTTP 406. Flow:
        `getBrandsByDomain(domain)` -> `ad_library_id` ->
        `brand/analytics(id=ad_library_id)`.


        **Date window:** the window between `start_date` and `end_date` must be
        ≤ 30 days. A larger range returns HTTP 406 `Date range too large`.


        **Cost estimation:** each returned row is 1 billed item ($0.02625).
        Because the response is one row per day, a 30-day window can bill up to
        ~30 items.


        Billed $0.02625 per item returned in `data[]` (1 credit per item); empty
        results and 4xx/5xx errors are not charged.
      operationId: get_brands_analytics
      parameters:
        - name: end_date
          in: query
          required: false
          description: >-
            End date (inclusive). Format: 'YYYY-MM-DD', 'YYYY-MM-DDTHH:MM:SS',
            or 'YYYY-MM-DD HH:MM:SS'. If you provide only the date (e.g.
            '2024-11-12'), it will be interpreted as '2024-11-12 00:00:00'. To
            include all results for a given day, set end_date to 'YYYY-MM-DD
            23:59:59' or to the next day at '00:00:00'. Examples:
            start_date=2024-11-12 00:00:00, end_date=2024-11-12 23:59:59. The
            window between start_date and end_date must be ≤ 30 days. A larger
            range returns HTTP 406 `Date range too large`.
          schema:
            type: string
        - name: id
          in: query
          required: true
          description: >-
            Page ID or Brand ID. Brand IDs are 20-25 character alphanumeric
            strings with mixed case. Page IDs are numeric Facebook page
            identifiers.
          schema:
            type: string
        - name: order
          in: query
          required: false
          description: >-
            Order of results: 'newest' (default), 'oldest', 'longest_running',
            or 'most_relevant'. Sorts ads by creation date, longest running
            duration, or relevance to the search query.
          schema:
            type: string
            default: newest
            enum:
              - newest
              - oldest
              - longest_running
              - most_relevant
        - name: start_date
          in: query
          required: false
          description: >-
            Start date (inclusive). Format: 'YYYY-MM-DD', 'YYYY-MM-DDTHH:MM:SS',
            or 'YYYY-MM-DD HH:MM:SS'. If you provide only the date (e.g.
            '2024-11-12'), it will be interpreted as '2024-11-12 00:00:00'. To
            get all ads from a specific day, set end_date to 'YYYY-MM-DD
            23:59:59' or to the next day at '00:00:00'. Examples:
            start_date=2024-11-12 00:00:00, end_date=2024-11-12 23:59:59. The
            window between start_date and end_date must be ≤ 30 days. A larger
            range returns HTTP 406 `Date range too large`.
          schema:
            type: string
      responses:
        '200':
          description: >-
            JSON envelope with `metadata` and a `data[]` array of analytics rows
            (one row per day, each with `date`, `active_count`,
            `inactive_count`, and per-format counts). Each row in `data[]`
            counts as one billed item.
          content:
            application/json:
              schema:
                type: object
              example:
                metadata:
                  success: true
                  status_code: 200
                  count: 2
                  cursor: null
                data:
                  - date: '2025-01-01'
                    active_count: 12
                    inactive_count: 3
                    video: 7
                    image: 5
                  - date: '2025-01-02'
                    active_count: 14
                    inactive_count: 2
                    video: 8
                    image: 6
                error: null
        default:
          content:
            application/json:
              schema: {}
          description: >-
            Error response; upstream passthrough responses may use provider
            formats
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.