Brew API Overview
Brew’s REST API gives you secure, programmatic access to core email marketing features. Use the API to:- Test and verify your API key
- Send transactional emails using your published email designs
- Trigger automations with events and update contact data
- Manage contacts with full CRUD operations
- Create custom contact properties for segmentation and personalization
- View subscription groups for audience organization
Quick Start
Get up and running in under 5 minutes:1
Get your API key
In Brew, go to Settings → API and click Generate Key. Give it a descriptive name like “Production App”.
All API requests require authentication using your API key as a Bearer token:
2
Test your connection
3
Start building
Explore the API endpoints and build your integration. Send your first transactional email, create contacts, or trigger automations.
Base URL and Authentication
Base URL:https://api.brew.new/v1
All requests must include an Authorization header with your API key:
- GET - Retrieve data
- POST - Create new resources
- PUT - Update existing resources
- DELETE - Remove resources
API Endpoints
The Brew API provides the following endpoints:Authentication
| Method | Endpoint | Description |
|---|---|---|
| GET | /api-key | Test and verify your API key |
Transactional Emails
| Method | Endpoint | Description |
|---|---|---|
| POST | /transactional | Send a transactional email |
| GET | /transactional | List published transactional email designs |
Events
| Method | Endpoint | Description |
|---|---|---|
| POST | /events/send | Send an event to trigger automations |
Contacts
| Method | Endpoint | Description |
|---|---|---|
| POST | /contacts/create | Create a new contact |
| GET | /contacts/{identifier} | Find a contact by email or userId |
| PUT | /contacts/{identifier} | Update an existing contact |
| DELETE | /contacts/{identifier} | Delete a contact |
Contact Properties
| Method | Endpoint | Description |
|---|---|---|
| POST | /contacts/properties | Create a custom contact property |
| GET | /contacts/properties | List all contact properties |
Subscription Groups
| Method | Endpoint | Description |
|---|---|---|
| GET | /subscription-groups | List all subscription groups |
Common Use Cases
- Transactional Emails
- List Transactional Emails
- Trigger Automations
- Create Contact
- Find Contact
- Update Contact
- Delete Contact
Send password resets, order confirmations, and other triggered emails:Response:You can also add the recipient to your audience while sending:
Custom Properties
Brew supports custom contact properties to store additional data for segmentation and personalization. Add custom properties as top-level fields in your contact requests.Supported Data Types
| Type | Description | Example |
|---|---|---|
string | Text values | "Enterprise", "Product Manager" |
number | Numeric values | 50, 99.99, -10 |
boolean | True/false values | true, false |
date | Unix timestamps in seconds | 1704067200 (2024-01-01) |
Creating Custom Properties
Before using custom properties in API calls, create them first:Listing Properties
Reserved Field Names
The following field names are reserved and cannot be used for custom properties:email,firstName,lastName,userId,source,subscribed,subscriptionGroups
Resetting Properties
Sendnull as the value to clear any contact property:
Subscription Groups
Subscription groups let you organize your audience and give contacts control over what types of emails they receive. Use the group IDs when creating or updating contacts.Listing Subscription Groups
Using Subscription Groups
Include subscription groups when creating or updating contacts:Rate Limits
Brew enforces 10 requests per second per account.Error Handling
Brew uses standard HTTP status codes with consistent error responses:| Status | Description |
|---|---|
| 200 | Success |
| 400 | Bad request |
| 401 | Invalid API key |
| 404 | Resource not found |
| 409 | Conflict (duplicate) |
| 429 | Rate limit exceeded |
| 500 | Server error |
Common Error Solutions
Common Error Solutions
401 Unauthorized:
- Check your API key is correct and active
- Ensure you’re using
Bearer YOUR_API_KEYformat - Generate a new key from Settings → API if needed
- Verify all required fields are included
- Check data types match the API specification
- Ensure email addresses are properly formatted
- Implement exponential backoff in your retry logic
- Consider batching requests where possible
- Monitor rate limit headers in responses
- Brew enforces a maximum of 500 characters per value in request bodies
- If you receive this error, shorten any long values and try again
CORS and Client-Side Issues
CORS and Client-Side Issues
Brew’s API does not support cross-origin requests from browsers. Always make API calls from your backend server.
Idempotency
Idempotency ensures that operations (like sending emails) are only performed once, even if you make the same API request multiple times. This is particularly useful for:- Preventing duplicate emails when network issues cause retries
- Safely retrying failed API calls without worrying about side effects
- Maintaining data consistency during system outages or timeouts
Idempotency-Key header with a unique value:
How Idempotency Works
- When you include an idempotency key with a request, Brew checks if it’s seen this key before
- If this is the first time seeing the key, Brew processes the request normally
- If the key was used in the last 24 hours, Brew returns the same response as the original request without performing the operation again
Best Practices
- Use a unique identifier for each distinct operation (UUID is recommended)
- Reuse the same key when retrying the exact same request
- Keys can be up to 100 characters in length
- Consider structuring keys that relate to your business logic (e.g.,
welcome-email/user-123) - Keys expire after 24 hours, after which they can be reused
OpenAPI Specification
Get started quickly with the Brew API using our OpenAPI documents. Import these into API clients like Postman or Insomnia to explore all endpoints with example requests and responses.Download YAML
OpenAPI 3.1 specification in YAML format
Download JSON
OpenAPI 3.1 specification in JSON format
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 analyze documentation with ChatGPT or Claude for deeper insights.