بنقرة واحدة
export
// Export Spotify Ads API campaign data to CSV — full campaign hierarchies with ad sets, ads, targeting, budgets, and performance metrics for offline review, campaign analysis, or budget reconciliation.
// Export Spotify Ads API campaign data to CSV — full campaign hierarchies with ad sets, ads, targeting, budgets, and performance metrics for offline review, campaign analysis, or budget reconciliation.
Manage Spotify Ads API ad sets and ads — list, create, get, or update.
This 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.
Create a full campaign (campaign + ad sets + ads) from a plain-text description. Parses natural language into structured API calls.
Pull Spotify Ads API reporting data — aggregate metrics, audience insights, or async CSV reports.
Check Spotify Ads API campaign health — pacing, delivery issues, budget burn rate, stalled campaigns, and underpacing alerts. Use for one-shot health checks or recurring monitoring when the host supports scheduled automations.
Generate Spotify Ads campaign strategy from a landing page, product or business page, brand brief, location page, uploaded creative assets, existing Spotify Ads assets, or a natural-language business goal. Use when the user asks for the best campaign structure, targeting plan, audience plan, budget split, creative rotation, API-ready campaign plan, or pre-build recommendations before creating Spotify campaigns.
| name | export |
| description | Export Spotify Ads API campaign data to CSV — full campaign hierarchies with ad sets, ads, targeting, budgets, and performance metrics for offline review, campaign analysis, or budget reconciliation. |
| argument-hint | [campaign_id] [--metrics] [--date-range <start> <end>] |
| allowed-tools | ["Read","Bash","AskUserQuestion"] |
Export campaign hierarchies to CSV for offline review, combining entity data with optional performance metrics.
access_token, ad_account_id, and auto_execute from the active platform settings file:
.codex/spotify-ads-api.local.md, then fall back to .claude/spotify-ads-api.local.md..claude/spotify-ads-api.local.md, then fall back to .codex/spotify-ads-api.local.md.https://api-partner.spotify.com/ads/v3/spotify-ads-api:configure first.version: .codex-plugin/plugin.json on Codex or .claude-plugin/plugin.json on Claude.SDK_PRODUCT to codex-plugin on Codex or claude-code-plugin on Claude. Set SDK_HEADER="X-Spotify-Ads-Sdk: $SDK_PRODUCT/$PLUGIN_VERSION" and include -H "$SDK_HEADER" on all API requests.<campaign_id> (UUID) → Export a specific campaign--metrics → Include performance metrics (impressions, spend, reach, etc.)--date-range <start> <end> → Metric date range (ISO 8601). Default: last 30 days.Ask the user to confirm:
./spotify-ads-export-YYYY-MM-DD.csv, or user-specified path.Fetch all entity data with full pagination. Unlike other skills that show the first page, export must retrieve every entity to produce a complete file.
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/campaigns?limit=50&offset=0"
Check paging.total_results in the response. If total_results > 50, make additional requests incrementing offset by 50 until all campaigns are fetched. For a single-campaign export, use:
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/campaigns/$CAMPAIGN_ID"
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/ad_sets?limit=50&offset=0"
For a single campaign: add &campaign_ids=$CAMPAIGN_ID. Paginate with offset until all ad sets are fetched.
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/ads?limit=50&offset=0"
For a single campaign: add &campaign_ids=$CAMPAIGN_ID. Paginate with offset until all ads are fetched.
When metrics are included, fetch aggregate reports at each entity level. For a single-campaign export, add entity_ids=$CAMPAIGN_ID&entity_ids_type=CAMPAIGN to every report request so the export does not rely on the first unfiltered page containing the requested campaign's metrics.
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/aggregate_reports?\
entity_type=CAMPAIGN&\
fields=IMPRESSIONS&fields=SPEND&fields=CLICKS&fields=REACH&fields=FREQUENCY&fields=CTR&fields=COMPLETES&\
granularity=LIFETIME&\
entity_status_type=CAMPAIGN&\
limit=50"
If a date range is specified, switch to granularity=DAY and add &report_start=<start>&report_end=<end>.
Use UTC midnight timestamps such as 2026-05-01T00:00:00Z. Do not send report_start or report_end with granularity=LIFETIME.
Paginate with continuation_token if present in the response.
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/aggregate_reports?\
entity_type=AD_SET&\
fields=IMPRESSIONS&fields=SPEND&fields=CLICKS&fields=REACH&fields=FREQUENCY&fields=COMPLETES&fields=COMPLETION_RATE&\
granularity=LIFETIME&\
entity_status_type=AD_SET&\
include_parent_entity=true&\
limit=50"
For a single-campaign export, add &entity_ids=$CAMPAIGN_ID&entity_ids_type=CAMPAIGN. Paginate with continuation_token if present in the response.
curl -s -w "\nHTTP_STATUS:%{http_code}" -H "Authorization: Bearer $TOKEN" \
-H "$SDK_HEADER" \
"$BASE_URL/ad_accounts/$AD_ACCOUNT_ID/aggregate_reports?\
entity_type=AD&\
fields=IMPRESSIONS&fields=SPEND&fields=CLICKS&fields=REACH&\
granularity=LIFETIME&\
entity_status_type=AD&\
include_parent_entity=true&\
limit=50"
For a single-campaign export, add &entity_ids=$CAMPAIGN_ID&entity_ids_type=CAMPAIGN. Paginate with continuation_token if present.
The CSV is denormalized — one row per ad, with campaign and ad set data repeated on each row. Ad sets with no ads get a row with blank ad columns.
Entity columns:
campaign_id, campaign_name, campaign_status, campaign_objectivead_set_id, ad_set_name, ad_set_status, ad_set_format, ad_set_budget_type, ad_set_budget_amount, ad_set_bid_strategy, ad_set_bid_amount, ad_set_start_time, ad_set_end_time, ad_set_deliveryad_set_geo_country, ad_set_geo_regions, ad_set_age_min, ad_set_age_max, ad_set_platforms, ad_set_placements, ad_set_gendersad_id, ad_name, ad_status, ad_delivery, ad_tagline, ad_advertiser_name, ad_cta_key, ad_cta_urlMetric columns (when --metrics is used):
impressions, spend, clicks, reach, frequency, ctr, completes, completion_ratemicro_amount by 1,000,000 to display in dollars (e.g., 50000000 → 50.00).aggregate_reports are already in dollars — display directly.ad_set_geo_country = country code string, ad_set_geo_regions = comma-separated region/DMA/city names if available (IDs if names are not in the response).min and max into ad_set_age_min and ad_set_age_max."ANDROID,DESKTOP,IOS")."").Match entities by ID:
ad_set_id) which belongs to a campaign (via campaign_id).entity_id from the report rows to the entity's id.Write the CSV header and rows with a structured CSV writer. Prefer Python's standard csv module, or use jq @csv if all rows are already available as JSON. Do not build CSV rows with echo or string concatenation; that will corrupt values containing commas, quotes, or newlines.
Example Python shape:
import csv
columns = [
"campaign_id", "campaign_name", "campaign_status", "campaign_objective",
"ad_set_id", "ad_set_name", "ad_set_status", "ad_set_format",
"ad_set_budget_type", "ad_set_budget_amount", "ad_set_start_time",
"ad_set_end_time", "ad_id", "ad_name", "ad_status", "ad_delivery",
"impressions", "spend", "clicks", "reach",
]
with open(output_path, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=columns, extrasaction="ignore")
writer.writeheader()
writer.writerows(rows)
Build rows from parsed API JSON before writing. Let the CSV writer handle quoting and escaping.
After writing the file, display:
Export complete: ./spotify-ads-export-2026-05-14.csv
Campaigns: 3
Ad Sets: 7
Ads: 12
Metrics included: Yes (lifetime, last 30 days)
File size: 4.2 KB
auto_execute is true, execute all API calls directly and write the file.auto_execute is false, present the curl commands for the first fetch and ask for confirmation before executing. After confirmation, execute all remaining fetches without additional prompts.HTTP_STATUS: line from curl output to determine success or failure before interpreting the response body./spotify-ads-api:report async-create./spotify-ads-api:dashboard./spotify-ads-api:bulk for batch changes.