# Configuration This guide covers how Ads CLI resolves configuration settings, including environment variables, `.env` files, and the config directory. ## Environment variables | Variable | Required | Description | |----------|----------|-------------| | `ACCESS_TOKEN` | Yes | System user access token that you generate in the Meta Business Suite | | `AD_ACCOUNT_ID` | Yes (for most commands) | Your Meta ad account ID | | `BUSINESS_ID` | No | Default business ID (for catalog/dataset commands) | ## Configuration precedence Ads CLI resolves settings in this order (highest priority first): 1. Command-line flags (for example, `--ad-account-id`) 2. Environment variables 3. Project-level `.env` file 4. User-level config (`~/.config/meta/`) ## Use a .env file To prevent setting the environment variables for each session, you can add a `.env` file in the directory where you are running Ads CLI:**Note:** Environment variables set in your shell take precedence over `.env` values. ## Config directory Ads CLI stores configuration in an [XDG-compliant](https://specifications.freedesktop.org/basedir-spec/latest/) directory:cat > .env << 'DOTENV' ACCESS_TOKEN='<ACCESS_TOKEN>' AD_ACCOUNT_ID='<AD_ACCOUNT_ID>' BUSINESS_ID='<BUSINESS_ID>' DOTENVYou can override the base directory by setting the `XDG_CONFIG_HOME` environment variable. ## See also - [Find your IDs](https://developers.facebook.com/documentation/ads-commerce/ads-ai-connectors/ads-cli/tutorials-and-recipes#find-your-ids) -- Look up ad account, page, and other IDs - [Get Started](https://developers.facebook.com/documentation/ads-commerce/ads-ai-connectors/ads-cli/setup/get-started) -- Installation and authentication - [Command Reference](https://developers.facebook.com/documentation/ads-commerce/ads-ai-connectors/ads-cli/command-reference) -- Every command, option, and argument~/.config/meta/
在接这个接口时卡住了?
Stuck wiring this API into production? We build ad-delivery tooling on these platforms —
campaign automation, reporting pipelines, error-handling and migration between API versions.
联系我们 · Talk to us
每日平台更新简报 →