REST API v1
Everything the app can do, as an endpoint.
Manage contacts, build and send campaigns, read reporting, subscribe to webhooks, and call the AI copy tools, from your own systems.
Base URL
https://tweak.email/api/v1
Authentication
Authorization: Bearer <your-api-key>
Or the X-Api-Key header. API access is on every paid plan. Team owners and admins generate the key in the app under Settings → API.
Your first call
Confirm the credential works and see what it can reach:
curl https://tweak.email/api/v1/me \
-H "Authorization: Bearer $TWEAK_API_KEY"
Add a contact. The write is an upsert on email address, so re-running it is safe:
curl -X POST https://tweak.email/api/v1/contacts \
-H "Authorization: Bearer $TWEAK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email":"jane@example.com","first_name":"Jane","tag_ids":[3],"consent_attested":true}'
A contact who has already unsubscribed keeps that status no matter what you send, so a full-address-book re-sync can never quietly resubscribe someone. metadata is merged into what is stored: keys you send overwrite, a key sent as null is removed, the rest stay.
consent_attested is required whenever a request creates a contact (in a bulk upsert, for the batch or on each row that creates one): it confirms the person gave permission to receive email from you and was not taken from a purchased, rented or scraped list. Requests that would create a contact without it are refused with 422. Updating a contact you already have does not need it.
Contacts
Contacts, lists, tags, and saved segments. Upserts key on email address, so a sync job never needs to hold our ids. Contacts synced from a connected Shopify store carry their order data as shopify_* contact fields, readable and usable in segment rules like any other.
/contacts
List contacts. Filter by status, tag, list, segment, or modification time
POST
/contacts
Create or upsert by email
POST
/contacts/bulk
Upsert up to 1,000 at once
GET
/contacts/{contact}
Fetch by id or email address
PATCH
/contacts/{contact}
Update fields, status, tags, or list membership
DELETE
/contacts/{contact}
Soft delete
POST
/contacts/{contact}/tags
Add tags, starting tag-triggered sequences
POST
/contacts/{contact}/erase
GDPR Article 17 erasure
GET
/lists
Contact lists, with membership endpoints
GET
/tags
Tags
GET
/contact-fields
Your custom contact fields and their types
POST
/contact-fields
Create a custom field; rename or delete it later
POST
/segments/preview
Resolve a segment definition to a count and a sample
Campaigns
Author, review, and send. Every send runs the same gates as the app: verified sending domain, unsubscribe link, plan allowance, abuse screening.
/campaigns
List campaigns
POST
/campaigns
Create a draft
PUT
/campaigns/{campaign}/content
Set the body, or seed it from a template
POST
/campaigns/{campaign}/variants
Set up an A/B test: subject lines, content, both, or send times
POST
/campaigns/{campaign}/preflight
Dry-run every send check, read-only
POST
/campaigns/{campaign}/test
Send test messages to named addresses
POST
/campaigns/{campaign}/send
Send now
POST
/campaigns/{campaign}/schedule
Send at a future time
POST
/campaigns/{campaign}/cancel
Cancel a draft, scheduled, or paused campaign
GET
/templates
Your templates plus the starter library
GET
/sequences
Sequences, with their step trees
POST
/sequences
Build a sequence (e-mails, waits, conditions, exits) as a draft; it is activated in the app
PATCH
/sequences/{sequence}
Change a sequence or replace its step tree
POST
/sequences/{sequence}/subscribers
Enrol contacts by id or e-mail address
Reporting
The read side of the event pipeline. Machine opens (Apple MPP) are excluded by default, so the rates reflect human engagement.
/events
Every delivery event. Filter by type, campaign, contact, or date
POST
/events
Report delivery events for mail you send outside tweak.email
POST
/conversions
Report a purchase or sign-up, credited to the campaign that led to it
GET
/campaigns/{campaign}/report
Delivery and engagement metrics
GET
/campaigns/{campaign}/report/links
Per-link click breakdown, bot traffic separated
GET
/campaigns/{campaign}/report/variants
Per-variant A/B results
GET
/campaigns/{campaign}/recipients
Per-recipient delivery detail
GET
/suppressions
The do-not-mail list
Transactional & AI
One-off sends through the same infrastructure as campaigns, plus the AI tooling as callable endpoints.
Webhooks & keys
Subscribe a URL to platform events instead of polling. Manage credentials programmatically for automated rotation. A connected Shopify store posts its own updates to /webhooks/shopify/{id}; connecting the store under Settings → Integrations registers them there, so there is nothing for you to call.
/webhooks/event-types
Everything you can subscribe to
POST
/webhooks
Register an endpoint, returning the signing secret once
GET
/webhooks/{endpoint}/deliveries
What we sent and what your endpoint answered
POST
/webhooks/{endpoint}/test
Fire a synthetic event to verify your signature check
GET
/api-keys
List keys, with masked prefixes
POST
/api-keys
Mint a scoped key
DELETE
/api-keys/{key}
Revoke
Cursor pagination
Every collection is keyset-paginated. Pass next_cursor back as ?cursor= and stop when has_more is false. A cursor that was altered, or came from another listing, is a 422.
{
"data": [ ... ],
"per_page": 25,
"next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
"has_more": true
}
Deep pages stay fast, and rows arriving mid-walk can't cause a sync to skip records the way shifting offsets do.
Idempotency
Send an Idempotency-Key header on any write. A retry with the same key replays the original response instead of executing again.
-H "Idempotency-Key: order-4417-receipt"
Use it on campaign sends especially: a duplicated send is the one mistake here you can't undo. Keys are honoured for 24 hours. A replayed response carries Idempotency-Replayed: true; the same key with a different body is a 422, and a retry while the first is still running is a 409. Keys are shared by your team and bound to the API key that first used them, so another of your keys reusing one gets the 422 too: give each integration its own keys.
Scoped keys
Issue one key per integration with only the scopes it needs, then revoke that one without disturbing the others.
contacts:read
contacts:write
campaigns:read
campaigns:write
campaigns:send
events:read
events:write
suppressions:read
suppressions:write
transactional:send
ai:write
webhooks:read
webhooks:write
keys:manage
A :write grant implies the matching :read. Sending is its own scope, so a key that drafts campaigns can't put mail in front of customers. Creating and revoking keys needs keys:manage, and regenerating the main key in Settings revokes every key created through the API.
Webhook signatures
Every delivery carries a Tweak-Signature header. Verify it against the raw request body before trusting the payload.
Tweak-Signature: t=1754835600,v1=9f86d0818...
hmac_sha256(secret, "{t}.{raw_body}") == v1
The timestamp is inside the signed material, so a captured payload can't be replayed at you indefinitely. Reject anything older than a few minutes.
Unified event pipeline
Every delivery event, whether from provider webhooks, native sends, or delivery events you report with POST /events for mail sent elsewhere, flows through one pipeline, and back out again over GET /events and your webhooks.
- Campaign stats updated automatically
- Auto-suppress on bounce, spam, unsubscribe
- Contact statuses synced in real time
- Switch providers, keep your history
POST /events takes delivery event types only, not product events of your own. To react to something in your product, add a tag to the contact with POST /contacts/{contact}/tags and let a sequence with the tag-added trigger take it from there.
Reverse ETL
Connect BigQuery, pick an audience without a CSV, and use approved warehouse fields as merge tags at send time.
- OAuth with read-only BigQuery scope
- Browse datasets, tables, and columns
- Map columns to email placeholders
- Approved fields resolved during sending
Rate limits
Counted per API key, so one integration's burst never eats another's headroom. Every response carries X-RateLimit-Limit and X-RateLimit-Remaining; a 429 adds Retry-After. An address that keeps sending a missing or wrong key is blocked for the rest of the minute.
| Requests (Starter) | 120/min |
| Requests (Pro) | 300/min |
| Requests (Business) | 600/min |
| Events per request | 1,000 |
| Contacts per bulk call | 1,000 |
| Records per page | 100 |
Error responses
Standard HTTP status codes with JSON error bodies.
| 400 | Body sent as JSON is not valid JSON (invalid_json) |
| 401 | Missing, invalid, revoked, or expired key |
| 403 | Missing scope, or plan excludes API access |
| 404 | No such record on your team |
| 409 | Same Idempotency-Key still in progress |
| 422 | Validation error, an unsupported body field, or a send gate failed |
| 429 | Rate limited, see Retry-After |
| 502 | A transactional send could not be handed over; nothing sent |
| 503 | Sending or AI temporarily unavailable; retry later |
A refused send returns a blockers array naming each unmet requirement. POST /campaigns/{id}/preflight returns the same list without attempting to send.
Every paid plan
Build on it today
Generate your key under Settings → API, mint a scoped key for each integration, point your client at the OpenAPI spec, and ship.
Start free