> ## 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.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# 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. Because the response is one row per day, a 30-day window can bill up to ~30 items.

 empty results and 4xx/5xx errors are not charged.

## 请求规范

* **方法与路径:** GET /apis/v1/foreplay/brand/analytics
* **可用状态:** enabled
* **请求 URL 模板:** `https://api.aisa.one/apis/v1/foreplay/brand/analytics`
* **end\_date:** query; 可选
* **id:** query; 必填
* **order:** query; 可选
* **start\_date:** query; 可选

[完整 OpenAPI 定义](https://aisa.one/docs/openapi/zh/foreplay.json)

有效请求声明（包括认证和引用的 schema）：

```json theme={null}
{
  "operationId": "get_brands_analytics",
  "method": "GET",
  "path": "/apis/v1/foreplay/brand/analytics",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [
    {
      "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`.",
      "in": "query",
      "name": "end_date",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Page ID or Brand ID. Brand IDs are 20-25 character alphanumeric strings with mixed case. Page IDs are numeric Facebook page identifiers.",
      "in": "query",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "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.",
      "in": "query",
      "name": "order",
      "required": false,
      "schema": {
        "default": "newest",
        "enum": [
          "newest",
          "oldest",
          "longest_running",
          "most_relevant"
        ],
        "type": "string"
      }
    },
    {
      "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`.",
      "in": "query",
      "name": "start_date",
      "required": false,
      "schema": {
        "type": "string"
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "x-aisa-status": "enabled",
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## 费用与请求规则

按实际计费结果数量收费。 默认请求预估费用：\$0.875 USD。 最终费用以实际用量为准。 账户适用价格可能不同；支持报价的接口可按实际请求获取报价。


## 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-catalogs:
    foreplay:
      description: ''
      title: foreplay
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
      x-aisa-document:
        facts_hash: 799c2645862e25f3076e45d5e7d545772f57444689dd138cd88f92c37554b81c
        generator_version: '3'
        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-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:
    composer_version: '31'
    document_hash: sha256:d55108e3b852bff8ee0bab15feb77cca407b5c6493874d49a853676a8d5097d8
    facts_hash: 799c2645862e25f3076e45d5e7d545772f57444689dd138cd88f92c37554b81c
    generator_version: '3'
    protocol_version: '1'
    response_pending: []
    schema_version: '1'
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: foreplay
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. Because the
        response is one row per day, a 30-day window can bill up to ~30 items.

         empty results and 4xx/5xx errors are not charged.
      operationId: get_brands_analytics
      parameters:
        - 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`.
          in: query
          name: end_date
          required: false
          schema:
            type: string
        - description: >-
            Page ID or Brand ID. Brand IDs are 20-25 character alphanumeric
            strings with mixed case. Page IDs are numeric Facebook page
            identifiers.
          in: query
          name: id
          required: true
          schema:
            type: string
        - 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.
          in: query
          name: order
          required: false
          schema:
            default: newest
            enum:
              - newest
              - oldest
              - longest_running
              - most_relevant
            type: string
        - 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`.
          in: query
          name: start_date
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              example:
                data:
                  - active_count: 12
                    date: '2025-01-01'
                    image: 5
                    inactive_count: 3
                    video: 7
                  - active_count: 14
                    date: '2025-01-02'
                    image: 6
                    inactive_count: 2
                    video: 8
                error: null
                metadata:
                  count: 2
                  cursor: null
                  status_code: 200
                  success: true
              schema:
                type: object
          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.
        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.