Meta Ads CLI: Simplifying Campaign Management and Automation.

Meta Ads CLI: Simplifying Campaign Management and Automation.

SpyLead



Meta has introduced Ads CLI, a command line interface for working with Meta Ads and Commerce. The tool is designed for developers and AI agents who use the Meta Marketing API and want to manage campaigns directly from the terminal without writing their own integration layer.

According to Meta, the Marketing API is still a powerful tool, but working with it usually means repeating the same technical routines over and over: authentication, pagination, formatting output, handling errors. Ads CLI simplifies this by wrapping the Meta Marketing API into a single interface with predictable commands for managing ads.

For example, you can get a list of campaigns from the command line:

meta ads campaign list

Or pull campaign insights for the last 7 days:

meta ads insights get --campaign_id COMPAIGN_ID --date-preset last_7d --fields conversions,impressions

Ads CLI supports multiple output formats, including JSON and plain tab-separated output. This makes it suitable not only for manual use, but also for automation, scripts, internal tools and CI/CD pipelines.



What you can do with Ads CLI

Through Ads CLI, you can create, view, update and delete campaigns, ad sets, ads and creatives. By default, new objects are created in PAUSED status, so nothing goes live until it is explicitly activated.

Example of creating a campaign with a daily budget of 50.00 in the account currency:

meta ads campaign create --name "Summer Sale" --objective OUTCOME_SALES --daily-budget 5000

Creating an ad set:

meta ads adset create CAMPAIGN_ID --name "My Ad Set"
--optimization-goal LINK_CLICKS --billing-event IMPRESSIONS
--bid-amount 500 --targeting-countries US

Creating a creative with an image and call to action:

meta ads creative create --name "Hero Banner"
--page-id 111222333 --image ./banner.jpg
--body "50% off everything!" --title "Shop Now"
--link-url https://example.com/sale --call-to-action SHOP_NOW

Creating an ad based on the ad set and creative:

meta ads ad create ADSET_ID --name "Hero Banner Ad" --creative-id CREATIVE_ID

After review, the campaign, ad set and ad can be switched to active status:

meta ads campaign update CAMPAIGN_ID --status ACTIVE
meta ads adset update ADSET_ID --status ACTIVE
meta ads ad update AD_ID --status ACTIVE



Analytics and insights

Ads CLI also allows you to pull performance metrics such as spend, impressions, CTR, ROAS and more. You can use date ranges, breakdowns by age, gender, platform and different aggregation levels.

Example of pulling campaign data for the last 7 days:

meta ads insights get --campaign_id COMPAIGN_ID --fields=impressions,conversions --date-preset last_7d

This is useful for teams that want to generate reports automatically without exporting data manually from Ads Manager.



Catalogs and products

Ads CLI is not limited to campaigns. It also supports working with catalogs, including creating and managing catalogs, products and product sets.

Creating a catalog:

meta ads catalog create --name "My Catalog"

Adding a product to a catalog:

meta ads product-item create --catalog-id 123456
--retailer-id sku_a --name "Blue Shirt"
--url https://example.com/blue_shirt --price "999" --currency "USD"
--image-url https://example.com/blue_shirt.jpg

Listing product sets:

meta ads product-set list --catalog-id 123456



Pixels and datasets

There is also a separate block for datasets. Through Ads CLI, you can create pixels for conversion tracking, connect them to ad accounts and product catalogs, and configure tracking setups.

Creating a dataset:

meta ads dataset create --name "Website Pixel"

Connecting a dataset to an ad account and catalog:

meta ads dataset connect 111222 --ad-account-id 333444 --catalog-id 555666



Automation and AI agents

Meta highlights that Ads CLI is built for autonomous execution in CI/CD pipelines, interactive terminal usage and scripting.

There are three output formats available:

  • table for human readable output
  • json for processing with jq and similar tools
  • plain for tab separated values that can be passed into tools like sort, awk or cut

There are also parameters like --no-input and --force that disable all interactive prompts.

Error handling uses standard exit codes: for example, 0 for success, 3 for authentication errors and 4 for API errors. Environment variables are supported for tokens, secrets and ad account IDs, so sensitive data does not have to be stored in command history or version control.

In practice, Ads CLI provides an official way to work with the Meta Marketing API through commands: creating campaigns, ad sets, ads and creatives, managing catalogs, pulling insights and automating routine workflows without relying on the interface.

  • To run Ads CLI, you need Python 3.12 or higher and pip or uv.




Our Telegram Channel - @SpyLeader

For Spy Service please write - @TrafficSponsor

Report Page