← All posts
How-toJune 15, 2026

How to Use Claude Code for Meta Ads (Step-by-Step)

You can drive the Meta Marketing API from Claude Code in plain English — audits, pauses, reports. Here's the setup, and the honest trade-offs.

How to Use Claude Code for Meta Ads (Step-by-Step)

The Meta version of the same question media buyers ask about Google: can I just tell Claude to pause my worst ad sets and spin up three creative variations, instead of clicking through Ads Manager? Yes — via Claude Code driving the Meta Marketing API. Here's the setup and the honest trade-offs. (If you landed here for Google, see Claude Code for Google Ads.)

What "Claude Code for Meta Ads" actually means

Claude Code is a coding agent, not a Meta integration — it can't click around Ads Manager. What it can do is write and run code against the official Meta Marketing API. You describe the task; it generates and runs the script; it reports back. So the real meaning is: give Claude Code access to the Marketing API, then operate your ad account through the code it writes.

Step 1 — Set up Meta Marketing API access

The non-AI part, and where most people get stuck.

  1. Create an app. In Meta for Developers, create an app and add the Marketing API product.
  2. Permissions + Business Manager. You'll need ads_read for reporting and ads_management for changes, tied to the Business Manager that owns the ad account. Higher-volume use needs Meta's App Review / advanced access.
  3. Access token. Generate a long-lived token (or a system-user token from Business Manager, which doesn't expire as quickly) with those scopes.

Keep the app ID, app secret, access token, and your ad account ID (act_…) ready — that's what the API needs.

Step 2 — Install Claude Code

Install Claude Code and open it in a fresh project folder (e.g. meta-ads-bot/) where it'll keep the script and config.

Step 3 — Let Claude Code scaffold the integration

Hand it the setup:

"Set up the facebook-business Python SDK in this project. Create a config for my app ID, app secret, access token, and ad account ID. Then write a script that authenticates and lists my campaigns to confirm it works."

It'll install the SDK, scaffold the auth, and run a test query. Drop in your real credentials, run once, and the connection's confirmed.

Step 4 — Run real tasks in plain English

Then just describe what you want; Claude Code writes the call and runs it:

  • "Audit the last 14 days by ad set — flag any with CPA over $40 or ROAS under 1.5."
  • "Pull a 7-day report by campaign — spend, purchases, CPA, ROAS — as a CSV."
  • "Pause the three worst-performing ad sets in the Prospecting campaign." (Show me the list first.)
  • "Duplicate this ad set with three new headline variations I'll paste in, in paused status."

Reads, let it run. Writes, read the planned change before you run it.

The honest trade-offs

It's the full Marketing API in natural language — powerful and basically free beyond your Claude subscription. But:

  • You maintain it. Tokens expire, the Graph/Marketing API versions every few months and deprecates old ones, error handling and rate limits are yours.
  • No approval gate or audit log. The token has write access; a bug can publish or pause the wrong thing, with no record unless you build one.
  • It runs on your machine. No schedule, no team access, no Slack delivery.
  • It's a builder's tool. App setup, token scopes, reading the generated code, debugging API changes — all on you.

The managed alternative: skip the scripts

Most teams move off DIY because of maintenance — and because publishing ad changes from an unreviewed script is nerve-wracking.

Junior is an AI employee with native Meta Ads support — the same plain-English power, managed:

  • No scripts to maintain — no token refresh, no API-version bumps.
  • Approval-gated — every change (including publishing creative) is proposed in Slack; you approve first.
  • Runs on a schedule, from Slack — daily audits and weekly reports arrive on their own.
  • Audit log + guardrails — every action recorded; require multi-person sign-off on big budget moves.

See Meta Ads automation with Junior, or the Google Ads version.

Bottom line

Claude Code + the Meta Marketing API is a real DIY setup: app and token, then natural-language control of your ad account. The cost is the edges — auth, maintenance, no approval gate, no schedule. Own that if you like it; if you'd rather it just ran safely from Slack, that's what a managed AI employee is for.

FAQ

Can Claude Code actually manage Meta (Facebook/Instagram) Ads?
Indirectly — Claude Code is a coding agent, not a Meta integration. But it can write and run code against the official Meta Marketing API. Once you've set up app access and a token, you describe a task in plain English ('pause ad sets with CPA over $40 in the last 7 days') and it writes the script, runs it, and reports back. So in practice it operates your ad account through the code it generates.
What do I need to use Claude Code with Meta Ads?
Four things: (1) a Meta for Developers app with Marketing API access, (2) the relevant permissions (ads_read for reporting, ads_management for changes) and a Business Manager, (3) a long-lived or system-user access token, and (4) Claude Code installed locally. With those, Claude Code can install the facebook-business Python SDK and start making calls against your ad account ID.
Is it safe to let Claude Code change my live Meta Ads?
Only with your own guardrails. The token carries real write access and there's no built-in approval step, so a bug in the generated code could publish or pause something you didn't intend. Run read-only audits first, review every write before executing, and test on a low-spend account. There's no audit log or multi-person approval unless you build it.
What's the difference between Claude Code and a tool like Junior for Meta Ads?
Claude Code is DIY: you set up app/token access, it writes scripts, and you maintain them (token refresh, API-version bumps, error handling). Junior is managed: native Meta Ads support, runs from Slack with an approval gate before any change, an audit log, and no scripts to maintain. Use Claude Code if you want to own the code; use a managed AI employee if you want it to just run.
Do I need to code?
Claude Code writes the code, but you still have to get through the Meta app + token setup, review the generated script before running writes, and debug when the API changes. If that's more than you want to own, a managed option skips all of it.

Follow Junior

More from Junior