Brew accepts batch writes onDocumentation Index
Fetch the complete documentation index at: https://docs.brew.new/llms.txt
Use this file to discover all available pages before exploring further.
/v1/contacts so agents and back-end importers can upsert / delete many rows in a single request without burning the per-request rate-limit budget. Batches are partial-success-safe — one bad row doesn’t fail the whole call.
Where it applies
| Endpoint | Batch shape | Max rows | Rate-limit policy |
|---|---|---|---|
POST /v1/contacts | { contacts: [...] } | 1000 | contacts.write_batch (10 / min) |
DELETE /v1/contacts | { emails: [...] } | 1000 | contacts.write_batch (10 / min) |
contacts.write_single policy (100 / min). Choose the shape that matches your workload — 100/min × 1 row = 100 contacts/min; 10/min × 1000 rows = 10,000 contacts/min.
Partial-success contract
The HTTP status is200 even when some rows fail. Per-row failures are surfaced in errors[] so callers can iterate, fix, and re-submit just the bad rows.
| Field | Meaning |
|---|---|
summary.inserted | Rows that didn’t exist before this request. |
summary.updated | Rows that existed and were updated. |
summary.failed | Rows in errors[]. The total of inserted + updated + failed matches the input length. |
fieldsCreated | Custom field definitions auto-created on the brand by this request (snake_case / kebab-case → camelCase normalised). |
errors[] | Per-row failures keyed on email. Each carries a stable code (e.g. MISSING_EMAIL, INVALID_EMAIL). |
warnings[] | Non-fatal observations (field normalisation, coercion, duplicate emails collapsed). |
POST /v1/contacts — batch upsert
Up to 1000 rows per request. email is the merge key; missing or malformed emails land in errors[]. Custom fields auto-create field definitions on the brand on first sight — see Pagination for reading them back.
200):
TypeScript SDK
DELETE /v1/contacts — batch delete
Up to 1000 emails per request. The endpoint is idempotent — deleting a non-existent email surfaces in notFound[], not as an error.
200):
Common per-row error codes
| Code | When |
|---|---|
MISSING_EMAIL | Row in contacts[] omitted email. |
INVALID_EMAIL | email is not RFC-5322 compliant. |
DUPLICATE_EMAIL | Two rows in the same batch had the same email (only the last write survives). Surfaced as a warning, not an error. |
FIELD_TYPE_MISMATCH | A custom-field value didn’t match the existing field definition’s type. Re-emit with a coerced value OR delete the field. |
RATE_LIMITED, INVALID_REQUEST) only ever apply to the whole request, never to individual rows.
Auto-created field definitions
When a batch upsert references a custom column that doesn’t have afieldDefinitions row on the brand yet, the helper auto-creates one BEFORE the write. The new column shows up immediately in:
- the contacts page (filterable / sortable / searchable),
- the audience builder,
GET /v1/fields,GET /v1/contacts?logic=and&filters=[{"field":"plan","operator":"eq","value":"pro"}].
normalizeAudienceFieldName so snake_case + kebab-case + spaces all converge on the same camelCase column. Normalisation events surface in warnings[] as FIELD_NAME_NORMALIZED.
Why partial success, not “all-or-nothing”
A 1000-row import where 3 rows have bad emails should not block the 997 valid rows. Brew’s contract:- Validate every row independently.
- Write the valid ones in a single bulk Mongo operation.
- Report failed rows in
errors[]keyed onemail. - Return HTTP
200with the summary.
summary.failed === 0 and roll back yourself (e.g. by DELETE on the inserted emails).
See also
- Idempotency — set
Idempotency-Keyon the batch so a retry doesn’t replay 1000 rows. - Rate limits —
contacts.write_batchis 10/min (vs single at 100/min); plan accordingly. - Pagination — for reading back the imported rows.
- Errors — full error catalog for the foundational request-level codes.
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.