Skip to content

Configuration

Updated: Apr 29, 2026

This guide covers how Ads CLI resolves configuration settings, including environment variables, .env files, and the config directory.

Environment variables

VariableRequiredDescription
ACCESS_TOKENYesSystem user access token that you generate in the Meta Business Suite
AD_ACCOUNT_IDYes (for most commands)Your Meta ad account ID
BUSINESS_IDNoDefault business ID (for catalog/dataset commands)

Configuration precedence

Ads CLI resolves settings in this order (highest priority first):

  • Command-line flags (for example, --ad-account-id)
  • Environment variables
  • Project-level .env file
  • 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:

cat > .env << 'DOTENV'
ACCESS_TOKEN='<ACCESS_TOKEN>'
AD_ACCOUNT_ID='<AD_ACCOUNT_ID>'
BUSINESS_ID='<BUSINESS_ID>'
DOTENV

Note: Environment variables set in your shell take precedence over .env values.

Config directory

Ads CLI stores configuration in an XDG-compliant⁠ directory:

~/.config/meta/

You can override the base directory by setting the XDG_CONFIG_HOME environment variable.

See also

Unofficial mirror for reference/search purposes. All content originates from developers.facebook.com — see the source link at the top of each page. Machine-readable indexes: llms.txt · llms-full.txt · About