Skip to main content
Brew is an AI-native email platform. The product is built so any AI agent that can call an HTTP API can drive Brew end-to-end, extracting brands, generating emails, creating automations, sending, and tracking results.

Four Ways In

Pick by what you’re building, not by preference. All four hit the same executors, validation, and credit metering.
If your client supports MCP, use MCP. Add https://brew.new/api/mcp, sign in with Brew, pick a brand, and your agent has the full toolset (generate, send, schedule, automate, segment, analyze) with nothing to wire. See the Brew MCP server.
No MCP, but a shell? npx @brew.new/cli runs without installing anything, which suits CI jobs and agent sandboxes. Output turns to JSON on its own when stdout isn’t a terminal, exit codes are semantic, and irreversible commands stop and ask rather than firing. See Use from AI Agents.
The rest of this page covers the two API routes: how to hand Brew to an agent that builds software, and how to embed Brew in the app that comes out. This works with any agent platform that supports HTTP tool-calling, including:
  • Claude (MCP, function calling, or computer use)
  • Cursor and Codex for agents that write your integration
  • OpenClaw
  • Replit agents
  • Lovable (worked example)
  • Viktor
  • Custom agents built on OpenAI, Anthropic, Google, or open-source LLMs

How It Works

Agents talk to Brew through Brew’s REST API, directly or through the TypeScript SDK. The same endpoints that power the Brew app are available to your agent, there’s no separate “agent API.” Your agent gets:
  • An API key from Brew (Settings → API)
  • The OpenAPI spec from the API Reference tab
  • The right scopes for what it needs (read contacts, create automations, send emails, etc.)
From there, the agent can:
API keys are bound to one brand and the API resolves that brand on every request. The fire endpoint auto-upserts the contact derived from the trigger payload, so most agent use cases don’t need to call POST /v1/contacts separately. See API authentication for the full scope and brand contract.
See the API Reference for the full contract, the agentic cookbook for end-to-end recipes, and https://brew.new/api/v1/llms.txt for the machine-discoverable agent operations guide.

Let an Agent Write the Integration

Don’t describe the API to your coding agent from memory. Every entry in the API catalog at brew.new/api carries a copyable implementation prompt: the endpoint, the docs link, the cost, the auth pattern, the SDK equivalent, the matching MCP tool, and every request field with its constraints. Run the capability in the catalog first, confirm the output is what you want, then paste the prompt into Claude Code or Cursor. Open in Claude in the catalog header does it in one click. The agent builds against the real surface instead of a guessed one.

Pattern: Function-Calling Agent

Most modern agents support tool/function calling. Wire Brew’s API into your agent’s tool definitions and the agent picks the right call based on the user’s request. A typical setup:
  1. Define each Brew endpoint as a tool in your agent’s tool registry
  2. Provide auth headers using your Brew API key
  3. Let the agent call the right tool, generating an email, sending it, building an automation, based on conversation
In TypeScript, back each tool with the SDK rather than hand-rolled fetch calls. createBrewClient handles retries, idempotency keys, and typed errors, so a tool handler is one call:
If the agent’s client speaks MCP, skip this pattern. The MCP tool catalog is the same surface already defined for you. Your agent’s user can now say “Send a welcome email to the new signups from yesterday” and the agent figures out: pull the contacts, generate the email, send.

Pattern: Backend Trigger

If your agent runs on a backend (Replit, Lovable’s Edge Functions, your own API), wire it to call Brew’s trigger endpoints when events happen in your app:
  • New user signs up → trigger your user_signup event in Brew
  • Customer abandons cart → trigger cart_abandoned
  • Payment fails → trigger payment_failed
The agent doesn’t have to be in the loop for every send. It just sets up the automations once, and Brew fires them automatically.

Pattern: Chat-Driven Brand and Email Creation

Some agents (Lovable, Viktor) generate full apps and need to ship email as part of the build. Brew handles this too:
  1. User connects their brand in the Brew dashboard (one-time setup that produces an API key bound to that brand)
  2. Agent generates the email designs it needs (POST /v1/emails { prompt }, designs are untyped; the same design can be sent as a one-off or wired into a flow)
  3. Agent assembles an automation graph (POST /v1/automations { name, triggerEventId, nodes, connections }) and publishes it (PATCH /v1/automations/{automationId} { published: true })
  4. Agent wires the user’s app backend to fire the trigger from the real event: POST /v1/automations/triggers/{triggerEventId}/fire { payload, idempotencyKey }
The user gets fully on-brand email behavior in their app without ever opening Brew directly.

Authentication

Every API request needs an API key in the header:
Or:
Create a key for the active brand under Settings → API in Brew. Each key is bound to that brand, so send only the authentication header and do not add X-Brand-Id. See API authentication for the complete key and scope contract.
Read the key from an environment variable such as BREW_API_KEY and keep it on your server. An agent that writes your integration will hardcode the key if you paste it into the conversation, so give it the variable name, not the value. See Authentication.

Brew MCP Server

The fastest route. One URL connects any MCP client to the full toolset.

API Catalog

Run a capability in the dashboard, then copy the call or the implementation prompt.

API Reference

Full endpoint reference, authentication, and code examples.

Agentic Cookbook

End-to-end SDK recipes for agents driving automations start to finish.

Lovable

Worked example using Brew API from a Lovable app via Supabase Edge Functions.

Automations

Build flows and configure the trigger events your agent will fire.

Need Help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

Search Documentation

Type in the “Ask any question” search bar at the top left to instantly find relevant documentation pages.

ChatGPT/Claude Integration

Click “Open in ChatGPT” at the top right of any page to explore it further with ChatGPT or Claude.