Run Paid Ads from Claude Code: The Terminal-First Ad-Ops Playbook
Step-by-step playbook for Google, Meta, and LinkedIn ad ops from Claude Code in your terminal — read-before-write rollout, weekly rituals, what stays human.

Sections
Six-figure monthly spend, managed from a terminal window. That claim circulates on every growth-ops Slack these days. It is real. The version people are imagining (type a prompt, ads run themselves) skips the part that makes it safe. This playbook covers how to actually do it: the rollout phases, the per-platform setup, and where to draw the line on automation.
TL;DR: You can move the repetitive execution of paid ads into Claude Code running locally on your machine. The edge is not the automation scripts. It is the strategy knowledge loaded alongside them. Roll out in phases: read first, write only once audits match your own read. Never remove yourself from the approval loop on anything that touches live budget.
What this actually is — and what it is not
Claude Code is a CLI tool that runs on your machine (official docs). It is not the claude.ai chat tab in your browser. The chat app has no access to your local file system, API keys, or scripts. Claude Code does.
A "skill" in this context is a folder that teaches the agent one job. It contains:
- Strategy files: the knowledge layer: what a healthy search term report looks like, when a CTR drop signals creative fatigue vs. audience exhaustion, how to read a quality score breakdown.
- Python scripts: thin wrappers around the Google Ads API, Meta Marketing API, LinkedIn Marketing API.
- Routing logic: a manifest that tells the agent which script to run for which kind of request.
The knowledge layer is the real edge. The scripts are commodity. Anyone can write google_ads_client.get_keyword_performance(). The question is whether the agent knows what to do with the output.

What you need before you start
Minimum requirements:
- Claude Code installed via npm or Homebrew, authenticated with a Pro or Max subscription.
- Python 3.10+ with a virtualenv per skill (keeps dependencies isolated).
- API access for each platform you want to touch.
On that last point: reading strategy and asking for audits works immediately once credentials are in place. Actually touching live accounts requires platform approval, and approval timelines vary:
- Meta and Google move fast. Developer accounts can be in place same day.
- LinkedIn Advertising API can take a day or two. Request access to the Advertising API product on your LinkedIn app before you need it. Do not wait until you want to run the workflow.
For cold traffic campaigns on multiple platforms, plan a week of setup before expecting any live writes.
The four-phase rollout — do not skip steps
Phase 1: Clone and onboard
Set up the skill folder structure locally. Add strategy files first: the brief for each platform, your naming conventions, your bid targets, your conversion rate benchmarks. The agent reads this context before every task.
Phase 2: Connect accounts
Credentials go in a local .env file, never committed. Specific credentials per platform are covered in the next section.
Phase 3: Read before write
Every prompt in this phase returns a finding. No edits. This is where you calibrate: does the agent's read of the account match your own? If it flags the wrong search terms or misreads a bid strategy, fix the strategy files before you trust it to write.
Phase 4: Hand over jobs one at a time
Negative keywords first (worst case: you stop paying for junk). Then bid nudges on a propose-then-approve cycle. Bulk creative changes only once the smaller jobs are boring.
The full pattern is documented in the media buyer morning routine automation post if you want a worked daily-operations example alongside this setup guide.
Connect your ad accounts
Google Ads
You need a developer token from your Google Ads API Center (under Tools → API Center in a manager account). Standard access requires applying. Test access is available immediately but has query limits. You also need OAuth2 credentials and your Customer ID (the 10-digit number in the top bar of your Google Ads manager account). Full setup: Google Ads API quickstart.
Meta / Facebook
Create a Facebook app with the Marketing API product enabled. Generate a User Access Token with ads_management and ads_read permissions. The token from Graph Explorer expires in 1 hour, so exchange it for a long-lived token (~60 days) via the token exchange endpoint before storing it. Your Ad Account ID has the format act_XXXXXXXXXX, visible in Business Manager under Ad Accounts. Docs: Meta Marketing API.
Create a LinkedIn app, then request the Advertising API product from the Products tab (this is the step people miss and then wait two days for). You need Client ID + Client Secret, complete the OAuth2 flow, and capture your Ad Account ID from the Campaign Manager URL (/campaignmanager/accounts/XXXXXXXXX/). Full reference: LinkedIn Marketing API. LinkedIn CPCs run materially higher than the other two platforms. Factor that into what "wasted spend" means in your negative keyword logic.
Read before you write
The first week is all reads. No exceptions.
Run each of these in natural language. The skill translates to the right API call:
Google Ads reads:
- "Flag every search term that spent more than $50 this month with zero conversions."
- "Audit quality scores across all active ad groups — pull anything below 5."
- "Compare cost-per-conversion this month vs. last month by campaign."
Meta reads:
- "Flag ads where CTR has dropped more than 20% week-over-week."
- "Check audience overlap across active ad sets — flag any over 60%."
- "Review active ad copy against our ICP voice framework and return a score with notes."
LinkedIn reads:
- "Audit all active campaigns against our performance checklist, ranked by impact."
- "Pull demographic breakdown — job title, seniority, company size — for our top-performing campaign."
- "Summarize bid strategy across campaigns; flag anything still on maximum delivery with no cost cap."
None of these touch anything. They return a structured finding you can compare against your own account read. If the agent's read matches yours, move to phase 4. If it does not, fix the knowledge files.
The jobs — build vs. defend
Two categories of repeatable ad-ops work. The split matters because build jobs are higher stakes (new spend, new targeting) and defend jobs run on existing campaigns where you already have signal.

BUILD: setting up a campaign:
- Audience construction from a CRM export or lookalike seed
- Creative generation from brand specs and angle briefs
- Bulk ad variant creation from an approved hook list
- Initial bid and budget scaffolding from historical benchmarks
DEFEND: protecting spend once live:
- Find search terms with spend and zero conversions → stage as negative keywords
- Detect creative fatigue via CTR trend analysis
- Flag audience saturation before frequency damage compounds
- Audit quality scores and identify low-score ad groups
- Compare week-over-week performance across campaigns
- Track budget pacing (over/under vs. flight target)
- Bulk bid adjustments within guardrails you define
You describe what you want in plain English. The routing logic maps it to the right job. See the full competitor-ad-to-brief workflow for how the build side works when you start from a creative research output. For the defend side, media buying automation tools covers the broader tooling landscape these scripts sit within.
Wire the ROAS calculator and CPA calculator into your strategy files. The agent needs to know what "good" looks like for your account before it can flag what's bad.
Step 0: Find the angle before you build
This section belongs before the build jobs conceptually, even if it comes mid-playbook.
Before you write a single ad, you decide what to run: which hooks, which offers, which audiences. That decision is better when it is grounded in what competitors are actually running. The ad spy problem is traditionally a manual one. You open the Meta Ad Library, search a brand name, and scroll.
The same terminal-first pattern runs here too. Claude Code calls an API and returns structured data, just as it does for your ad ops. The AdLibrary API surfaces in-market ads across Meta, Google, LinkedIn, and native in one call. Unified ad search lets you pull by keyword, brand, or category. AI ad enrichment layers structured analysis on top (hook type, CTA, angle, audience signal), so you read patterns across creatives instead of eyeballing them one by one.
Pull competitor creatives into the terminal before briefing a campaign. Find the whitespace, brief accordingly. Same pattern, same terminal.
Hand over the keys, smallest blast radius first
Once audits match your own read, you can graduate to writes.
Negative keywords first. The worst outcome is you stop paying for a junk term you would have paused anyway. Stage them, review the list, execute. This is the lowest-risk edit in paid search.
Fatigue flags and bid nudges second. The agent proposes: "Ad set XYZ has dropped from 2.1% to 0.9% CTR over 14 days. Flag for creative refresh." You confirm. It logs the flag. When you are comfortable with that loop, extend it to bid adjustments within bounds you set (e.g., "increase bids up to 15% on ad groups where CPA is below target and impression share is below 60%").
Stay in the approval loop until the edits feel boring. That is the signal they are safe to automate.
One genuine risk: if your conversion tracking has a measurement error (a misfired pixel or a duplicated event), the agent will optimize confidently toward the wrong thing. The learning phase on Meta resets on significant edits, so bulk changes that look efficient can actually set campaigns back by days. The agent does not know this unless you put it in the strategy files. Put it in the strategy files.
The weekly operating ritual
One sitting, all accounts, the same sequence every week:
- Pull this week's zero-conversion search terms across all Google campaigns. Stage as negatives for review.
- Flag Meta ad sets where CTR has dropped more than 15% vs. the prior 7 days. Check ad timeline analysis signals for creative fatigue confirmation.
- Review budget pacing on active flights: flag anything more than 20% over or under the weekly target.
- Run a week-over-week comparison across all active campaigns: pull CPAs, CTRs, spend, and conversion volume. Flag anything outside your defined variance bands.
- Generate a summary of what to act on and what to monitor. Note what is performing normally.

The value is consistency, not magic. The agent runs the same checks the same way every week, without forgetting step 3 because someone was in a meeting. That reliability is what you are actually buying.
The n8n and Make.com automation patterns in n8n competitor ad monitoring workflows and Make.com ad spy automation cover how to schedule recurring pulls outside the terminal if you want the weekly ritual to run unattended.
What stays human
This workflow moves you off clicking and onto judgment. That is the correct trade.
What must remain yours:
- Which segments to chase. The agent can tell you an audience segment is performing. Whether chasing it is right for the business is a different question.
- Whether a creative angle is good. Automation can detect CTR decline. It cannot tell you whether a new angle is on-brand or will embarrass you in front of a prospect.
- Whether a result is real. A spike in conversions might be a pixel misfire. A CPA drop might be attribution window drift. You have to know your measurement well enough to smell an anomaly.
- Scale vs. kill decisions. Hitting target with budget room to spend = candidate to scale. Spent enough to prove itself, did not convert = kill. The thresholds are yours. The agent executes against them.
Fully unattended, the agent will optimize toward whatever conversion signal it is given. If that signal is wrong, it optimizes confidently toward the wrong outcome. The marketing funnel does not fix itself when the top-of-funnel measurement is broken.
See the media buyer workflow use-case docs for how this fits into a full operating system across platforms. The creative strategist workflow covers the build side. The competitor ad monitoring automation doc covers scheduling the research layer.
FAQ
Can Claude Code directly access my Google Ads or Meta account without any setup? No. Claude Code runs locally and only accesses what you give it credentials for. You need to configure API access per platform: developer token for Google, Marketing API app for Meta, Advertising API product for LinkedIn. Store credentials locally. Nothing connects automatically.
Do I need a paid Claude subscription to run paid ads from Claude Code? Yes. Claude Code requires a Pro or Max subscription (or API access with billing). The free plan does not include Claude Code.
What happens if the agent makes a bad edit to a live campaign? That is why the rollout phases exist. Follow the read-before-write sequence and only hand over write access for well-defined jobs with guardrails. The blast radius stays bounded. Negative keyword additions are reversible in seconds. Bid changes outside your defined bounds cannot happen if the strategy files encode the bounds correctly.
How long does it take to get LinkedIn Advertising API access? One to two business days after you submit the application from the Products tab of your LinkedIn app. The approval is not instant. Request it before you need it.
Is this only for large accounts with high spend? No. Accounts with thin data get less reliable agent output, because the recommendations are only as good as the signal in the account. The read-only audit phase is useful at any spend level. The write phase is most reliable once campaigns have enough data for stable CPAs and statistically meaningful CTR trends.
The only thing between you and running your paid motion from a terminal is the patience to set it up one careful step at a time. Start with reads. Stay in the loop. Hand over jobs only once they are boring.
Ready to wire competitor ad intelligence into your terminal workflow? Start a free trial and try the AdLibrary API — plan details on pricing.
Related Articles

Meta Ads Automation Tools: What Actually Automates (and What Just Pretends To)
Five automation layers that define a genuine Meta ads automation tool — creative variants, budget rules, fatigue detection, DM flows, Reels testing — plus a scoring rubric to cut vendor hype.

What Is Facebook Ad Automation? The Mechanics, the Layers, and What It Won't Do for You
Facebook ad automation explained: the four operational layers, how rules-based bidding works via the Meta Marketing API, native vs. third-party options, and a readiness framework.

Media Buyer Morning Routine: Automate the Competitor Check
Media buyer morning routine, automated: an overnight competitor scan, diff logic, and a 7:30 Slack digest replace 20 minutes of tabs. Working code inside.

The Creative Strategist's API Toolkit: Daily and Weekly Workflows
Replace the morning ad-library tab cycle with four API scripts: inspiration sweep, competitor watch, format trends, and brief feeding, in 10 min a day.

LLM Agent Tools: API Function-Calling Patterns for Ad Research
Give your LLM agent ad research tools: function schemas for ad search and advertiser resolve, credit-economy system prompts, result compression, and evals.

How to Automate Competitor Ad Monitoring End to End
Build Slack competitor ad alerts in 30 minutes: an incoming webhook, a Node poll script with first_seen filtering, dedup on ad_key, and cron scheduling.

From Competitor Ad to Creative Brief in 20 Minutes (API + LLM)
Turn a competitor ad into a finished creative brief in 20 minutes: find the winner via the AdLibrary API, enrich it, and let an LLM draft the brief.

Media Buying Automation Tools: What to Use, What to Skip, and How to Evaluate in 2026
What media buying automation tools actually automate in 2026: budget rules, creative rotation, pacing, audience refresh, and attribution. An evaluation rubric to separate real automation from dashboards.