← All news·2026-10-11·3 min read

How to Connect Claude Code to Facebook and Instagram Ads

Claude Code can run a Meta ad account through the Marketing API. Here is what you need to set up and what the agent does from there.

aiguideclaude-codeads

You can run a Meta ad account through an agent. Claude Code works with it via the Marketing API, the official way to manage Facebook and Instagram ads by code. You do not need to learn the ad manager yourself. The agent needs access and a clear description of your product.

What Do You Need to Connect Claude Code to Meta Ads?

Steps

  1. 1Set up an ad account in Meta Ads Manager — campaigns and billing run through it.
  2. 2Register as a Meta developer at developers.facebook.com and create an app in the App Dashboard.
  3. 3Get a Marketing API access token for your ad account.
  4. 4Give Claude Code the token and the account number, and describe your product and target audience in plain words.

What Does the Agent Do From There?

It builds the campaign, prepares creatives, and sets up the Meta pixel and events (lead, purchase) on your site. Each morning, you can ask it to go through the stats and tell you which ads to turn off and which to push harder.

!Security

The access token works like a password to your account. Keep it in a .env file next to your project, do not paste it into chats, and do not post it to public repositories. Keep budget decisions to yourself.

Official Meta documentation: https://developers.facebook.com/docs/marketing-apis/get-started

Source: developers.facebook.com

Free course

Stop reading about AI — start building with it

The free Claude Code course: your first site, tool or game — no coding. No upsells, no cross-sells — nothing to buy here.

Start free →
EAEvgenii Arsentev

Author

Evgenii Arsentev

PhD · Founder & CEO, Dad4Kids