Navigation

CLI

Generate from the terminal

Install the Bannerify CLI and generate images and PDFs from your shell.

The Bannerify CLI generates images and PDFs from a terminal. It uses the same templates and API keys as the REST API, so you can render a file in one command and pipe the result into another tool.

Use the CLI when you want to:

  • Render a file during a build, a deploy, or a cron job.
  • Batch many templates from a shell script.
  • Let an agent or a script create files without writing code.

Before you start

  • A Bannerify account with at least one template.
  • An API key. Create one in API keys.

Install

Install the CLI with npm:

npm install -g bannerify-cli

To run it without installing:

npx bannerify-cli <command>

Save your API key

Store the key once, like git config:

bannerify config set apiKey bnfy_xxxxx

The key is written to $XDG_CONFIG_HOME/bannerify/config.json, or ~/.config/bannerify/config.json. The file is created with 0600 permissions.

Confirm the key works:

bannerify whoami

The command prints the project name, the project id, the creation date, and where the key came from:

Authenticated as Acme
  project id: prj_xxxxx
  created:    2026-01-14T09:12:31.000Z
  key source: config

Generate an image

bannerify create image tpl_xxxxx -o out.png

Override the layers of the template with --modifications:

bannerify create image tpl_xxxxx -o out.png \
  --modifications '[{"name":"title","text":"Hello world"}]'

The array holds one entry per layer. Each entry names the layer with name and sets its value with text, src, or another field of that layer type.

Generate a PDF

bannerify create pdf tpl_xxxxx -o out.pdf

The PDF uses the same modifications format:

bannerify create pdf tpl_invoice -o invoice.pdf \
  --modifications '[{"name":"total","text":"$29.00"}]'

Use it in a pipeline

The CLI keeps stdout for data and stderr for messages, so the bytes of a file pass cleanly to the next command. Write to stdout with --out=-:

bannerify create image tpl_xxxxx --out=- --quiet > out.png

For long batches, keep the messages and the bytes apart. For example, upload every result as it is generated:

for id in tpl_a tpl_b tpl_c; do
  bannerify create image "$id" --out=- --quiet | rclone rcat "remote:$id.png"
done

Key resolution

The CLI looks for the API key in this order:

  1. The --api-key flag.
  2. The BANNERIFY_API_KEY environment variable.
  3. The stored config.

This lets you keep one key in the config and override it for a single command or a container:

BANNERIFY_API_KEY=bnfy_yyyyy bannerify create image tpl_xxxxx -o out.png

Configuration file

Key Purpose
apiKey The API key the CLI sends to the API
baseUrl The API base URL. Defaults to https://api.bannerify.co/v1
defaultFormat The image format used when --format is absent. Defaults to png
outputDir The directory that holds the output file when --out is absent

Manage the file with the config commands. See CLI commands.

Usage and limits

Every generation from the CLI counts against the same monthly and daily quota as the REST API and the SDKs. See Quota and limits.

Next steps