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

# Update an ad set

> Ad Campaigns. Can spend money or change spend: needs the ads:spend scope and X-Aisa-Confirm: spend; without the header the request is refused with confirmation_required and nothing is sent. Changes an ad set's budget, bidding, schedule, targeting or status. Changes an ad set's settings, such as its budget, bid strategy, status or delivery options. At least one updatable field is required. Use it for: ABO budget updates. Ad-set-scoped pause/resume. Bid-strategy edits. Meta value-rule-set attach/detach.

<!-- aisa-pricing:start -->
当前未提供请求参考价格；请使用接口支持的报价功能确认费用。 最终费用以账户适用价格及实际结算为准。
<!-- aisa-pricing:end -->

## 请求规范

* **方法与路径:** PUT /apis/v1/ads/ad-sets/\{adSetId}
* **可用状态:** enabled
* **请求 URL 模板:** `https://api.aisa.one/apis/v1/ads/ad-sets/{adSetId}`
* **adSetId:** path; 必填
* **connectionId:** query; 必填
* **X-Aisa-Confirm:** header; 可选
* **Runtime 事实版本:** fe60122939c67dc98a3a6ac6b97bd5c326b526105150c8959304dd2160d4dd09

[完整 OpenAPI 定义](https://aisa.one/docs/reference-contracts/zh/aisa-ads.json)

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

```json theme={null}
{
  "operationId": "put_aisa_ads_apis_v1_ads_ad_sets_adsetid",
  "method": "PUT",
  "path": "/apis/v1/ads/ad-sets/{adSetId}",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [
    {
      "description": "Platform ad set ID",
      "in": "path",
      "name": "adSetId",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "The ads connection (adc_...) the request runs on: one of yours, from GET /apis/v1/ads/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
      "in": "query",
      "name": "connectionId",
      "required": true,
      "schema": {
        "pattern": "^adc_[0-9A-Za-z]+$",
        "type": "string"
      }
    },
    {
      "description": "Required with the value \"spend\" when the request can spend money or change spend. Without it the request is refused with 409 confirmation_required, which describes what would happen; nothing is sent to the ad platform.",
      "in": "header",
      "name": "X-Aisa-Confirm",
      "required": false,
      "schema": {
        "enum": [
          "spend"
        ],
        "type": "string"
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "example": {
          "budget": {
            "amount": 10,
            "type": "daily"
          },
          "connectionId": "adc_7f3k2m9q",
          "name": "Winter launch"
        },
        "schema": {
          "additionalProperties": true,
          "properties": {
            "bidAmount": {
              "description": "Bid cap in WHOLE currency units (USD: 5 = $5.00; JPY: 100 = ¥100). Required when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP.",
              "type": "number"
            },
            "bidStrategy": {
              "description": "Ad-set-level bid strategy. Overrides the campaign-level default. Meta (facebook, instagram): supported. TikTok: the Meta-style enum is mapped to bid_type / bid_price / deep_bid_type automatically.",
              "enum": [
                "LOWEST_COST_WITHOUT_CAP",
                "LOWEST_COST_WITH_BID_CAP",
                "COST_CAP",
                "LOWEST_COST_WITH_MIN_ROAS"
              ],
              "type": "string"
            },
            "budget": {
              "description": "Omit if not updating budget",
              "properties": {
                "amount": {
                  "type": "number"
                },
                "type": {
                  "enum": [
                    "daily",
                    "lifetime"
                  ],
                  "type": "string"
                }
              },
              "type": "object"
            },
            "connectionId": {
              "description": "The ads connection (adc_...), when not sent as the connectionId query parameter.",
              "pattern": "^adc_[0-9A-Za-z]+$",
              "type": "string"
            },
            "dsaBeneficiary": {
              "description": "Meta only (400 elsewhere, before anything in the request is written). Writes the ad set's `dsa_beneficiary`, the legal entity that benefits from its ads. Same field and limits as `dsaBeneficiary` on POST /apis/v1/ads/create.",
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            },
            "dsaPayor": {
              "description": "Meta only (400 elsewhere, before anything in the request is written). Writes the ad set's `dsa_payor`, the legal entity that pays for its ads, same field and limits as `dsaPayor` on POST /apis/v1/ads/create.",
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            },
            "endDate": {
              "description": "Reddit only. The ad group's new end_time, ISO 8601, read in the ad account timezone when it has no offset; a date alone means the end of that day. `null` removes the end date so the ad group runs continuously.",
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "description": "Rename the ad set. At least one of budget/status/bidStrategy/name is required. Supported on Meta, Google (the ad group), TikTok, LinkedIn (the campaign), Pinterest, X (the line item `name`), OpenAI and Reddit.",
              "maxLength": 255,
              "type": "string"
            },
            "placements": {
              "description": "Meta only (400 elsewhere). Manual placements, with the same object and enums as `placements` on POST /apis/v1/ads/create.",
              "properties": {
                "audienceNetworkPositions": {
                  "items": {
                    "enum": [
                      "classic",
                      "rewarded_video"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "devicePlatforms": {
                  "items": {
                    "enum": [
                      "mobile",
                      "desktop"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "facebookPositions": {
                  "items": {
                    "enum": [
                      "feed",
                      "right_hand_column",
                      "marketplace",
                      "story",
                      "search",
                      "instream_video",
                      "facebook_reels",
                      "facebook_reels_overlay",
                      "profile_feed",
                      "notification"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "instagramPositions": {
                  "items": {
                    "enum": [
                      "stream",
                      "story",
                      "explore",
                      "explore_home",
                      "reels",
                      "profile_feed",
                      "ig_search",
                      "profile_reels"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "messengerPositions": {
                  "items": {
                    "enum": [
                      "messenger_home",
                      "sponsored_messages",
                      "story"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "publisherPlatforms": {
                  "items": {
                    "enum": [
                      "facebook",
                      "instagram",
                      "threads",
                      "messenger",
                      "audience_network",
                      "whatsapp",
                      "meta"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "threadsPositions": {
                  "items": {
                    "enum": [
                      "threads_stream"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "whatsappPositions": {
                  "items": {
                    "enum": [
                      "status"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              },
              "type": [
                "object",
                "null"
              ]
            },
            "platform": {
              "description": "Filled from the connection when omitted.",
              "enum": [
                "facebook",
                "instagram",
                "tiktok",
                "linkedin",
                "pinterest",
                "google",
                "twitter",
                "openai",
                "reddit",
                "meta",
                "x"
              ],
              "type": "string"
            },
            "platformSpecificData": {
              "description": "Platform-specific post-launch delivery settings. The platform is implied by the `platform` body param. Meta only; other platforms return 400. Unknown keys are rejected.",
              "properties": {
                "adSchedule": {
                  "description": "Replaces the ad set's dayparting (Meta `adset_schedule`, `pacing_type: [\"day_parting\"]`). An empty array removes the schedule (`pacing_type: [\"standard\"]`). Meta runs a schedule only on a lifetime budget.",
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "dayOfWeek": {
                        "enum": [
                          "MONDAY",
                          "TUESDAY",
                          "WEDNESDAY",
                          "THURSDAY",
                          "FRIDAY",
                          "SATURDAY",
                          "SUNDAY"
                        ],
                        "type": "string"
                      },
                      "endHour": {
                        "description": "Must be after startHour. 24 is midnight at the end of the day.",
                        "maximum": 24,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "startHour": {
                        "maximum": 23,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "timezoneType": {
                        "default": "USER",
                        "description": "Meta `timezone_type`: USER runs the hours in each viewer's time zone, ADVERTISER in the ad account time zone.",
                        "enum": [
                          "USER",
                          "ADVERTISER"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "dayOfWeek",
                      "endHour",
                      "startHour"
                    ],
                    "type": "object"
                  },
                  "maxItems": 168,
                  "type": "array"
                },
                "billingEvent": {
                  "description": "Meta ad-set billing_event (e.g. IMPRESSIONS, LINK_CLICKS, THRUPLAY).",
                  "type": "string"
                },
                "customerLifecycle": {
                  "additionalProperties": false,
                  "description": "Meta's Customer Lifecycle Strategy on a Sales ad set (Meta `ad_set_goal`). Rejected with 400 in adSetId attach mode: use PUT /apis/v1/ads/ad-sets/{adSetId} for an ad set that already exists.",
                  "properties": {
                    "engagedAudienceIds": {
                      "description": "Custom audience ids of people who engaged but have not bought. Required with new_customers_excluding_engaged, not allowed with the other strategies. Must be yours: it is checked through the connection before the request is sent, and an id that is not yours answers not_found.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "existingCustomerAudienceIds": {
                      "description": "Custom audience ids that define your existing customers. Required with both new_customers strategies (Meta answers 400 subcode 1870251 without them); not allowed with all_customers. Must be yours: it is checked through the connection before the request is sent, and an id that is not yours answers not_found.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "strategy": {
                      "description": "`all_customers` is \"Maximize conversions from all customers\". `new_customers` is \"Acquire new customers\" (excludes existing customers). `new_customers_excluding_engaged` also excludes people who engaged with you but have not bought yet.",
                      "enum": [
                        "all_customers",
                        "new_customers",
                        "new_customers_excluding_engaged"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "strategy"
                  ],
                  "type": "object"
                },
                "dailyMinSpendTarget": {
                  "description": "Meta `daily_min_spend_target`: the least this ad set should spend per day, in whole currency units of the ad account. It reserves a share of a CAMPAIGN budget for one ad set, so the campaign must use Advantage campaign budget (CBO).",
                  "type": "number"
                },
                "endDate": {
                  "description": "Ad set end_time (ISO 8601). A value without an offset (`YYYY-MM-DD`, `YYYY-MM-DD HH:MM:SS` or `YYYY-MM-DDTHH:MM:SS`) is read in the ad account timezone.",
                  "type": "string"
                },
                "lifetimeMinSpendTarget": {
                  "description": "Meta `lifetime_min_spend_target`: the lifetime-budget flavour of `dailyMinSpendTarget`, in whole currency units. Send this one when the campaign budget is a lifetime budget. Same rules and same rejections.",
                  "type": "number"
                },
                "optimizationGoal": {
                  "description": "Meta ad-set optimization_goal (e.g. OFFSITE_CONVERSIONS, LANDING_PAGE_VIEWS).",
                  "type": "string"
                },
                "promotedObject": {
                  "additionalProperties": false,
                  "description": "Meta ad-set promoted_object (same shape as /apis/v1/ads/create).",
                  "properties": {
                    "applicationId": {
                      "type": "string"
                    },
                    "customConversionId": {
                      "type": "string"
                    },
                    "customEventStr": {
                      "description": "Pixel custom-event name (custom_event_str); requires customEventType OTHER. Same pairing rules as /apis/v1/ads/create.",
                      "type": "string"
                    },
                    "customEventType": {
                      "type": "string"
                    },
                    "objectStoreUrl": {
                      "type": "string"
                    },
                    "offlineConversionDataSetId": {
                      "type": "string"
                    },
                    "pageId": {
                      "type": "string"
                    },
                    "pixelId": {
                      "type": "string"
                    },
                    "productCatalogId": {
                      "type": "string"
                    },
                    "productSetId": {
                      "type": "string"
                    },
                    "whatsappPhoneNumber": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "startDate": {
                  "description": "Ad set start_time (ISO 8601). A value without an offset (`YYYY-MM-DD`, `YYYY-MM-DD HH:MM:SS` or `YYYY-MM-DDTHH:MM:SS`) is read in the ad account timezone.",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "regionalRegulatedCategories": {
              "description": "Meta only (400 elsewhere, before anything in the request is written).",
              "items": {
                "minLength": 1,
                "type": "string"
              },
              "type": "array"
            },
            "regionalRegulationIdentities": {
              "additionalProperties": {
                "type": [
                  "string",
                  "integer"
                ]
              },
              "description": "Meta only (400 elsewhere, before anything in the request is written). Writes the ad set's `regional_regulation_identities`: the Verified identity IDs of the beneficiary and payer for each declared category.",
              "type": "object"
            },
            "roasAverageFloor": {
              "description": "Minimum ROAS as a decimal multiplier (2.0 = 2.0x). Required when bidStrategy is LOWEST_COST_WITH_MIN_ROAS. Sent to Meta as `bid_constraints.roas_average_floor` × 10000. Not supported on OpenAI (422).",
              "type": "number"
            },
            "smartTargeting": {
              "description": "TikTok only (a 400 elsewhere). TikTok Smart Targeting on the ad group: `audience` is TikTok's `smart_audience_enabled`, `interestsBehaviors` its `smart_interest_behavior_enabled`.",
              "properties": {
                "audience": {
                  "description": "TikTok smart_audience_enabled.",
                  "type": "boolean"
                },
                "interestsBehaviors": {
                  "description": "TikTok smart_interest_behavior_enabled.",
                  "type": "boolean"
                }
              },
              "type": "object"
            },
            "startDate": {
              "description": "Reddit only: the ad group's new start_time, ISO 8601. A value without an offset (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SS`) is read in the ad account timezone.",
              "type": "string"
            },
            "status": {
              "description": "Writes the ad set's own on/off switch (Meta: `configured_status`; X: the line item's `entity_status` ACTIVE / PAUSED), whatever delivery status its ads report. Omit if not toggling delivery state.",
              "enum": [
                "active",
                "paused"
              ],
              "type": "string"
            },
            "targeting": {
              "description": "Targeting fields to change. Meta and Reddit (400 elsewhere). Reddit (see the description above):",
              "properties": {
                "ageMax": {
                  "description": "Maximum age. Same per-platform application and clamping as ageMin.",
                  "maximum": 100,
                  "minimum": 13,
                  "type": "integer"
                },
                "ageMin": {
                  "description": "Minimum age. Applied on Meta, TikTok, Pinterest, LinkedIn, X and Google Search/Display (Google excludes the age ranges outside the request). Rejected with 400 on OpenAI, Reddit and Google Performance Max / Demand Gen.",
                  "maximum": 100,
                  "minimum": 13,
                  "type": "integer"
                },
                "audienceExclude": {
                  "description": "Platform audience IDs to exclude; same ID formats as audienceInclude. Not supported on OpenAI (400). Must be yours: it is checked through the connection before the request is sent, and an id that is not yours answers not_found.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "audienceInclude": {
                  "description": "Platform audience IDs to include, as returned by GET /apis/v1/ads/audiences: Meta: custom audience ids. TikTok: audience ids. Pinterest: customer list ids. LinkedIn: segment ids (the platformAudienceId from GET /apis/v1/ads/audiences). Must be yours: it is checked through the connection before the request is sent, and an id that is not yours answers not_found.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "behaviors": {
                  "description": "Behaviour entities from /apis/v1/ads/targeting/search?dimension=behavior (Meta, TikTok and LinkedIn). On TikTok they target people who, in the picked categories:",
                  "items": {
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "cities": {
                  "description": "City targeting. Optional `radius` + `distanceUnit` extend beyond the city limits; both must be set together or both omitted. `radius` is only honoured on platforms whose capability map allows city radius (Meta).",
                  "items": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "properties": {
                          "distanceUnit": {
                            "description": "Required if radius is set.",
                            "enum": [
                              "mile",
                              "kilometer"
                            ],
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "radius": {
                            "description": "Radius around the city. Requires distanceUnit. Meta enforces a minimum city radius (~17 km / 10 mi); smaller values resolve to a 0-size audience and the ad fails at launch.",
                            "type": "number"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "type": "array"
                },
                "communities": {
                  "description": "Reddit only (400 elsewhere). Subreddits to target, by name, with or without the `r/` prefix (e.g. `['marketing', 'r/startups']`), as returned by /apis/v1/ads/targeting/search?dimension=community.",
                  "items": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": "array"
                },
                "companySizes": {
                  "description": "LinkedIn B2B only. Single-letter size codes (A to I), or the full urn:li:staffCountRange:* URN from /apis/v1/ads/targeting/search?dimension=companySize.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "conversationKeywords": {
                  "description": "Reddit only (400 elsewhere). Keywords that place the ad in Reddit conversations about them, as returned by /apis/v1/ads/targeting/search?dimension=conversationKeyword.",
                  "items": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": "array"
                },
                "countries": {
                  "description": "ISO 3166-1 alpha-2 country codes (e.g. ['US']).",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "countryGroups": {
                  "description": "Meta only. Continents and trade blocs (`geo_locations.country_groups`), for targeting a whole region without listing its countries. Combines with `countries` rather than replacing it, and is also accepted under `excludedLocations`.",
                  "items": {
                    "enum": [
                      "africa",
                      "asia",
                      "europe",
                      "north_america",
                      "south_america",
                      "oceania",
                      "central_america",
                      "caribbean",
                      "eea",
                      "euro_area",
                      "nafta",
                      "mercosur",
                      "afta",
                      "apec",
                      "gcc",
                      "cisfta",
                      "emerging_markets",
                      "itunes_app_store",
                      "android_free_store",
                      "android_paid_store"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "customLocations": {
                  "description": "Point-radius (lat/lng) targeting (Meta custom_locations / Google proximity). Honoured on Meta and Google; ignored on platforms without radius support.",
                  "items": {
                    "properties": {
                      "address": {
                        "description": "Optional label, sent to Meta as `address_string`. latitude/longitude take precedence for the pin location.",
                        "type": "string"
                      },
                      "distanceUnit": {
                        "enum": [
                          "mile",
                          "kilometer"
                        ],
                        "type": "string"
                      },
                      "latitude": {
                        "maximum": 90,
                        "minimum": -90,
                        "type": "number"
                      },
                      "longitude": {
                        "maximum": 180,
                        "minimum": -180,
                        "type": "number"
                      },
                      "name": {
                        "type": "string"
                      },
                      "radius": {
                        "description": "Positive radius around the point.",
                        "type": "number"
                      }
                    },
                    "required": [
                      "distanceUnit",
                      "latitude",
                      "longitude",
                      "radius"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "excludedCommunities": {
                  "description": "Reddit only (400 elsewhere). Subreddits to exclude, named like `communities`.",
                  "items": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": "array"
                },
                "excludedConversationKeywords": {
                  "description": "Reddit only (400 elsewhere). Conversation keywords to keep the ad away from.",
                  "items": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": "array"
                },
                "excludedLocations": {
                  "description": "Geo to exclude from the audience. Mirrors the inclusion geo shape. Meta (excluded_geo_locations): excluded cities can carry a radius catchment, and excluded custom (lat/lng) pins are supported.",
                  "properties": {
                    "cities": {
                      "description": "Cities to exclude. Optional `radius` + `distanceUnit` exclude a catchment around the city (both must be set together or both omitted); Meta honours the radius on excluded cities.",
                      "items": {
                        "properties": {
                          "distanceUnit": {
                            "description": "Required if radius is set.",
                            "enum": [
                              "mile",
                              "kilometer"
                            ],
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "radius": {
                            "description": "Radius around the excluded city. Requires distanceUnit.",
                            "type": "number"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "countries": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "countryGroups": {
                      "description": "Meta only. Continents and trade blocs to exclude (`excluded_geo_locations.country_groups`).",
                      "items": {
                        "enum": [
                          "africa",
                          "asia",
                          "europe",
                          "north_america",
                          "south_america",
                          "oceania",
                          "central_america",
                          "caribbean",
                          "eea",
                          "euro_area",
                          "nafta",
                          "mercosur",
                          "afta",
                          "apec",
                          "gcc",
                          "cisfta",
                          "emerging_markets",
                          "itunes_app_store",
                          "android_free_store",
                          "android_paid_store"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "customLocations": {
                      "description": "Point-radius (lat/lng) pins to exclude (Meta excluded_geo_locations.custom_locations). Mirrors the inclusion customLocations shape.",
                      "items": {
                        "properties": {
                          "address": {
                            "description": "Optional label, sent to Meta as `address_string`. latitude/longitude take precedence for the pin location.",
                            "type": "string"
                          },
                          "distanceUnit": {
                            "enum": [
                              "mile",
                              "kilometer"
                            ],
                            "type": "string"
                          },
                          "latitude": {
                            "maximum": 90,
                            "minimum": -90,
                            "type": "number"
                          },
                          "longitude": {
                            "maximum": 180,
                            "minimum": -180,
                            "type": "number"
                          },
                          "name": {
                            "type": "string"
                          },
                          "radius": {
                            "description": "Positive radius around the point.",
                            "type": "number"
                          }
                        },
                        "required": [
                          "distanceUnit",
                          "latitude",
                          "longitude",
                          "radius"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "neighborhoods": {
                      "description": "Named neighbourhood areas to exclude. `key` from /apis/v1/ads/targeting/search.",
                      "items": {
                        "properties": {
                          "key": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "places": {
                      "description": "Named points of interest to exclude. `key` from /apis/v1/ads/targeting/search.",
                      "items": {
                        "properties": {
                          "key": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "regions": {
                      "items": {
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "zips": {
                      "items": {
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "gender": {
                  "description": "Restrict by gender. 'all' (default) targets everyone.",
                  "enum": [
                    "all",
                    "male",
                    "female"
                  ],
                  "type": "string"
                },
                "incomeTier": {
                  "description": "Normalized household-income tier (ZIP/percentile based). Meta and TikTok express all four. Google maps only `top_10` (its INCOME_RANGE_90_UP); other tiers on Google, and any income tier on LinkedIn / X / Pinterest, are rejected.",
                  "enum": [
                    "top_5",
                    "top_10",
                    "top_10_25",
                    "top_25_50"
                  ],
                  "type": "string"
                },
                "industries": {
                  "description": "LinkedIn B2B only. Industry URN id fragments, or the full urn:li:industry:* URN from /apis/v1/ads/targeting/search?dimension=industry.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "interests": {
                  "description": "Interest entities from /apis/v1/ads/targeting/search?dimension=interest. Each carries the platform's opaque id.",
                  "items": {
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "jobFunctions": {
                  "description": "LinkedIn B2B only. Function URN id fragments, or the full urn:li:function:* URN from /apis/v1/ads/targeting/search?dimension=jobFunction.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "languages": {
                  "description": "Language codes restricting the audience by language. Applied on Meta, Google, TikTok, LinkedIn, X, Pinterest and Reddit; rejected with 400 on OpenAI. A code the platform cannot target returns 400 listing the ones it can.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "metros": {
                  "description": "DMA / metro-area targeting. `key` is the platform's metro ID (e.g. Meta `DMA:807`).",
                  "items": {
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "key"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "regions": {
                  "description": "Region/state targeting. `key` is the platform location ID from /apis/v1/ads/targeting/search?dimension=geo&geoType=region. An entry may also be that id as a plain string (`\"20321\"` is `{ key: \"20321\" }`).",
                  "items": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "type": "array"
                },
                "seniorities": {
                  "description": "LinkedIn B2B only. Seniority URN id fragments, or the full urn:li:seniority:* URN from /apis/v1/ads/targeting/search?dimension=seniority.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "skills": {
                  "description": "LinkedIn B2B only. Member skills (e.g. Python, Recruiting): skill URN id fragments, or the full urn:li:skill:* URN from /apis/v1/ads/targeting/search?dimension=skill. Values are ORed; the facet is ANDed with the other facets.",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "userDevice": {
                  "description": "Meta only. Device models such as iPhone. Emitted as user_device. May also be supplied inside targeting.",
                  "items": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "minItems": 1,
                  "type": "array"
                },
                "userOs": {
                  "description": "Meta only. Operating systems and version ranges, such as iOS_ver_14.0_and_above or Android. Emitted as user_os. May also be supplied inside targeting.",
                  "items": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "minItems": 1,
                  "type": "array"
                },
                "workEmployers": {
                  "description": "Meta only. Employer entities from /apis/v1/ads/targeting/search?dimension=workEmployer.",
                  "items": {
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "workIndustries": {
                  "description": "Meta only. Work-industry entities from /apis/v1/ads/targeting/search?dimension=workIndustry. Not interchangeable with the LinkedIn `industries` URN fragments.",
                  "items": {
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "workPositions": {
                  "description": "Meta only. Job title entities from /apis/v1/ads/targeting/search?dimension=workPosition. Not interchangeable with the LinkedIn `jobTitles` URN fragments.",
                  "items": {
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "zips": {
                  "description": "Postal/ZIP targeting. `key` is the platform's postal location ID (e.g. Meta `US:94304`). Supported on Meta, Google, TikTok, Pinterest, X.",
                  "items": {
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "key"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              },
              "type": "object"
            },
            "valueRuleSetId": {
              "description": "Meta only (other platforms return 501). Value rule set to attach to this ad set, from `/apis/v1/ads/value-rule-sets`. Sending a different id replaces the current association. To DETACH, send `valueRulesApplied: false` and omit this field.",
              "pattern": "^\\d+$",
              "type": "string"
            },
            "valueRulesApplied": {
              "description": "Meta only (other platforms return 501). `false` DETACHES the ad set's value rule set and must be sent WITHOUT `valueRuleSetId`; the combination returns 400.",
              "type": "boolean"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "x-aisa-status": "enabled",
  "x-aisa-pricing": {
    "description": "Ads operations are free. Ad spend is billed by the ad platform to the connected ad account, never by AIsa.",
    "kind": "no_customer_charge"
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## 费用与请求规则

当前未提供请求参考价格；请使用接口支持的报价功能确认费用。 最终费用以账户适用价格及实际结算为准。

公开参考值不是你的账户报价或最终扣费。对于支持 X-AISA-Cost-Mode: quote 的接口，执行前请针对完整请求获取免费报价；执行后通过响应费用元数据和 Usage Logs 核对结算费用。1 USD 等于 1,000,000 个整数 micro-USD。


## OpenAPI

````yaml reference-contracts/zh/aisa-ads.json PUT /apis/v1/ads/ad-sets/{adSetId}
openapi: 3.1.0
info:
  description: ''
  title: AIsa Ads
  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: []
  x-aisa-document:
    facts_hash: fe60122939c67dc98a3a6ac6b97bd5c326b526105150c8959304dd2160d4dd09
    generator_version: '3'
    protocol_version: '1'
    schema_version: '1'
    composer_version: '27'
    response_pending: []
    document_hash: sha256:ba353f59e89e1ebabe0e301d8ef57d3cbfa6bb406a8c591ee9c3833d64b60520
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: aisa-ads
  x-aisa-catalogs:
    aisa-ads:
      title: AIsa Ads
      description: ''
      x-aisa-document:
        facts_hash: fe60122939c67dc98a3a6ac6b97bd5c326b526105150c8959304dd2160d4dd09
        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-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/ads/ad-sets/{adSetId}:
    put:
      summary: Update an ad set
      description: >-
        Ad Campaigns. Can spend money or change spend: needs the ads:spend scope
        and X-Aisa-Confirm: spend; without the header the request is refused
        with confirmation_required and nothing is sent. Changes an ad set's
        budget, bidding, schedule, targeting or status. Changes an ad set's
        settings, such as its budget, bid strategy, status or delivery options.
        At least one updatable field is required. Use it for: ABO budget
        updates. Ad-set-scoped pause/resume. Bid-strategy edits. Meta
        value-rule-set attach/detach.


        <!-- aisa-pricing:start -->

        当前未提供请求参考价格；请使用接口支持的报价功能确认费用。 最终费用以账户适用价格及实际结算为准。

        <!-- aisa-pricing:end -->
      operationId: put_aisa_ads_apis_v1_ads_ad_sets_adsetid
      parameters:
        - description: Platform ad set ID
          in: path
          name: adSetId
          required: true
          schema:
            type: string
        - description: >-
            The ads connection (adc_...) the request runs on: one of yours, from
            GET /apis/v1/ads/connections. On a request with a JSON body it may
            be sent as a top-level body member instead.
          in: query
          name: connectionId
          required: true
          schema:
            pattern: ^adc_[0-9A-Za-z]+$
            type: string
        - description: >-
            Required with the value "spend" when the request can spend money or
            change spend. Without it the request is refused with 409
            confirmation_required, which describes what would happen; nothing is
            sent to the ad platform.
          in: header
          name: X-Aisa-Confirm
          required: false
          schema:
            enum:
              - spend
            type: string
      requestBody:
        content:
          application/json:
            example:
              budget:
                amount: 10
                type: daily
              connectionId: adc_7f3k2m9q
              name: Winter launch
            schema:
              additionalProperties: true
              properties:
                bidAmount:
                  description: >-
                    Bid cap in WHOLE currency units (USD: 5 = $5.00; JPY: 100 =
                    ¥100). Required when bidStrategy is LOWEST_COST_WITH_BID_CAP
                    or COST_CAP.
                  type: number
                bidStrategy:
                  description: >-
                    Ad-set-level bid strategy. Overrides the campaign-level
                    default. Meta (facebook, instagram): supported. TikTok: the
                    Meta-style enum is mapped to bid_type / bid_price /
                    deep_bid_type automatically.
                  enum:
                    - LOWEST_COST_WITHOUT_CAP
                    - LOWEST_COST_WITH_BID_CAP
                    - COST_CAP
                    - LOWEST_COST_WITH_MIN_ROAS
                  type: string
                budget:
                  description: Omit if not updating budget
                  properties:
                    amount:
                      type: number
                    type:
                      enum:
                        - daily
                        - lifetime
                      type: string
                  type: object
                connectionId:
                  description: >-
                    The ads connection (adc_...), when not sent as the
                    connectionId query parameter.
                  pattern: ^adc_[0-9A-Za-z]+$
                  type: string
                dsaBeneficiary:
                  description: >-
                    Meta only (400 elsewhere, before anything in the request is
                    written). Writes the ad set's `dsa_beneficiary`, the legal
                    entity that benefits from its ads. Same field and limits as
                    `dsaBeneficiary` on POST /apis/v1/ads/create.
                  maxLength: 100
                  minLength: 1
                  type: string
                dsaPayor:
                  description: >-
                    Meta only (400 elsewhere, before anything in the request is
                    written). Writes the ad set's `dsa_payor`, the legal entity
                    that pays for its ads, same field and limits as `dsaPayor`
                    on POST /apis/v1/ads/create.
                  maxLength: 100
                  minLength: 1
                  type: string
                endDate:
                  description: >-
                    Reddit only. The ad group's new end_time, ISO 8601, read in
                    the ad account timezone when it has no offset; a date alone
                    means the end of that day. `null` removes the end date so
                    the ad group runs continuously.
                  type:
                    - string
                    - 'null'
                name:
                  description: >-
                    Rename the ad set. At least one of
                    budget/status/bidStrategy/name is required. Supported on
                    Meta, Google (the ad group), TikTok, LinkedIn (the
                    campaign), Pinterest, X (the line item `name`), OpenAI and
                    Reddit.
                  maxLength: 255
                  type: string
                placements:
                  description: >-
                    Meta only (400 elsewhere). Manual placements, with the same
                    object and enums as `placements` on POST
                    /apis/v1/ads/create.
                  properties:
                    audienceNetworkPositions:
                      items:
                        enum:
                          - classic
                          - rewarded_video
                        type: string
                      type: array
                    devicePlatforms:
                      items:
                        enum:
                          - mobile
                          - desktop
                        type: string
                      type: array
                    facebookPositions:
                      items:
                        enum:
                          - feed
                          - right_hand_column
                          - marketplace
                          - story
                          - search
                          - instream_video
                          - facebook_reels
                          - facebook_reels_overlay
                          - profile_feed
                          - notification
                        type: string
                      type: array
                    instagramPositions:
                      items:
                        enum:
                          - stream
                          - story
                          - explore
                          - explore_home
                          - reels
                          - profile_feed
                          - ig_search
                          - profile_reels
                        type: string
                      type: array
                    messengerPositions:
                      items:
                        enum:
                          - messenger_home
                          - sponsored_messages
                          - story
                        type: string
                      type: array
                    publisherPlatforms:
                      items:
                        enum:
                          - facebook
                          - instagram
                          - threads
                          - messenger
                          - audience_network
                          - whatsapp
                          - meta
                        type: string
                      type: array
                    threadsPositions:
                      items:
                        enum:
                          - threads_stream
                        type: string
                      type: array
                    whatsappPositions:
                      items:
                        enum:
                          - status
                        type: string
                      type: array
                  type:
                    - object
                    - 'null'
                platform:
                  description: Filled from the connection when omitted.
                  enum:
                    - facebook
                    - instagram
                    - tiktok
                    - linkedin
                    - pinterest
                    - google
                    - twitter
                    - openai
                    - reddit
                    - meta
                    - x
                  type: string
                platformSpecificData:
                  description: >-
                    Platform-specific post-launch delivery settings. The
                    platform is implied by the `platform` body param. Meta only;
                    other platforms return 400. Unknown keys are rejected.
                  properties:
                    adSchedule:
                      description: >-
                        Replaces the ad set's dayparting (Meta `adset_schedule`,
                        `pacing_type: ["day_parting"]`). An empty array removes
                        the schedule (`pacing_type: ["standard"]`). Meta runs a
                        schedule only on a lifetime budget.
                      items:
                        additionalProperties: false
                        properties:
                          dayOfWeek:
                            enum:
                              - MONDAY
                              - TUESDAY
                              - WEDNESDAY
                              - THURSDAY
                              - FRIDAY
                              - SATURDAY
                              - SUNDAY
                            type: string
                          endHour:
                            description: >-
                              Must be after startHour. 24 is midnight at the end
                              of the day.
                            maximum: 24
                            minimum: 1
                            type: integer
                          startHour:
                            maximum: 23
                            minimum: 0
                            type: integer
                          timezoneType:
                            default: USER
                            description: >-
                              Meta `timezone_type`: USER runs the hours in each
                              viewer's time zone, ADVERTISER in the ad account
                              time zone.
                            enum:
                              - USER
                              - ADVERTISER
                            type: string
                        required:
                          - dayOfWeek
                          - endHour
                          - startHour
                        type: object
                      maxItems: 168
                      type: array
                    billingEvent:
                      description: >-
                        Meta ad-set billing_event (e.g. IMPRESSIONS,
                        LINK_CLICKS, THRUPLAY).
                      type: string
                    customerLifecycle:
                      additionalProperties: false
                      description: >-
                        Meta's Customer Lifecycle Strategy on a Sales ad set
                        (Meta `ad_set_goal`). Rejected with 400 in adSetId
                        attach mode: use PUT /apis/v1/ads/ad-sets/{adSetId} for
                        an ad set that already exists.
                      properties:
                        engagedAudienceIds:
                          description: >-
                            Custom audience ids of people who engaged but have
                            not bought. Required with
                            new_customers_excluding_engaged, not allowed with
                            the other strategies. Must be yours: it is checked
                            through the connection before the request is sent,
                            and an id that is not yours answers not_found.
                          items:
                            type: string
                          type: array
                        existingCustomerAudienceIds:
                          description: >-
                            Custom audience ids that define your existing
                            customers. Required with both new_customers
                            strategies (Meta answers 400 subcode 1870251 without
                            them); not allowed with all_customers. Must be
                            yours: it is checked through the connection before
                            the request is sent, and an id that is not yours
                            answers not_found.
                          items:
                            type: string
                          type: array
                        strategy:
                          description: >-
                            `all_customers` is "Maximize conversions from all
                            customers". `new_customers` is "Acquire new
                            customers" (excludes existing customers).
                            `new_customers_excluding_engaged` also excludes
                            people who engaged with you but have not bought yet.
                          enum:
                            - all_customers
                            - new_customers
                            - new_customers_excluding_engaged
                          type: string
                      required:
                        - strategy
                      type: object
                    dailyMinSpendTarget:
                      description: >-
                        Meta `daily_min_spend_target`: the least this ad set
                        should spend per day, in whole currency units of the ad
                        account. It reserves a share of a CAMPAIGN budget for
                        one ad set, so the campaign must use Advantage campaign
                        budget (CBO).
                      type: number
                    endDate:
                      description: >-
                        Ad set end_time (ISO 8601). A value without an offset
                        (`YYYY-MM-DD`, `YYYY-MM-DD HH:MM:SS` or
                        `YYYY-MM-DDTHH:MM:SS`) is read in the ad account
                        timezone.
                      type: string
                    lifetimeMinSpendTarget:
                      description: >-
                        Meta `lifetime_min_spend_target`: the lifetime-budget
                        flavour of `dailyMinSpendTarget`, in whole currency
                        units. Send this one when the campaign budget is a
                        lifetime budget. Same rules and same rejections.
                      type: number
                    optimizationGoal:
                      description: >-
                        Meta ad-set optimization_goal (e.g. OFFSITE_CONVERSIONS,
                        LANDING_PAGE_VIEWS).
                      type: string
                    promotedObject:
                      additionalProperties: false
                      description: >-
                        Meta ad-set promoted_object (same shape as
                        /apis/v1/ads/create).
                      properties:
                        applicationId:
                          type: string
                        customConversionId:
                          type: string
                        customEventStr:
                          description: >-
                            Pixel custom-event name (custom_event_str); requires
                            customEventType OTHER. Same pairing rules as
                            /apis/v1/ads/create.
                          type: string
                        customEventType:
                          type: string
                        objectStoreUrl:
                          type: string
                        offlineConversionDataSetId:
                          type: string
                        pageId:
                          type: string
                        pixelId:
                          type: string
                        productCatalogId:
                          type: string
                        productSetId:
                          type: string
                        whatsappPhoneNumber:
                          type: string
                      type: object
                    startDate:
                      description: >-
                        Ad set start_time (ISO 8601). A value without an offset
                        (`YYYY-MM-DD`, `YYYY-MM-DD HH:MM:SS` or
                        `YYYY-MM-DDTHH:MM:SS`) is read in the ad account
                        timezone.
                      type: string
                  type: object
                regionalRegulatedCategories:
                  description: >-
                    Meta only (400 elsewhere, before anything in the request is
                    written).
                  items:
                    minLength: 1
                    type: string
                  type: array
                regionalRegulationIdentities:
                  additionalProperties:
                    type:
                      - string
                      - integer
                  description: >-
                    Meta only (400 elsewhere, before anything in the request is
                    written). Writes the ad set's
                    `regional_regulation_identities`: the Verified identity IDs
                    of the beneficiary and payer for each declared category.
                  type: object
                roasAverageFloor:
                  description: >-
                    Minimum ROAS as a decimal multiplier (2.0 = 2.0x). Required
                    when bidStrategy is LOWEST_COST_WITH_MIN_ROAS. Sent to Meta
                    as `bid_constraints.roas_average_floor` × 10000. Not
                    supported on OpenAI (422).
                  type: number
                smartTargeting:
                  description: >-
                    TikTok only (a 400 elsewhere). TikTok Smart Targeting on the
                    ad group: `audience` is TikTok's `smart_audience_enabled`,
                    `interestsBehaviors` its `smart_interest_behavior_enabled`.
                  properties:
                    audience:
                      description: TikTok smart_audience_enabled.
                      type: boolean
                    interestsBehaviors:
                      description: TikTok smart_interest_behavior_enabled.
                      type: boolean
                  type: object
                startDate:
                  description: >-
                    Reddit only: the ad group's new start_time, ISO 8601. A
                    value without an offset (`YYYY-MM-DD` or
                    `YYYY-MM-DDTHH:MM:SS`) is read in the ad account timezone.
                  type: string
                status:
                  description: >-
                    Writes the ad set's own on/off switch (Meta:
                    `configured_status`; X: the line item's `entity_status`
                    ACTIVE / PAUSED), whatever delivery status its ads report.
                    Omit if not toggling delivery state.
                  enum:
                    - active
                    - paused
                  type: string
                targeting:
                  description: >-
                    Targeting fields to change. Meta and Reddit (400 elsewhere).
                    Reddit (see the description above):
                  properties:
                    ageMax:
                      description: >-
                        Maximum age. Same per-platform application and clamping
                        as ageMin.
                      maximum: 100
                      minimum: 13
                      type: integer
                    ageMin:
                      description: >-
                        Minimum age. Applied on Meta, TikTok, Pinterest,
                        LinkedIn, X and Google Search/Display (Google excludes
                        the age ranges outside the request). Rejected with 400
                        on OpenAI, Reddit and Google Performance Max / Demand
                        Gen.
                      maximum: 100
                      minimum: 13
                      type: integer
                    audienceExclude:
                      description: >-
                        Platform audience IDs to exclude; same ID formats as
                        audienceInclude. Not supported on OpenAI (400). Must be
                        yours: it is checked through the connection before the
                        request is sent, and an id that is not yours answers
                        not_found.
                      items:
                        type: string
                      type: array
                    audienceInclude:
                      description: >-
                        Platform audience IDs to include, as returned by GET
                        /apis/v1/ads/audiences: Meta: custom audience ids.
                        TikTok: audience ids. Pinterest: customer list ids.
                        LinkedIn: segment ids (the platformAudienceId from GET
                        /apis/v1/ads/audiences). Must be yours: it is checked
                        through the connection before the request is sent, and
                        an id that is not yours answers not_found.
                      items:
                        type: string
                      type: array
                    behaviors:
                      description: >-
                        Behaviour entities from
                        /apis/v1/ads/targeting/search?dimension=behavior (Meta,
                        TikTok and LinkedIn). On TikTok they target people who,
                        in the picked categories:
                      items:
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                        type: object
                      type: array
                    cities:
                      description: >-
                        City targeting. Optional `radius` + `distanceUnit`
                        extend beyond the city limits; both must be set together
                        or both omitted. `radius` is only honoured on platforms
                        whose capability map allows city radius (Meta).
                      items:
                        oneOf:
                          - type: string
                          - properties:
                              distanceUnit:
                                description: Required if radius is set.
                                enum:
                                  - mile
                                  - kilometer
                                type: string
                              key:
                                type: string
                              name:
                                type: string
                              radius:
                                description: >-
                                  Radius around the city. Requires distanceUnit.
                                  Meta enforces a minimum city radius (~17 km /
                                  10 mi); smaller values resolve to a 0-size
                                  audience and the ad fails at launch.
                                type: number
                            required:
                              - key
                            type: object
                      type: array
                    communities:
                      description: >-
                        Reddit only (400 elsewhere). Subreddits to target, by
                        name, with or without the `r/` prefix (e.g.
                        `['marketing', 'r/startups']`), as returned by
                        /apis/v1/ads/targeting/search?dimension=community.
                      items:
                        minLength: 1
                        type: string
                      type: array
                    companySizes:
                      description: >-
                        LinkedIn B2B only. Single-letter size codes (A to I), or
                        the full urn:li:staffCountRange:* URN from
                        /apis/v1/ads/targeting/search?dimension=companySize.
                      items:
                        type: string
                      type: array
                    conversationKeywords:
                      description: >-
                        Reddit only (400 elsewhere). Keywords that place the ad
                        in Reddit conversations about them, as returned by
                        /apis/v1/ads/targeting/search?dimension=conversationKeyword.
                      items:
                        minLength: 1
                        type: string
                      type: array
                    countries:
                      description: ISO 3166-1 alpha-2 country codes (e.g. ['US']).
                      items:
                        type: string
                      type: array
                    countryGroups:
                      description: >-
                        Meta only. Continents and trade blocs
                        (`geo_locations.country_groups`), for targeting a whole
                        region without listing its countries. Combines with
                        `countries` rather than replacing it, and is also
                        accepted under `excludedLocations`.
                      items:
                        enum:
                          - africa
                          - asia
                          - europe
                          - north_america
                          - south_america
                          - oceania
                          - central_america
                          - caribbean
                          - eea
                          - euro_area
                          - nafta
                          - mercosur
                          - afta
                          - apec
                          - gcc
                          - cisfta
                          - emerging_markets
                          - itunes_app_store
                          - android_free_store
                          - android_paid_store
                        type: string
                      type: array
                    customLocations:
                      description: >-
                        Point-radius (lat/lng) targeting (Meta custom_locations
                        / Google proximity). Honoured on Meta and Google;
                        ignored on platforms without radius support.
                      items:
                        properties:
                          address:
                            description: >-
                              Optional label, sent to Meta as `address_string`.
                              latitude/longitude take precedence for the pin
                              location.
                            type: string
                          distanceUnit:
                            enum:
                              - mile
                              - kilometer
                            type: string
                          latitude:
                            maximum: 90
                            minimum: -90
                            type: number
                          longitude:
                            maximum: 180
                            minimum: -180
                            type: number
                          name:
                            type: string
                          radius:
                            description: Positive radius around the point.
                            type: number
                        required:
                          - distanceUnit
                          - latitude
                          - longitude
                          - radius
                        type: object
                      type: array
                    excludedCommunities:
                      description: >-
                        Reddit only (400 elsewhere). Subreddits to exclude,
                        named like `communities`.
                      items:
                        minLength: 1
                        type: string
                      type: array
                    excludedConversationKeywords:
                      description: >-
                        Reddit only (400 elsewhere). Conversation keywords to
                        keep the ad away from.
                      items:
                        minLength: 1
                        type: string
                      type: array
                    excludedLocations:
                      description: >-
                        Geo to exclude from the audience. Mirrors the inclusion
                        geo shape. Meta (excluded_geo_locations): excluded
                        cities can carry a radius catchment, and excluded custom
                        (lat/lng) pins are supported.
                      properties:
                        cities:
                          description: >-
                            Cities to exclude. Optional `radius` +
                            `distanceUnit` exclude a catchment around the city
                            (both must be set together or both omitted); Meta
                            honours the radius on excluded cities.
                          items:
                            properties:
                              distanceUnit:
                                description: Required if radius is set.
                                enum:
                                  - mile
                                  - kilometer
                                type: string
                              key:
                                type: string
                              radius:
                                description: >-
                                  Radius around the excluded city. Requires
                                  distanceUnit.
                                type: number
                            required:
                              - key
                            type: object
                          type: array
                        countries:
                          items:
                            type: string
                          type: array
                        countryGroups:
                          description: >-
                            Meta only. Continents and trade blocs to exclude
                            (`excluded_geo_locations.country_groups`).
                          items:
                            enum:
                              - africa
                              - asia
                              - europe
                              - north_america
                              - south_america
                              - oceania
                              - central_america
                              - caribbean
                              - eea
                              - euro_area
                              - nafta
                              - mercosur
                              - afta
                              - apec
                              - gcc
                              - cisfta
                              - emerging_markets
                              - itunes_app_store
                              - android_free_store
                              - android_paid_store
                            type: string
                          type: array
                        customLocations:
                          description: >-
                            Point-radius (lat/lng) pins to exclude (Meta
                            excluded_geo_locations.custom_locations). Mirrors
                            the inclusion customLocations shape.
                          items:
                            properties:
                              address:
                                description: >-
                                  Optional label, sent to Meta as
                                  `address_string`. latitude/longitude take
                                  precedence for the pin location.
                                type: string
                              distanceUnit:
                                enum:
                                  - mile
                                  - kilometer
                                type: string
                              latitude:
                                maximum: 90
                                minimum: -90
                                type: number
                              longitude:
                                maximum: 180
                                minimum: -180
                                type: number
                              name:
                                type: string
                              radius:
                                description: Positive radius around the point.
                                type: number
                            required:
                              - distanceUnit
                              - latitude
                              - longitude
                              - radius
                            type: object
                          type: array
                        neighborhoods:
                          description: >-
                            Named neighbourhood areas to exclude. `key` from
                            /apis/v1/ads/targeting/search.
                          items:
                            properties:
                              key:
                                type: string
                            required:
                              - key
                            type: object
                          type: array
                        places:
                          description: >-
                            Named points of interest to exclude. `key` from
                            /apis/v1/ads/targeting/search.
                          items:
                            properties:
                              key:
                                type: string
                            required:
                              - key
                            type: object
                          type: array
                        regions:
                          items:
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                            type: object
                          type: array
                        zips:
                          items:
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                            type: object
                          type: array
                      type: object
                    gender:
                      description: Restrict by gender. 'all' (default) targets everyone.
                      enum:
                        - all
                        - male
                        - female
                      type: string
                    incomeTier:
                      description: >-
                        Normalized household-income tier (ZIP/percentile based).
                        Meta and TikTok express all four. Google maps only
                        `top_10` (its INCOME_RANGE_90_UP); other tiers on
                        Google, and any income tier on LinkedIn / X / Pinterest,
                        are rejected.
                      enum:
                        - top_5
                        - top_10
                        - top_10_25
                        - top_25_50
                      type: string
                    industries:
                      description: >-
                        LinkedIn B2B only. Industry URN id fragments, or the
                        full urn:li:industry:* URN from
                        /apis/v1/ads/targeting/search?dimension=industry.
                      items:
                        type: string
                      type: array
                    interests:
                      description: >-
                        Interest entities from
                        /apis/v1/ads/targeting/search?dimension=interest. Each
                        carries the platform's opaque id.
                      items:
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                        type: object
                      type: array
                    jobFunctions:
                      description: >-
                        LinkedIn B2B only. Function URN id fragments, or the
                        full urn:li:function:* URN from
                        /apis/v1/ads/targeting/search?dimension=jobFunction.
                      items:
                        type: string
                      type: array
                    languages:
                      description: >-
                        Language codes restricting the audience by language.
                        Applied on Meta, Google, TikTok, LinkedIn, X, Pinterest
                        and Reddit; rejected with 400 on OpenAI. A code the
                        platform cannot target returns 400 listing the ones it
                        can.
                      items:
                        type: string
                      type: array
                    metros:
                      description: >-
                        DMA / metro-area targeting. `key` is the platform's
                        metro ID (e.g. Meta `DMA:807`).
                      items:
                        properties:
                          key:
                            type: string
                          name:
                            type: string
                        required:
                          - key
                        type: object
                      type: array
                    regions:
                      description: >-
                        Region/state targeting. `key` is the platform location
                        ID from
                        /apis/v1/ads/targeting/search?dimension=geo&geoType=region.
                        An entry may also be that id as a plain string
                        (`"20321"` is `{ key: "20321" }`).
                      items:
                        oneOf:
                          - type: string
                          - properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                            type: object
                      type: array
                    seniorities:
                      description: >-
                        LinkedIn B2B only. Seniority URN id fragments, or the
                        full urn:li:seniority:* URN from
                        /apis/v1/ads/targeting/search?dimension=seniority.
                      items:
                        type: string
                      type: array
                    skills:
                      description: >-
                        LinkedIn B2B only. Member skills (e.g. Python,
                        Recruiting): skill URN id fragments, or the full
                        urn:li:skill:* URN from
                        /apis/v1/ads/targeting/search?dimension=skill. Values
                        are ORed; the facet is ANDed with the other facets.
                      items:
                        type: string
                      type: array
                    userDevice:
                      description: >-
                        Meta only. Device models such as iPhone. Emitted as
                        user_device. May also be supplied inside targeting.
                      items:
                        minLength: 1
                        type: string
                      minItems: 1
                      type: array
                    userOs:
                      description: >-
                        Meta only. Operating systems and version ranges, such as
                        iOS_ver_14.0_and_above or Android. Emitted as user_os.
                        May also be supplied inside targeting.
                      items:
                        minLength: 1
                        type: string
                      minItems: 1
                      type: array
                    workEmployers:
                      description: >-
                        Meta only. Employer entities from
                        /apis/v1/ads/targeting/search?dimension=workEmployer.
                      items:
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                        type: object
                      type: array
                    workIndustries:
                      description: >-
                        Meta only. Work-industry entities from
                        /apis/v1/ads/targeting/search?dimension=workIndustry.
                        Not interchangeable with the LinkedIn `industries` URN
                        fragments.
                      items:
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                        type: object
                      type: array
                    workPositions:
                      description: >-
                        Meta only. Job title entities from
                        /apis/v1/ads/targeting/search?dimension=workPosition.
                        Not interchangeable with the LinkedIn `jobTitles` URN
                        fragments.
                      items:
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                        type: object
                      type: array
                    zips:
                      description: >-
                        Postal/ZIP targeting. `key` is the platform's postal
                        location ID (e.g. Meta `US:94304`). Supported on Meta,
                        Google, TikTok, Pinterest, X.
                      items:
                        properties:
                          key:
                            type: string
                          name:
                            type: string
                        required:
                          - key
                        type: object
                      type: array
                  type: object
                valueRuleSetId:
                  description: >-
                    Meta only (other platforms return 501). Value rule set to
                    attach to this ad set, from `/apis/v1/ads/value-rule-sets`.
                    Sending a different id replaces the current association. To
                    DETACH, send `valueRulesApplied: false` and omit this field.
                  pattern: ^\d+$
                  type: string
                valueRulesApplied:
                  description: >-
                    Meta only (other platforms return 501). `false` DETACHES the
                    ad set's value rule set and must be sent WITHOUT
                    `valueRuleSetId`; the combination returns 400.
                  type: boolean
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  bidAmount:
                    type:
                      - number
                      - 'null'
                  bidStrategy:
                    description: >-
                      Meta bid strategy. Same enum applies at campaign and
                      ad-set level; ad-set value (when set) overrides
                      campaign-level. Cross-field rules:
                      `LOWEST_COST_WITHOUT_CAP` (default): auto-bid, forbids
                      `bidAmount` and `roasAverageFloor`.
                    enum:
                      - LOWEST_COST_WITHOUT_CAP
                      - LOWEST_COST_WITH_BID_CAP
                      - COST_CAP
                      - LOWEST_COST_WITH_MIN_ROAS
                    type: string
                  budget:
                    description: >-
                      Budget amount in the ad account's native currency (see the
                      campaign's `currency` field for the code).
                    properties:
                      amount:
                        type: number
                      type:
                        enum:
                          - daily
                          - lifetime
                        type: string
                    required:
                      - amount
                      - type
                    type: object
                  budgetLevel:
                    enum:
                      - adset
                    type: string
                  endDate:
                    description: >-
                      Reddit: the end_time written, a UTC instant, or null when
                      the end date was removed. Present when `endDate` was sent.
                    type:
                      - string
                      - 'null'
                  platformAdSetStatus:
                    description: >-
                      The ad set's status read back from the platform, as in PUT
                      /apis/v1/ads/ad-sets/{adSetId}/status (Meta and Reddit
                      return the ad set's effective_status); null when it could
                      not be read.
                    type:
                      - string
                      - 'null'
                  platformCampaignStatus:
                    type:
                      - string
                      - 'null'
                  platformSpecificData:
                    type: object
                  roasAverageFloor:
                    type:
                      - number
                      - 'null'
                  startDate:
                    description: >-
                      Reddit: the start_time written, a UTC instant. Present
                      when `startDate` was sent.
                    type: string
                  status:
                    description: >-
                      As in PUT /apis/v1/ads/ad-sets/{adSetId}/status: delivery
                      derived from the switches read back.
                    enum:
                      - active
                      - paused
                    type: string
                  statusReadAt:
                    format: date-time
                    type:
                      - string
                      - 'null'
                  statusSkipped:
                    description: >-
                      1 when a live read showed it already in the requested
                      state.
                    enum:
                      - 0
                      - 1
                    type: integer
                  statusSkippedReasons:
                    items:
                      type: string
                    type: array
                  statusUpdated:
                    description: 1 when the ad set's switch was written.
                    enum:
                      - 0
                      - 1
                    type: integer
                  targeting:
                    description: >-
                      Present when `placements` or `targeting` was sent. The ad
                      set's full targeting as written, in the platform's own
                      vocabulary (Meta or Reddit snake_case). Stored as the ad
                      set's `targeting`. Meta stores the same object on its ads.
                    type: object
                type: object
          description: Ad set updated
        default:
          content:
            application/json:
              schema:
                properties:
                  error:
                    properties:
                      code:
                        type:
                          - string
                          - 'null'
                      details:
                        additionalProperties: {}
                        type:
                          - object
                          - 'null'
                      message:
                        type:
                          - string
                          - 'null'
                      param:
                        type:
                          - string
                          - 'null'
                      retryHint:
                        type:
                          - string
                          - 'null'
                      retryable:
                        type:
                          - boolean
                          - 'null'
                      type:
                        type:
                          - string
                          - 'null'
                    type:
                      - object
                      - 'null'
                type: object
          description: Error. The code field is stable; see the error catalog.
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

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