- Render a file during a build, a deploy, or a cron job.
- Run many renders 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. Copy its id with Copy Template ID in the menu of the template card.
- An API key. Create one on the API Keys page with New API key. Authenticate requests has the steps.
- Node.js 18 or later.
Install
Save your API key
Store the key once, the way you would withgit config:
bannerify with no arguments when no key is saved yet. The CLI asks for the key, hides what you type, checks the key, and saves it. In an interactive terminal, any command that needs a key starts the same setup when it finds none. In a script, the command fails at once instead.
The CLI writes the key to $XDG_CONFIG_HOME/bannerify/config.json, or to ~/.config/bannerify/config.json when XDG_CONFIG_HOME is not set. It sets 0600 permissions on the file.
Check the key
Generate an image
out.png and prints its path and size:
-o, the file is named <templateId>.<format>, for example tpl_xxx.png, and goes to the current folder.
To change the layers of the template, pass --modifications:
name and sets its fields, such as text or src. Modifications lists the fields of every layer type.
Pick the format with --format: png (default), jpeg, or webp.
Generate a PDF
--modifications value:
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 the file to stdout with--out=-:
Key resolution
The CLI looks for the API key in this order:- The
--api-keyflag. - The
BANNERIFY_API_KEYenvironment variable. - The saved config.
--base-url flag, the BANNERIFY_BASE_URL environment variable, the saved config, and then https://api.bannerify.co/v1.
Configuration file
Change the file with the
config commands. CLI commands lists them.