/spotify-ads-api:build-campaign <plain-text campaign description>from spotify-ads-api
Parses plain-text campaign descriptions into structured Spotify Ads API calls, creating campaign, ad sets, and ads. Prefers a draft workflow with batch validation and explicit publish confirmation.
Ships in spotify-ads-api. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Given a plain-text description of an advertising campaign, parse it into structured API calls and create the full campaign hierarchy: Campaign → Ad Sets → Ads.
By default, use the draft workflow for all campaign hierarchy creation. This creates draft entities first, validates the entire hierarchy, and only publishes after confirmation. Route to the /spotify-ads-api:drafts build <description> skill to execute the draft flow.
The draft flow is preferred because:
Publishing a draft always requires explicit user confirmation immediately before the PUBLISH request, even when auto_execute is enabled.
Only use the direct creation flow below if the user explicitly asks to skip drafts or create live entities immediately. If a direct write is denied, do not infer that the credentials are read-only; offer the draft workflow instead.
Set the plugin root and define the request wrapper:
PLUGIN_ROOT="${CODEX_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-.}}"
api() { "$PLUGIN_ROOT/scripts/api-request.sh" build-campaign "$@"; }
Before the first Ads API v3 call, read and follow $PLUGIN_ROOT/skills/api-reference/references/live-openapi.md.
Before sending any output to a human user, read and follow $PLUGIN_ROOT/skills/api-reference/references/language-standards.md.
Also read $PLUGIN_ROOT/skills/api-reference/references/api-behaviors.md for API behaviour the spec does not express (Reserved pricing, estimates, geo lookup, draft VALIDATE/PUBLISH).
Critical rules:
targets.placements).placements when creating an ad set and on every audience estimate, using only values the ad product catalog allows for that product's ad sets (and any narrower limit the objective's spec description states). On ad set updates, keep a valid placements in the merged result.draft_hierarchy_version from the draft campaign.start_time values well clear of the ad product catalog's minimum lead time, and recheck staged start times against the current UTC time immediately before each VALIDATE and PUBLISH.To retrieve settings values (TOKEN, AD_ACCOUNT_ID, AUTO_EXECUTE, BASE_URL, SDK_HEADER, SKILL_HEADER, PLUGIN_VERSION) for use outside API calls, run api --env. The output is eval-safe, so eval $(api --env) assigns them all.
Extract the following from the user's plain-text input. If a field is missing or ambiguous, use the defaults noted below. If a required field cannot be inferred, ask the user.
| Field | Required | Default |
|---|---|---|
| name | yes | — |
| objective | yes | REACH |
| ad_product | no | UNSET (resolves to AUCTION) |
Valid objectives: REACH, CLICKS, VIDEO_VIEWS, CONVERSIONS, LEAD_GEN, EVEN_IMPRESSION_DELIVERY, PODCAST_STREAMS, APP_INSTALLS, WEBSITE_VISITS
| Field | Required | Default | Notes |
|---|---|---|---|
| name | yes | — | 2-200 chars |
| start_time | yes | — | ISO 8601 UTC, well clear of the catalog's minimum lead time |
| end_time | required if LIFETIME | — | ISO 8601 UTC |
| budget.micro_amount | yes | — | Amount (in ad account's billing currency) x 1,000,000 |
| budget.type | yes | DAILY | DAILY or LIFETIME |
| asset_format | yes | AUDIO | AUDIO, VIDEO, IMAGE, or CATALOG |
| category | yes | — | Valid ADV_X_Y code (fetch from GET /ad_categories if needed) |
| bid_strategy | yes | MAX_BID | Plain string: MAX_BID, COST_PER_RESULT, AUTOBID, or UNSET |
| bid_micro_amount | yes with MAX_BID/COST_PER_RESULT | 15000000 | Bid cap in micro-units. Omitted with AUTOBID; this applies only to ad set payloads, not audience estimates. |
| pacing | no | PACING_EVEN | PACING_EVEN or PACING_ASAP |
| delivery | no | ON | ON or OFF |
| targets.age_ranges | yes | [{"min":18,"max":54}] | Array of {min, max} objects |
| targets.geo_targets | yes | {"country_code":"US"} | Flat object with country_code string |
| targets.platforms | no | ["ANDROID","DESKTOP","IOS"] | Valid: ANDROID, DESKTOP, IOS |
| targets.placements | yes | ["MUSIC"] | MUSIC or PODCAST |
| targets.genders | no | [] | MALE, FEMALE, NON_BINARY |
Ad set validation guardrails:
budget.micro_amount and bid_micro_amount must be positive when present.currency in ad set budget; currency is only required in /estimates/audience budget payloads.cost_model, skippable, is_skippable, or ad_platforms in ad set create payloads.ANDROID, DESKTOP, and IOS in targets.platforms; never use WEB, MOBILE, or CONNECTED_DEVICE.min >= 18 for age ranges unless the user explicitly confirms a market/category that allows minors.city_ids, postal_code_ids, region_ids), include country_code in the same geo_targets object.bid_strategy=UNSET, omit bid_micro_amount unless the current API contract or user-provided source requires it. For Reserved buys, follow the live product rules and use the fixed rate returned by reserved_prices as bid_micro_amount.For Reserved buys, follow skills/api-reference/references/api-behaviors.md (Reserved Pricing and Forecasting) before confirming the plan or creating ad sets. Fetch the rate for each distinct product, date, format, and targeting; use its cost_micro as the ad set and audience estimate bid_micro_amount. Resolve campaign, ad set, and forecast fields from the current OpenAPI contract and live ad product catalog rather than using auction defaults. Show the fixed rate separately from any forecast CPM or bid suggestion.
| Field | Required | Notes |
|---|---|---|
| name | yes | 2-200 chars |
| tagline | yes (optional for drafts) | 2-40 chars |
| advertiser_name | yes | 2-25 chars |
| assets.asset_id | yes (optional for drafts) | UUID — prompt user to select |
| assets.logo_asset_id | yes | UUID — prompt user to select |
| assets.companion_asset_id | yes (audio) | UUID — required for AUDIO format ads |
| call_to_action.key | yes | e.g. SHOP_NOW, LEARN_MORE, LISTEN_NOW, SIGN_UP |
| call_to_action.clickthrough_url | yes (optional for drafts) | Landing page URL |
| delivery | no | ON (default) or OFF |
Read and follow
$PLUGIN_ROOT/skills/api-reference/references/ad-product-validation.md. Fetch the live
catalog once for this workflow, resolve the planned campaign's product, and use the
applicable rules while constructing the plan. Do not display a per-field checklist.
Before making any mutating API calls, present the full parsed plan as a visual tree:
Campaign: "My Campaign" (objective: REACH)
├── Ad Set 1: "Ad Set A" (AUDIO, $75/day, US, ages 25-54, Mar 1 start)
│ └── Ad 1: "My Ad" → SHOP_NOW → example.com
└── Ad Set 2: "Ad Set B" (VIDEO, $500 lifetime, US, ages 18-54, Mar 4–Apr 4)
└── Ad 2: "My Video Ad" → LEARN_MORE → example.com
Also show a table with all field values for each entity. Ask the user to confirm or adjust.
If the ad category was not specified, ask the user to select one using AskUserQuestion.
You can fetch valid categories from GET /ad_categories to present options.
After the user confirms the plan but before creating any entities, run an audience estimate for each ad set's targeting. For Reserved buys, use the fixed rate fetched while planning, then add ad_product, end_date, and the returned cost_micro as bid_micro_amount to the estimate request; use the returned currency and resolve other fields from the live contract and catalog. The generic example below is for auction buys.
api POST "estimates/audience" \
'{
"ad_account_id": "<AD_ACCOUNT_ID>",
"start_date": "<start_time>",
"asset_format": "<AUDIO|VIDEO|IMAGE|CATALOG>",
"objective": "<campaign_objective>",
"bid_strategy": "<MAX_BID|COST_PER_RESULT|AUTOBID|UNSET>",
"bid_micro_amount": <bid>,
"budget": {"micro_amount": <budget>, "type": "<DAILY|LIFETIME>", "currency": "USD"},
"targets": { <same targets object as the ad set> }
}'
Estimate payload checks (most estimate 400s come from these): send the request body as one JSON object containing every field the live spec marks required for POST /estimates/audience; set budget.currency to the ad account's billing currency (never omit it); always include bid_micro_amount, even when bid_strategy is AUTOBID (the AUTOBID no-bid exception applies only to ad set payloads); always send targets.placements with at least one placement the ad product catalog allows for the chosen ad product; and omit targets.platforms when the catalog does not allow platform targeting for that product.
Important: This endpoint is NOT scoped under /ad_accounts/{id}/ — it's at the top level: POST /estimates/audience. Use the base URL directly followed by /estimates/audience.
Display the estimate results in a summary:
Audience Estimate for "Ad Set A":
Projected unique users: ~142,000
Estimated daily reach: 8,500 – 12,000
Estimated daily impressions: 15,000 – 22,000
Estimated CPM: $12.50 – $18.00
Likely to deliver budget: Yes
Convert any CPM micro-amounts to the ad account's billing currency for display.
If the audience is too small (very low projected_unique_users or the API returns a 400 error indicating audience too small), warn the user and suggest:
If the API returned "Min audience threshold was not met", follow rule 9 under Critical Schema Notes: do not resend the same request, do not widen the targeting on your own, and only offer to adjust targeting (then re-estimate) or cancel. "Proceed anyway" is only for an estimate that came back valid but low.
Use AskUserQuestion to ask whether to:
Run the estimate for each ad set in the plan before proceeding to Step 3.
For each ad, fetch available assets from the account:
api GET "ad_accounts/{ad_account_id}/assets?limit=50&sort_direction=DESC"
Present audio/video assets and image assets separately in tables, and ask the user to pick:
asset_format: audio for AUDIO, video for VIDEO, etc.)Using the catalog loaded in Step 1.5, validate the complete campaign, ad set, and ad request bodies now that assets and all dependent fields are known. Apply the canonical procedure's static and runtime checks, including asset lookups and the audience estimate above. Never send a known-invalid request.
Do not add another confirmation or print per-field successes. If the existing plan summary is still visible, one compact validation status line is sufficient. Surface a failure only when an explicit user choice must change or no safe compliant value can be inferred.
Execute each step in order, passing IDs forward from each response.
Include ad_product when the resolved destination product is CONTENT or FPMNG. Omit it
for the default AUCTION flow.
api POST "ad_accounts/{ad_account_id}/campaigns" \
'{"name":"...","objective":"..."}'
Extract the campaign id from the response.
api POST "ad_accounts/{ad_account_id}/ad_sets" \
'{
"name": "...",
"campaign_id": "<from step 4a>",
"start_time": "...",
"end_time": "...",
"budget": {"micro_amount": ..., "type": "..."},
"asset_format": "...",
"category": "ADV_X_Y",
"targets": {
"age_ranges": [{"min": ..., "max": ...}],
"geo_targets": {"country_code": "..."},
"platforms": ["ANDROID", "DESKTOP", "IOS"],
"placements": ["MUSIC"]
},
"bid_strategy": "MAX_BID",
"bid_micro_amount": ...,
"pacing": "PACING_EVEN",
"delivery": "ON"
}'
Extract each ad set id for use in ad creation.
api POST "ad_accounts/{ad_account_id}/ads" \
'{
"name": "...",
"ad_set_id": "<from step 4b>",
"tagline": "...",
"advertiser_name": "...",
"assets": {
"asset_id": "...",
"logo_asset_id": "...",
"companion_asset_id": "..."
},
"call_to_action": {
"key": "SHOP_NOW",
"clickthrough_url": "https://..."
},
"delivery": "ON"
}'
After all entities are created, display a final summary table:
| Entity | ID | Name | Status |
|---|---|---|---|
| Campaign | uuid | ... | ... |
| Ad Set 1 | uuid | ... | ... |
| ↳ Ad 1 | uuid | ... | ... |
| Ad Set 2 | uuid | ... | ... |
| ↳ Ad 2 | uuid | ... | ... |
auto_execute is true, execute each API call directly after presenting the plan.auto_execute is false, present the full plan and ask for confirmation before
executing. Then execute all calls in sequence without additional confirmation per call.HTTP_STATUS: line from curl output to determine success or failure before interpreting the response body.These are non-obvious API requirements that MUST be followed:
bid_strategy is a plain STRING enum, NOT an object. Valid: MAX_BID, COST_PER_RESULT, AUTOBID, UNSETgeo_targets is a flat object {"country_code": "US"}, NOT an array of objectsplatforms valid values are ANDROID, DESKTOP, IOS — NOT "MOBILE" or "CONNECTED_DEVICE"category is required on ad sets — must be a valid ADV_X_Y code from GET /ad_categoriesend_time is required when budget type is LIFETIMEcompanion_asset_id is required when creating ads for AUDIO ad setscall_to_action uses field name key (not type) and clickthrough_url (not url)bid_suggestion if the response includes one, then estimate again with the targeting the user chooses.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
20 skills in this plugin
/account-adminAdminister Spotify Ads API businesses and ad accounts: discover businesses and accounts, inspect or update supported profile and billing fields, create businesses or ad accounts, list members and roles, invite users, assign ad-account access, update roles, cancel invitations, and remove access. Use when a user asks to find an ad account by ID, audit access, onboard an agency or teammate, manage business/ad-account membership, or update supported account identity details./adsList or get Spotify Ads API ad sets and ads, and stage their creation or updates through drafts by default. Use direct live writes only when explicitly requested./spotify-ads-api-referenceThis skill should be used when the user asks to "call the Spotify Ads API", "create a Spotify ad campaign", "manage Spotify ads", "pull Spotify ad reports", "set up ad sets or ads", "upload ad assets", "target audiences on Spotify", "check campaign status", "get ad account info", "look up API schema or fields", "check what targeting options exist", or asks about Spotify advertising endpoints, request/response formats, enum values, or authentication.npx claudepluginhub spotify/ads-agentic-tools --plugin spotify-ads-apiOther plugins' skills for the same job