replace_demandgen_audiences

Google Ads Write

๐Ÿšจ **IF THIS TOOL RETURNS A QUOTA ERROR:** - The error message will include a clickable upgrade link - Show the FULL error message to the user (it contains the upgrade link) - DO NOT attempt to work ar

Endpoint

POST https://api.adspirer.ai/api/v1/tools/replace_demandgen_audiences/execute

Headers

Description

๐Ÿšจ **IF THIS TOOL RETURNS A QUOTA ERROR:** - The error message will include a clickable upgrade link - Show the FULL error message to the user (it contains the upgrade link) - DO NOT attempt to work around the error or use alternative data - DO NOT create campaigns or perform actions without valid tool data - STOP and direct the user to upgrade via the provided link Replace the grouped audience on a Demand Gen (or YouTube) ad group. Demand Gen uses a single grouped audience per ad group โ€” you cannot add one more segment to a live ad group, so this REPLACES the whole audience (removes the old one and builds a new grouped audience from the segment IDs you pass). โš ๏ธ Use `search_audiences` FIRST to find real audience IDs โ€” NEVER fabricate IDs (wrong IDs target unrelated audiences and waste budget). **Accepts:** in_market_audience_ids, affinity_audience_ids, custom_audience_ids, user_list_ids. **Required:** ad_group_id + at least one audience ID. Only works on Demand Gen ad groups.

Request body

All tool arguments are wrapped in an arguments object.

FieldTypeDescription
ad_group_idstring requiredDemand Gen ad group ID (from get_campaign_structure).
in_market_audience_idsarray optionalIn-market audience IDs (from search_audiences).
affinity_audience_idsarray optionalAffinity audience IDs (from search_audiences).
custom_audience_idsarray optionalCustom audience resource names.
user_list_idsarray optionalRemarketing/user-list resource names.
audience_namestring optionalOptional name for the new grouped audience.
customer_idstring optionalGoogle Ads customer ID. Required for multi-account users.

Example request

{
  "arguments": {
    "ad_group_id": "string",
    "in_market_audience_ids": [
      "string"
    ],
    "affinity_audience_ids": [
      "string"
    ],
    "custom_audience_ids": [
      "string"
    ],
    "user_list_ids": [
      "string"
    ],
    "audience_name": "string",
    "customer_id": "string"
  }
}

Example responses

200 โ€” Success

{
  "success": true,
  "data": {
    "text": "(tool-specific textual output for replace_demandgen_audiences)",
    "quota": {
      "used": 42,
      "limit": 150,
      "tier": "plus",
      "period_end": "2026-05-01"
    }
  },
  "tool": "replace_demandgen_audiences"
}

400 โ€” Tool-level error (bad arguments / multi-account selection)

{
  "success": false,
  "error": "You have 25 meta_ads accounts connected. Please specify which account to use by passing the ad_account_id parameter:\n  - Acme Holdings (ad_account_id=\"act_123456789\")\n  - Acme EU (ad_account_id=\"act_987654321\")",
  "is_error": true,
  "tool": "replace_demandgen_audiences"
}

402 โ€” Quota exhausted

{
  "success": false,
  "error": "\ud83d\udea8 Monthly limit reached (150/150 tool calls on Plus tier).\nUpgrade to Pro at https://adspirer.ai to keep building.",
  "is_error": true,
  "tool": "replace_demandgen_audiences",
  "quota": {
    "used": 150,
    "limit": 150,
    "tier": "plus",
    "period_end": "2026-05-01",
    "upgrade_url": "https://adspirer.ai"
  }
}

Try it live


Adspirer REST API โ€” get an API key at adspirer.ai/keys ยท adspirer.ai