Quickstart
The Brevo CLI handles app creation, credential management, and local testing. This quickstart walks you through the fastest path to a working OAuth flow.
Log in to Brevo
The CLI prompts you to choose between browser sign-in (default) and API key. Browser sign-in opens oauth-cli.brevo.com — credentials are saved to ~/.brevo/credentials.json.
For non-interactive environments (CI/CD), set the BREVO_API_KEY environment
variable instead of running brevo login.
Create your app and scaffold starter code
The guided setup asks for an app name, distribution type, OAuth callback URL, and whether to scaffold starter code. Use http://localhost:3009/auth/callback as your callback URL for local development.
Your client_id and client_secret are written to src/oauth/.env.local
automatically. This file is gitignored — never commit it.
Start the test server
Install the test server’s dependencies, then start it:
Your browser opens at http://localhost:3009. Click Start OAuth Flow, sign in with a Brevo account, and your tokens appear masked in the browser — click to reveal them.
If the port you’re using isn’t registered as a redirect URL on your app, the CLI will prompt you to add it automatically. Approve to continue — it updates your app and app-config.json in one step.
What just happened
brevo app init did three things:
- Registered an OAuth app on Brevo, issuing a
client_idandclient_secret - Wrote credentials to
src/oauth/.env.local(gitignored,chmod 600) - Scaffolded a local Express server that implements the full authorization code flow:
GET /auth/login— builds the authorization URL and redirects tooauth.brevo.comGET /auth/callback— validatesstate, exchanges the authorization code for tokensGET /auth/refresh— exchanges the refresh token for a new access token
This server is a reference implementation for local testing. When you’re ready to implement OAuth in your real application, follow the Integration guide.
Works out of the box with AI coding tools. The scaffold includes CLAUDE.md (for Claude Code) and AGENTS.md (for GitHub Copilot, Cursor, and similar tools), pre-populated with the OAuth flow, endpoint reference, and how to run the server. Open the project in your editor and your AI assistant already understands it — no extra context needed.
Managing your app
See the CLI reference for all commands and flags.