Four Ways In
Pick by what you’re building, not by preference. All four hit the same executors, validation, and credit metering.
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.)
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:- Define each Brew endpoint as a tool in your agent’s tool registry
- Provide auth headers using your Brew API key
- Let the agent call the right tool, generating an email, sending it, building an automation, based on conversation
fetch calls. createBrewClient handles retries, idempotency keys, and typed errors, so a tool handler is one call:
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_signupevent in Brew - Customer abandons cart → trigger
cart_abandoned - Payment fails → trigger
payment_failed
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:- User connects their brand in the Brew dashboard (one-time setup that produces an API key bound to that brand)
- 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) - Agent assembles an automation graph (
POST /v1/automations { name, triggerEventId, nodes, connections }) and publishes it (PATCH /v1/automations/{automationId} { published: true }) - Agent wires the user’s app backend to fire the trigger from the real event:
POST /v1/automations/triggers/{triggerEventId}/fire { payload, idempotencyKey }
Authentication
Every API request needs an API key in the header:X-Brand-Id. See API authentication
for the complete key and scope contract.
What to Read Next
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:- Self-Service Tools
- Talk to Our Team
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.