{
  "components": {
    "callbacks": {},
    "examples": {},
    "headers": {},
    "links": {},
    "parameters": {},
    "pathItems": {},
    "requestBodies": {},
    "responses": {},
    "schemas": {},
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "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.0,
          "display_plan": "payg",
          "payg": 1.0,
          "similarweb_payg": 1.0,
          "team": 1.0,
          "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.0,
      "display_plan": "payg",
      "payg": 1.0,
      "similarweb_payg": 1.0,
      "team": 1.0,
      "version": "e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb"
    },
    "x-aisa-provider": "foreplay"
  },
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "openapi": "3.1.0",
  "paths": {
    "/apis/v1/foreplay/brand/analytics": {
      "get": {
        "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).\n\n**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)`.\n\n**Date window:** the window between `start_date` and `end_date` must be ≤ 30 days. A larger range returns HTTP 406 `Date range too large`.\n\n**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.\n\n 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"
          }
        },
        "summary": "Brand Analytics",
        "tags": [
          "foreplay"
        ],
        "x-aisa-capabilities": {
          "idempotency": "Idempotency-Key",
          "max_price": "X-AISA-Max-Price-USD",
          "mpp": false,
          "mpp_methods": [],
          "quote": {
            "header": "X-AISA-Cost-Mode",
            "value": "quote"
          },
          "x402": false
        },
        "x-aisa-catalog-id": "foreplay",
        "x-aisa-category": "Ad Intelligence",
        "x-aisa-docs-url": "https://aisa.one/docs/api-reference/foreplay/get_foreplay-brand-analytics",
        "x-aisa-passthrough": true,
        "x-aisa-pricing": {
          "cost_contract": "response_count",
          "customer_multiplier": 1.0,
          "customer_pricing": "provider_cost_multiplier",
          "default_request_estimate_usd": 0.875,
          "estimate_source": "profile_seed",
          "evidence_source": "response_body",
          "maximum_units": 50,
          "unit": "provider_credit",
          "unit_rate_usd": 0.0
        },
        "x-aisa-query-policy": {
          "ignore_undeclared": false,
          "request_wins": true
        },
        "x-aisa-response-source": {
          "content_hash": "sha256:14a136f139977d3769685c231aa2a417c36b59a205a744652f22bd2485057072",
          "kind": "upstream_success_contract",
          "source": {
            "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
            "converter": "scripts/import_existing_contracts.py@1",
            "fetched_at": "2026-09-29T21:25:55+08:00",
            "kind": "manual",
            "owner": "AIsa-team/docs",
            "path_space": "public",
            "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
            "refresh_policy": "manual",
            "review_period_days": 30,
            "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
          }
        },
        "x-aisa-revision": {
          "customer_pricing_ref": "25dccbfad0ad",
          "plan_policy_version": "e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb",
          "profile_ref": "6c8c8557eec2"
        },
        "x-aisa-runtime-operation": {
          "method": "GET",
          "operation_id": "get_brands_analytics",
          "path": "/apis/v1/foreplay/brand/analytics"
        },
        "x-aisa-source": {
          "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
          "converter": "scripts/import_existing_contracts.py@1",
          "fetched_at": "2026-09-29T21:25:55+08:00",
          "kind": "manual",
          "owner": "AIsa-team/docs",
          "path_space": "public",
          "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
          "refresh_policy": "manual",
          "review_period_days": 30,
          "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
        },
        "x-aisa-status": "enabled",
        "x-aisa-upstream-path": "/api/brand/analytics",
        "x-aisa-validation": "provider"
      }
    },
    "/apis/v1/foreplay/brand/getAdsByBrandId": {
      "get": {
        "description": "Retrieve ads for one or more Foreplay brand IDs, applying the supplied filters. Each result in `data[]` is a full ad object.\n\n**Accepts `brand_ids` only.** `page_id` lookup is NOT supported on the AIsa gateway — resolve a domain to its `ad_library_id` / brand id via `getBrandsByDomain` first. Passing a page id in `brand_ids` returns HTTP 200 with `count: 0` (silently treated as an unknown brand). This is intentional P0 scoping, documented as a known limitation.\n\n empty results and 4xx/5xx errors are not charged.",
        "operationId": "get_ads_by_brand_ids",
        "parameters": [
          {
            "description": "Brand ID(s) to search for. Can be a single ID or multiple IDs separated by commas.",
            "in": "query",
            "name": "brand_ids",
            "required": true,
            "schema": {
              "type": "array"
            }
          },
          {
            "description": "Best-effort live fallback. If the cached results are empty and `collect=true`, the API translates each brand id to its Meta page id (`adlibraryid`), kicks off a live fetch through our Spyder pipeline, and polls for ~30 seconds. Returns whatever is available at the end of the window — may still be empty if a brand has no Meta page on file, the page is restricted, deleted, or simply isn't running ads. Not perfect — use it as a fallback when the regular response is empty, not as a default.",
            "in": "query",
            "name": "collect",
            "required": false,
            "schema": {
              "default": "false",
              "type": "string"
            }
          },
          {
            "description": "Cursor for pagination. Use the cursor value from the previous response's metadata to get the next page of results.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by one or more display formats.\nAvailable formats (11): carousel, dco, dpa, event, image, multi_images, multi_medias, multi_videos, page_like, text, video\nExample: `?display_format=video&display_format=carousel`\n\n",
            "in": "query",
            "name": "display_format",
            "required": false,
            "schema": {
              "enum": [
                "carousel",
                "dco",
                "dpa",
                "event",
                "image",
                "multi_images",
                "multi_medias",
                "multi_videos",
                "page_like",
                "text",
                "video"
              ],
              "type": "string"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by languages.\nAccepts various language formats: 'french', 'FR', 'romanian', 'ro', 'english', 'en', etc.\nExample: `?languages=en&languages=fr`\n\n",
            "in": "query",
            "name": "languages",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pagination limit (max 250). Controls the number of ads returned per request.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 250,
              "type": "integer"
            }
          },
          {
            "description": "Filter ads by live status. `true` means currently active ads, `false` means inactive ads. Leave empty to include both.",
            "in": "query",
            "name": "live",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by market target.\nAvailable targets: b2b (business-to-business), b2c (business-to-consumer)\nExample: `?market_target=b2b`\n\n",
            "in": "query",
            "name": "market_target",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by one or more niches.\nAvailable niches: travel, food, fashion, beauty, health, technology, automotive, finance, education, entertainment, sports, home, pets, business, other\nExample: `?niches=travel&niches=fashion`\n\n",
            "in": "query",
            "name": "niches",
            "required": false,
            "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": "Filter by one or more publisher platforms.\nAvailable platforms: facebook, instagram, audience_network, messenger, tiktok, youtube, linkedin, threads, whatsapp\nExample: `?publisher_platform=facebook&publisher_platform=instagram`\n\n",
            "in": "query",
            "name": "publisher_platform",
            "required": false,
            "schema": {
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "tiktok",
                "youtube",
                "linkedin",
                "threads",
                "whatsapp"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter ads by maximum running duration in days. Must be a positive integer.",
            "in": "query",
            "name": "running_duration_max_days",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by minimum running duration in days. Must be a positive integer.",
            "in": "query",
            "name": "running_duration_min_days",
            "required": false,
            "schema": {
              "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.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by maximum video duration in seconds. Only applies to video ads.",
            "in": "query",
            "name": "video_duration_max",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by minimum video duration in seconds. Only applies to video ads.",
            "in": "query",
            "name": "video_duration_min",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "brand_id": "bYeKOahyGopmGKMHiWit",
                      "brand_name": "Nike",
                      "display_format": "video",
                      "id": "abc123",
                      "live": true,
                      "publisher_platform": "facebook"
                    }
                  ],
                  "error": null,
                  "metadata": {
                    "count": 1,
                    "cursor": null,
                    "status_code": 200,
                    "success": true
                  }
                },
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "JSON envelope with `metadata` and a `data[]` array of ad objects. Each ad in `data[]` counts as one billed item."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Error response; upstream passthrough responses may use provider formats"
          }
        },
        "summary": "Get Ads By Brand Id",
        "tags": [
          "foreplay"
        ],
        "x-aisa-capabilities": {
          "idempotency": "Idempotency-Key",
          "max_price": "X-AISA-Max-Price-USD",
          "mpp": false,
          "mpp_methods": [],
          "quote": {
            "header": "X-AISA-Cost-Mode",
            "value": "quote"
          },
          "x402": false
        },
        "x-aisa-catalog-id": "foreplay",
        "x-aisa-category": "Ad Intelligence",
        "x-aisa-docs-url": "https://aisa.one/docs/api-reference/foreplay/get_foreplay-getadsbybrandid",
        "x-aisa-passthrough": true,
        "x-aisa-pricing": {
          "cost_contract": "response_count",
          "customer_multiplier": 1.0,
          "customer_pricing": "provider_cost_multiplier",
          "default_request_estimate_usd": 0.875,
          "estimate_source": "profile_seed",
          "evidence_source": "response_body",
          "maximum_units": 50,
          "unit": "provider_credit",
          "unit_rate_usd": 0.0
        },
        "x-aisa-query-policy": {
          "ignore_undeclared": false,
          "request_wins": true
        },
        "x-aisa-response-source": {
          "content_hash": "sha256:be2ae5775fe0a54d5a8e2898be9a731b536d6b7f3d44b0ea16322f9ebf292752",
          "kind": "upstream_success_contract",
          "source": {
            "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
            "converter": "scripts/import_existing_contracts.py@1",
            "fetched_at": "2026-09-29T21:25:55+08:00",
            "kind": "manual",
            "owner": "AIsa-team/docs",
            "path_space": "public",
            "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
            "refresh_policy": "manual",
            "review_period_days": 30,
            "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
          }
        },
        "x-aisa-revision": {
          "customer_pricing_ref": "25dccbfad0ad",
          "plan_policy_version": "e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb",
          "profile_ref": "5a7a3b7f6427"
        },
        "x-aisa-runtime-operation": {
          "method": "GET",
          "operation_id": "get_ads_by_brand_ids",
          "path": "/apis/v1/foreplay/brand/getAdsByBrandId"
        },
        "x-aisa-source": {
          "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
          "converter": "scripts/import_existing_contracts.py@1",
          "fetched_at": "2026-09-29T21:25:55+08:00",
          "kind": "manual",
          "owner": "AIsa-team/docs",
          "path_space": "public",
          "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
          "refresh_policy": "manual",
          "review_period_days": 30,
          "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
        },
        "x-aisa-status": "enabled",
        "x-aisa-upstream-path": "/api/brand/getAdsByBrandId",
        "x-aisa-validation": "provider"
      }
    },
    "/apis/v1/foreplay/brand/getBrandsByDomain": {
      "get": {
        "description": "Discover brands that advertise from a given domain. Returns brand records including the Foreplay `brand_id` and the `ad_library_id` (page_id). Use the returned `ad_library_id` as the `id` input to `brand/analytics`.\n\n empty results and 4xx/5xx errors are not charged.",
        "operationId": "get_brands_by_domain",
        "parameters": [
          {
            "description": "Domain name to search for. This can be a full URL (e.g., 'https://example.com') or just the domain (e.g., 'example.com'). The system will automatically format and clean the domain. This endpoint looks up candidate brands based on the provided domain. The returned brands are potential matches and are not guaranteed to be definitively associated with the domain.",
            "in": "query",
            "name": "domain",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pagination limit (max 10). Controls the number of brands returned per request.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 10,
              "type": "integer"
            }
          },
          {
            "description": "Order of results: 'most_ranked' (default) or 'least_ranked'. Sorts brands by relevance ranking.",
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "default": "most_ranked",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "ad_library_id": "15087023444",
                      "brand_id": "bYeKOahyGopmGKMHiWit",
                      "name": "Nike"
                    }
                  ],
                  "error": null,
                  "metadata": {
                    "count": 1,
                    "cursor": null,
                    "status_code": 200,
                    "success": true
                  }
                },
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "JSON envelope with `metadata` and a `data[]` array of brand objects (each includes `brand_id` and `ad_library_id`). Each brand in `data[]` counts as one billed item."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Error response; upstream passthrough responses may use provider formats"
          }
        },
        "summary": "Get Brands By Domain",
        "tags": [
          "foreplay"
        ],
        "x-aisa-capabilities": {
          "idempotency": "Idempotency-Key",
          "max_price": "X-AISA-Max-Price-USD",
          "mpp": false,
          "mpp_methods": [],
          "quote": {
            "header": "X-AISA-Cost-Mode",
            "value": "quote"
          },
          "x402": false
        },
        "x-aisa-catalog-id": "foreplay",
        "x-aisa-category": "Ad Intelligence",
        "x-aisa-docs-url": "https://aisa.one/docs/api-reference/foreplay/get_foreplay-getbrandsbydomain",
        "x-aisa-passthrough": true,
        "x-aisa-pricing": {
          "cost_contract": "response_count",
          "customer_multiplier": 1.0,
          "customer_pricing": "provider_cost_multiplier",
          "default_request_estimate_usd": 0.875,
          "estimate_source": "profile_seed",
          "evidence_source": "response_body",
          "maximum_units": 50,
          "unit": "provider_credit",
          "unit_rate_usd": 0.0
        },
        "x-aisa-query-policy": {
          "ignore_undeclared": false,
          "request_wins": true
        },
        "x-aisa-response-source": {
          "content_hash": "sha256:e997bc8e8810ef2e80f5633c2867a1539c0a1f2d688ce33f86997853e70e46bd",
          "kind": "upstream_success_contract",
          "source": {
            "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
            "converter": "scripts/import_existing_contracts.py@1",
            "fetched_at": "2026-09-29T21:25:55+08:00",
            "kind": "manual",
            "owner": "AIsa-team/docs",
            "path_space": "public",
            "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
            "refresh_policy": "manual",
            "review_period_days": 30,
            "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
          }
        },
        "x-aisa-revision": {
          "customer_pricing_ref": "25dccbfad0ad",
          "plan_policy_version": "e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb",
          "profile_ref": "39d64023f946"
        },
        "x-aisa-runtime-operation": {
          "method": "GET",
          "operation_id": "get_brands_by_domain",
          "path": "/apis/v1/foreplay/brand/getBrandsByDomain"
        },
        "x-aisa-source": {
          "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
          "converter": "scripts/import_existing_contracts.py@1",
          "fetched_at": "2026-09-29T21:25:55+08:00",
          "kind": "manual",
          "owner": "AIsa-team/docs",
          "path_space": "public",
          "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
          "refresh_policy": "manual",
          "review_period_days": 30,
          "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
        },
        "x-aisa-status": "enabled",
        "x-aisa-upstream-path": "/api/brand/getBrandsByDomain",
        "x-aisa-validation": "provider"
      }
    },
    "/apis/v1/foreplay/discovery/ads": {
      "get": {
        "description": "Search across the Foreplay ad index (100M+ ads) with a text query plus filters. Each result in `data[]` is a full ad object (image/video URLs, transcription, brand metadata, targeting, and more).\n\n empty results and 4xx/5xx errors are not charged.",
        "operationId": "search_discovery_ads",
        "parameters": [
          {
            "description": "Cursor for pagination. Use the cursor value from the previous response's metadata to get the next page of results.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by one or more display formats.\nAvailable formats (11): carousel, dco, dpa, event, image, multi_images, multi_medias, multi_videos, page_like, text, video\nExample: `?display_format=video&display_format=carousel`\n\n",
            "in": "query",
            "name": "display_format",
            "required": false,
            "schema": {
              "enum": [
                "carousel",
                "dco",
                "dpa",
                "event",
                "image",
                "multi_images",
                "multi_medias",
                "multi_videos",
                "page_like",
                "text",
                "video"
              ],
              "type": "string"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by languages.\nAccepts various language formats: 'french', 'FR', 'romanian', 'ro', 'english', 'en', etc.\nExample: `?languages=en&languages=fr`\n\n",
            "in": "query",
            "name": "languages",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pagination limit (max 250). Controls the number of ads returned per request.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 250,
              "type": "integer"
            }
          },
          {
            "description": "Filter ads by live status. `true` means currently active ads, `false` means inactive ads. Leave empty to include both.",
            "in": "query",
            "name": "live",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by market target.\nAvailable targets: b2b (business-to-business), b2c (business-to-consumer)\nExample: `?market_target=b2b`\n\n",
            "in": "query",
            "name": "market_target",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by one or more niches.\nAvailable niches: accessories, app/software, beauty, business/professional, education, entertainment, fashion, food/drink, health/wellness, home/garden, jewelry/watches, other, parenting, pets, real estate, service business, medical, charity/nfp, kids/baby\nExample: `?niches=travel&niches=fashion`\n\n",
            "in": "query",
            "name": "niches",
            "required": false,
            "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": "Filter by one or more publisher platforms.\nAvailable platforms: facebook, instagram, audience_network, messenger, tiktok, youtube, linkedin, threads, whatsapp\nExample: `?publisher_platform=facebook&publisher_platform=instagram`\n\n",
            "in": "query",
            "name": "publisher_platform",
            "required": false,
            "schema": {
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "tiktok",
                "youtube",
                "linkedin",
                "threads",
                "whatsapp"
              ],
              "type": "string"
            }
          },
          {
            "description": "Search text for ad name or description. Leave empty to search all ads with filters only.",
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by maximum running duration in days. Must be a positive integer.",
            "in": "query",
            "name": "running_duration_max_days",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by minimum running duration in days. Must be a positive integer.",
            "in": "query",
            "name": "running_duration_min_days",
            "required": false,
            "schema": {
              "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.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by maximum video duration in seconds. Only applies to video ads.",
            "in": "query",
            "name": "video_duration_max",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter ads by minimum video duration in seconds. Only applies to video ads.",
            "in": "query",
            "name": "video_duration_min",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "brand_id": "bYeKOahyGopmGKMHiWit",
                      "brand_name": "Nike",
                      "display_format": "video",
                      "id": "abc123",
                      "live": true,
                      "publisher_platform": "facebook"
                    }
                  ],
                  "error": null,
                  "metadata": {
                    "count": 1,
                    "cursor": null,
                    "status_code": 200,
                    "success": true
                  }
                },
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "JSON envelope with `metadata` and a `data[]` array of ad objects. Each ad in `data[]` counts as one billed item."
          },
          "default": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Error response; upstream passthrough responses may use provider formats"
          }
        },
        "summary": "Discovery Ads",
        "tags": [
          "foreplay"
        ],
        "x-aisa-capabilities": {
          "idempotency": "Idempotency-Key",
          "max_price": "X-AISA-Max-Price-USD",
          "mpp": false,
          "mpp_methods": [],
          "quote": {
            "header": "X-AISA-Cost-Mode",
            "value": "quote"
          },
          "x402": false
        },
        "x-aisa-catalog-id": "foreplay",
        "x-aisa-category": "Ad Intelligence",
        "x-aisa-docs-url": "https://aisa.one/docs/api-reference/foreplay/get_foreplay-discovery-ads",
        "x-aisa-passthrough": true,
        "x-aisa-pricing": {
          "cost_contract": "response_count",
          "customer_multiplier": 1.0,
          "customer_pricing": "provider_cost_multiplier",
          "default_request_estimate_usd": 0.875,
          "estimate_source": "profile_seed",
          "evidence_source": "response_body",
          "maximum_units": 50,
          "unit": "provider_credit",
          "unit_rate_usd": 0.0
        },
        "x-aisa-query-policy": {
          "ignore_undeclared": false,
          "request_wins": true
        },
        "x-aisa-response-source": {
          "content_hash": "sha256:be2ae5775fe0a54d5a8e2898be9a731b536d6b7f3d44b0ea16322f9ebf292752",
          "kind": "upstream_success_contract",
          "source": {
            "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
            "converter": "scripts/import_existing_contracts.py@1",
            "fetched_at": "2026-09-29T21:25:55+08:00",
            "kind": "manual",
            "owner": "AIsa-team/docs",
            "path_space": "public",
            "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
            "refresh_policy": "manual",
            "review_period_days": 30,
            "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
          }
        },
        "x-aisa-revision": {
          "customer_pricing_ref": "25dccbfad0ad",
          "plan_policy_version": "e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb",
          "profile_ref": "f4901308d8d8"
        },
        "x-aisa-runtime-operation": {
          "method": "GET",
          "operation_id": "search_discovery_ads",
          "path": "/apis/v1/foreplay/discovery/ads"
        },
        "x-aisa-source": {
          "content_hash": "sha256:667883d1e6e3ece298d167ed0bc2a9bfbeefa09ff14fff522afd839ad9d42708",
          "converter": "scripts/import_existing_contracts.py@1",
          "fetched_at": "2026-09-29T21:25:55+08:00",
          "kind": "manual",
          "owner": "AIsa-team/docs",
          "path_space": "public",
          "policy_revision": "sha256:5fcc4503dbb495b9742deb9b4549953007451710ba0e30e191c8cd8ee32fa9b4",
          "refresh_policy": "manual",
          "review_period_days": 30,
          "url": "https://github.com/AIsa-team/docs/blob/7783840e4710bb00886143feab84606f8aaea67c/openapi/foreplay.json"
        },
        "x-aisa-status": "enabled",
        "x-aisa-upstream-path": "/api/discovery/ads",
        "x-aisa-validation": "provider"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ]
}
