CLI reference
Same package as the SDK. The CLI reads platform tokens from the environment, so the same secrets you export for createAdscapi() work here. Use it in shells, CI, and agent loops.
Install
shell
# one-shot (no install) npx adscapi --version # or project-local npm i -D adscapi npx adscapi platforms
Environment
Tokens come from process.env — never from flags. A platform is active only when its required secrets are present. check = secrets present; verify = secrets valid.
shell
# The CLI reads platform tokens from the process environment. # Same secret names the SDK uses — see adscapi platforms for the full list. export META_CAPI_TOKEN=… export META_PIXEL_ID=… export GA4_MEASUREMENT_ID=… export GA4_API_SECRET=… # …etc # After interactive init: source .env && adscapi verify
Commands
| Command | What it does |
|---|---|
| platforms | List every destination, support level, and required secrets |
| init | Guided setup — interactive prompts or print a plan; writes .env |
| check | Show which platforms have secrets present right now |
| verify | Live-check that configured tokens actually work (hits the API) |
| doctor | Health check across configured platforms; nonzero exit on failure |
| test-event | Fire one conversion event to every configured platform |
| offline | Batch-upload offline conversions from a CSV (Bing, Google, Meta) |
| creatives | Upload an ad image (Meta today; Pinterest/Reddit listed) |
| mcp | Run the MCP server over stdio for coding agents |
--version / -v | Print the package version |
Unknown commands print the usage banner:
text
adscapi <version> usage: adscapi platforms list every destination + required secrets adscapi init [--platform meta] guided setup — secrets, docs, verify step adscapi check show which platforms are configured adscapi verify [--platform meta] live-check that configured tokens work adscapi doctor health check across configured platforms (nonzero exit on failure) adscapi test-event [--event ...] [--email ...] [--dry-run] adscapi offline --platform bing|google|meta --file conversions.csv [--dry-run] adscapi creatives upload --platform meta|pinterest|reddit --image <url> [--name <n>] adscapi mcp run the MCP server (stdio) adscapi --version
Exit codes
| Command | When exit is nonzero |
|---|---|
doctor | No platforms configured, or any live check returns ERR — usable as a cron / CI health gate |
offline | Bad flags, unreadable file, or failed > 0 in the upload result |
creatives | Bad flags, or the platform upload fails |
check, verify, platforms, and test-event print status and exit 0 even when some rows show ERR — inspect stdout.
Typical loop
shell
npx adscapi platforms # what's supported + secret names npx adscapi init # prompt for missing secrets → .env source .env npx adscapi check # secrets present? npx adscapi verify # secrets valid? npx adscapi test-event --event purchase --email you@example.com --dry-run npx adscapi doctor # CI / cron health gate