---
title: "Brevo API: connect it to a tool built with AI (2026)"
url: https://while.sh/en/guides/connect-brevo-api-ai-tool/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-18
---

# Connect Brevo to a tool built with Claude or ChatGPT (2026)

Your tool built with Claude needs to add contacts to Brevo, or send an email when a quote goes out. The Brevo credential opens your whole email marketing account, and it must end up neither in the code nor in the conversation. On while, it stays in while, and your AI never sees it. Here is how.

Brevo holds your contacts, lists, campaigns and transactional emails. A tool built with Claude or ChatGPT becomes valuable when it **talks to Brevo**: adding a form's contact to the right list, sending an email when a quote goes out, finding who opened the last campaign. To do that, it needs a **Brevo API credential**, and an API key opens **the whole account**.

That is where things often go wrong: **the key ends up pasted into the code**, or into the conversation with the AI, where it can leak. On while, the Brevo credential **stays in while**. The tool calls Brevo without ever holding it, and your AI never sees it.

> **The short version.** Generate an API key in Brevo's SMTP & API settings. Ask your AI to connect Brevo, then paste the key into while through the link it gives you. The tool adds your contacts and sends your emails, every call is logged, and a campaign send waits for your approval if you ask.

## API key or machine to machine

Brevo offers two ways to connect a tool, and the first is enough in most cases (sources 1 and 3).

| | API key | Machine to machine |
|---|---|---|
| What it opens | The whole account | Only the chosen scopes |
| How long it lasts | Until you delete it | Tokens of about an hour, renewed |
| Where to create it | In the SMTP & API settings | In a terminal, with Brevo's command tool |
| Who it is for | Everyone | A team comfortable with a terminal |

On while, both work: the API key is pasted as is, and for machine to machine, while exchanges the client credentials for a token and **renews it on its own**.

## Connect Brevo to your tool, in three steps

The whole thing takes a few minutes, and you have no code to write.

1. **Generate a key in Brevo.** Open the **SMTP & API** settings, then the API keys tab, and generate a new key. Give it a name that says what it is for, like "Quotes tool". Copy it right away: Brevo shows it **only once** (source 1).
2. **Ask your AI to connect Brevo.** It declares the connection in while and gives you a link.
3. **Paste the key into while.** You open the link, paste the key and confirm. Neither your AI nor the tool's code sees it.

If **IP security** is on for your account, Brevo blocks calls from an unknown address, even with a valid key. It then sends you an email to authorize the address, or you add it in the authorized IPs of the Security menu (source 2).

> You, to your AI: Connect Brevo to this tool: each new contact from the form goes into the "Prospects" list, and a welcome email goes out right away.

<figure class="illus"><img src="/illustrations/brevo-relais-1200.webp" srcset="/illustrations/brevo-relais-768.webp 768w, /illustrations/brevo-relais-1200.webp 1200w" sizes="(min-width: 48rem) 46rem, 100vw" width="1536" height="1024" loading="lazy" decoding="async" alt="The tool built with AI calls the Brevo API through while: the Brevo credential is added to each call inside while, out of the code, contacts added and emails sent are logged, and a campaign send waits for a person's approval" /><figcaption>The tool calls Brevo through while, which adds the credential to each call.</figcaption></figure>

## What while does on each call

The tool calls Brevo **through while**, without a credential. while adds the key to each call, and logs it in the history. For the first seven days, reads go through and teach while what the tool calls. **A write**, like adding a contact or sending an email, goes through once you approve its rule. After that, an unexpected call is refused, and your AI is told.

An email that has gone out cannot be taken back. You can ask for your approval before a sensitive call.

> You, to your AI: Ask me before every campaign the tool sends in Brevo.

The credentials of your software are detailed on our [security](/en/security/) page, and the same mechanism works for any API in [connect an API with no credentials in the code](/en/guides/api-keys-out-of-code/).

## Changing the key

If the key leaks or you lose it, generate a new one in Brevo and delete the old one (source 1). **Paste the new one into while**: the tool uses it from the next call, without being put back in place, and your AI has nothing to redo.

## What while adds around it

- **Your colleagues** use the tool with a while account for up to 3 people, or, on the Pro plan, with their email account, Google or Microsoft. See [keep a tool for your colleagues](/en/guides/internal-tool-company-sign-in/).
- **Connected software**: one on the Libre plan, and 25 on the Pro plan, Brevo included.
- **The tool's data** is backed up every day, and your tools are hosted in France by Nextmap.

For contacts followed end to end, see [build a simple CRM](/en/guides/simple-crm-small-business-claude-chatgpt-2026/), and for related connections, [HubSpot](/en/guides/connect-hubspot-ai-tool/) and [Slack](/en/guides/connect-slack-ai-tool/).

## Try it with your tool

Give this message to your AI, then ask it to connect Brevo. The trial is **free, with no sign-up**, and your tool has its address **in 3 minutes**.

```text titre="The message to give your AI"
Read while.sh/agents and help me get started with while.
```

## Sources

1. [Brevo, Generate an API key](https://developers.brevo.com/docs/api-key-authentication), 2026-11-18
2. [Brevo, IP security & authorization](https://developers.brevo.com/docs/ip-security), 2026-11-18
3. [Brevo, Machine-to-machine authentication](https://developers.brevo.com/docs/oauth-m2m-authentication), 2026-11-18

## Questions

### How do you get a Brevo API key?

In Brevo, open the SMTP & API settings, then the API keys tab, and generate a new one. Give it a name, then copy it: Brevo shows it only once (source 1).

### Does my AI see the Brevo credential?

No. Your AI declares the connection to Brevo and gives you a link. You paste the credential into while there, and neither your AI nor the tool's code sees it.

### Why does Brevo block my tool's calls?

If IP security is on, Brevo blocks calls from an unknown address, even with a valid credential. It sends you an email to authorize the address (source 2).

### Is there narrower access than an API key?

Yes. Brevo offers machine-to-machine access, with chosen scopes and tokens valid for about an hour. It is created in a terminal with Brevo's command tool, and while renews the token on its own (source 3).

### Can you block a campaign send by the tool?

Yes. On while, ask for your approval before each campaign send: it waits for your approval before reaching Brevo.
