How to Connect Brevo to Claude Code
Claude Code can help with Brevo without holding the API key. A single email, a campaign, and adding someone to a list are three different actions, and the list is the hard one to undo.
Key takeaways
- -In this article we explore how to connect Brevo to Claude Code without pasting the Brevo API key into the chat.
- -To understand how a Brevo connection should be scoped: a transactional email, an email campaign, and adding a contact to a list are three different Brevo actions.
- -Connect Brevo to Claude Code with the Swytchcode CLI. Install it, run swy init --editor=claude --mode=sandbox, then swy get brevo, swy discover "send a transactional email" --project brevo, and swy auth connect brevo.
- -Brevo documents an idempotency key for batch sends, kept for 30 minutes. A repeat in that window returns duplicate_parameter and does not send the batch again.
- -Adding a contact to a Brevo list can start mail that deleting the contact later does not recall, so a Claude Code connection should leave list changes off until a person approves them.
You want Claude Code to help with Brevo. Draft a note. Check whether someone is still subscribed. Maybe send one email to one person. That is a reasonable setup, and you can do it without pasting Brevo's API key into the chat.
The mistake is treating three different jobs as one button. A single email goes to one person because something happened, such as a receipt or an invite. A campaign goes to a list of people. Adding a contact to a list changes who will receive the next campaign, and deleting them later does not pull back mail that already went out.
This article connects Brevo to Claude Code with those three kept apart. If Swytchcode is new to you, it is the program Claude Code uses to call Brevo. Claude decides what it wants. Swytchcode checks that you allowed that action, adds the Brevo key, and sends the request. Claude does not see the key.
The same shape for a payments tool is in this article: How to Connect Stripe to Claude Code. Brevo's listing in the directory is here.
Follow these steps to connect Brevo
Do these from the project folder, in order. swy is the short name for the Swytchcode program.
1. Follow this step to install the CLI
Pick the one that matches your computer.
If you already use Node.js:
npm install -g swytchcodeOn Windows, open PowerShell and run:
irm https://cli.swytchcode.com/install.ps1 | iexOn macOS or Linux:
curl -fsSL https://cli.swytchcode.com/install.sh | shThen check that the install worked:
swy --versionA version number means the CLI is on your machine. The rest of the install walkthrough is in the CLI quickstart.
2. Follow this step to sign in
swy loginA browser window opens so you can create an account or sign in. Your first two calls that actually reach a service can run before you have an account. After those, you need to be signed in. How accounts and service logins work is in the authentication docs.
3. Follow this step to start Claude Code in test mode
swy init --editor=claude --mode=sandboxThis introduces Swytchcode to Claude Code. --mode=sandbox means test mode, so you are not writing to a live audience while you learn the actions. That choice is saved for the project. Claude cannot switch it later in the chat. What the command creates is in Set up a project.
Cursor and Codex use the same program. Change claude to cursor or codex. If you want that editor connection written out, explore this article: How to Connect the Swytchcode MCP Server.
4. Follow this step to download Brevo
swy get brevoThis downloads Brevo. It does not turn every Brevo action on.
5. Follow this step to find a single-email action
swy discover "send a transactional email" --project brevoThis searches Brevo, in ordinary words, and prints the current name of the action. --project brevo keeps the search inside Brevo. Use the name it prints. Do not copy a name from an old note, including this article.
6. Follow this step to see what that action needs
swy info <id from discover>Replace <id from discover> with the name from step 5. This shows the fields. It only works after step 4.
7. Follow this step to turn that one action on
swy add method <id from discover>This is the on-switch for that one action. Leave campaign send, and leave "add a contact to a list," off until a person is supposed to do those jobs.
8. Follow this step to store the Brevo key
swy auth connect brevoThis stores the API key on your machine, outside the project and outside the chat. There is no Swytchcode env file for that key. If a later message asks Claude to print the Brevo key, there is nothing in the conversation to print. Explore this article for that arrangement: credential brokering.
One email is not a campaign
A transactional email is one message to one person because something happened. The reach is that person.
A campaign is a send to a list. The reach is everyone on the list, including anyone an earlier mistake added. "Draft the campaign" and "send the campaign" should not both be turned on while you are experimenting. Leave send off until a person is supposed to release it.
You can also pause a send and ask someone to approve it in Slack or Telegram. That is on the Business and Enterprise plans. If nobody approves within 48 hours, it is not sent. Free and Pro can allow or block an action, without the approval step. A campaign send is the action to pause. Reading last week's numbers is not. The rules are in Policy-as-Code for AI Agents.
The same care shows up with a personal inbox: being able to read mail is not a reason to let the assistant send as you. Explore this article: How to Connect Gmail to Grok.
Adding a contact is the step people underestimate
Adding someone to a list looks small. It can keep causing mail after you have forgotten the chat.
They can enter a segment. A campaign that was already scheduled can include them. A welcome series can start. Deleting the contact an hour later does not recall the mail, and it does not put the list back the way it was. You have a history: added, mailed, removed.
If the question is "is this person subscribed?", that is a lookup. Search for that action and turn on that one. If changing the list really is part of the job, have a person approve it. Do not let a retry add them a second time under a new reference.
Brevo does document a repeat-protection label for batch sends. It lasts 30 minutes, and a repeat in that window comes back as an error named duplicate_parameter rather than as the first success. That label is not on every Brevo action, and it will not undo a list change. Which email services offer this at all is Which Email APIs Support Idempotency Keys.
On Swytchcode's side, a create or an update is retried only when it carries the same reference as the first try. If this particular Brevo action does not store a reference, do not send it again because Claude thought the first try failed. Send once, then look it up. The general idea is Idempotency Explained.
Send the first one to yourself
Stay in test mode until the only email the assistant can send is one to you. Then follow these two steps to see what actually ran.
Follow this step to see the calls that went out:
swy audit networkFollow this step to see the calls that were blocked or held for a person:
swy audit policyA campaign that never sent, because nobody approved it, should show up in the second log. It should not show up as a success in the chat.
FAQ
How do I connect Brevo to Claude Code?
Follow the eight steps in this article, from installing the CLI through storing the Brevo key. Do not paste the API key into Claude Code.
Can Claude Code send a campaign?
Only if you turned that action on. Leave it off until a person is ready to release it. Keep the assistant on drafts and on single emails you have named. On Business and Enterprise you can also require approval before a campaign sends.
What if the wrong person gets added to a list?
Removing them later does not recall mail that already went out. If you only needed to know whether they are subscribed, use that lookup. Have a person approve list changes.
Will a retry send the email twice?
For Brevo's batch send, a repeat inside 30 minutes is rejected as a duplicate, and you do not get the first receipt back. For actions with no such label, a retry can be a second email. Do not make a new reference and call it a retry.
Read next
- The install, from the first command through a test call, is the CLI quickstart.
- Which email services remember a repeat send is in this article: Which Email APIs Support Idempotency Keys.
- How a repeat is treated on Swytchcode's side is in the idempotency guide.
Start with one email to yourself
If you have not installed the CLI yet, start at step 1 in this article. When those steps are done, ask Claude Code for a single email to your own address. Not a campaign, and not a change to a contact list.
You can also give Claude Code skills.md and ask it to follow the same steps in test mode. Cursor and Codex can use that file too. Say which editor you are in.
If more people received it than you meant, stop and tell us. Discord is the fast place. The contact form is better if you do not want the list discussed in a channel. Say what you asked Claude to do and what Brevo did. We can help you tell a single email from a list change.
More content
How to Log Every API Call an AI Agent Makes
Log the call where it is sent, not where it is described. Record the operation, the actor, the idempotency key, the policy decision and the outcome. Never record the credential. If the agent writes its own log, the calls that were blocked quietly disappear.
How to Connect GitHub to an AI Agent (2026)
Most of what you want an agent to do on GitHub needs no push access at all. Working that out first is the difference between a useful teammate and a token that can rewrite your main branch.
Composio Pricing Compared with Nango, Arcade, Pipedream, and Swytchcode
Composio is free for 100,000 tool calls a month, then $29. Nango is $50 pay-as-you-go. Arcade Team is $25 plus a cent a call. Pipedream Startup is $99 billed annually. Swytchcode is $149 for a million. The headline prices are the least useful part, so here is the arithmetic.
