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 work with the Meta Marketing API and wish to manage advertising campaigns directly from the terminal, without writing their own code.
According to Meta, the Marketing API remains a powerful tool, but when working with it, developers constantly have to write the same technical code: authorisation, pagination, output formatting, and error handling. The Ads CLI solves this problem by consolidating the Meta Marketing API into a single tool with predictable commands for managing ads.
For example, you can retrieve a list of campaigns via the command line:
meta ads campaign list
Or export campaign statistics for the last 7 days:
meta ads insights get --campaign_id COMPAIGN_ID --date-preset last_7d —-fields conversions,impressions
Ads CLI supports several output formats, including JSON and plain text with tab-separated values. This is necessary for the tool to be used not only manually, but also in automation, scripts, internal tools, and CI/CD pipelines.
What you can do with Ads CLI
Using Ads CLI, you can create, view, update, and delete campaigns, ad sets, ads, and creatives. By default, new objects are created with a PAUSED status, so a campaign will not start immediately until it is manually switched to an active status.
Example of creating a campaign with a daily budget of 50.00 in the advertising 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 a button:
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 an ad set and creative:
meta ads ad create ADSET_ID --name "Hero Banner Ad" --creative-id CREATIVE_ID
Once verified, the campaign, ad set, and ad can be set 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 statistics
The Ads CLI also allows you to view advertising metrics: spend, impressions, CTR, ROAS, and other metrics. Queries can use date ranges, breakdowns by age, gender, platform, and various levels of aggregation.
Example of campaign statistics export 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 who want to generate reports automatically, without manually exporting data from Ads Manager.
Catalogues and products
The Ads CLI allows you to manage not only advertising campaigns but also catalogues. The tool supports the creation and management of catalogues, products, and product sets.
Creating a catalogue:
meta ads catalog create --name "My Catalog"
Adding a product to the catalogue:
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
View product sets:
meta ads product-set list --catalog-id 123456
Pixels and datasets
A separate section covers datasets. Using the Ads CLI, you can create pixels for conversion tracking, link them to advertising accounts and product catalogues, and configure the connection for conversion tracking.
Creating a dataset:
meta ads dataset create --name "Website Pixel"
Connecting the dataset to an advertising account and catalogue:
meta ads dataset connect 111222 --ad-account-id 333444 --catalog-id 555666
Automation and AI agents
Meta specifically states that meta ads are designed for autonomous execution in CI/CD pipelines, interactive use in the terminal, and use in scripts.
Three output formats are provided for this purpose:
- table — human-readable output;
- json — a format for processing via jq and other tools;
- plain — simple tab-separated values, which are convenient to pass to sort, awk, cut, and other commands.
There are also the —no-input and —force parameters, which disable all interactive requests.
Standard exit codes are used for error handling: for example, 0 for successful execution, 3 for an authorisation error, and 4 for an API error. Environment variables are also supported for tokens, secrets, and advertising account IDs, so as not to store sensitive data in the command history and version control system.
Essentially, Ads CLI provides an official way to work with the Meta Marketing API via commands: creating campaigns, ad sets, ads, and creatives, working with catalogues, gathering statistics, and automating routines without manual work in the interface.
- Ads CLI requires Python 3.12+ and pip/uv.









































