API
Subscribe
POST /subscribe
Use this when someone is opting in to marketing. MailPirate adds them to the store’s default list and applies double opt-in when your workspace requires it.
For CRM-only sync without starting confirmation, use Profiles upsert instead. For on-site forms without a token, use Embed forms.
Request
POST /api/v1/marketing/subscribe
Authorization: Bearer mp_...
Content-Type: application/json
{
"store_slug": "main",
"email": "[email protected]",
"first_name": "Ada",
"last_name": "Lovelace"
}
| Field | Required | Notes |
|---|---|---|
store_slug |
Yes | Must belong to the token’s workspace |
email |
Yes | |
first_name |
No | |
last_name |
No |
Behavior
- Upsert the profile for that store + email
- Add them to the store’s default list
- If double opt-in is enabled → start confirmation, status often
pending - If double opt-in is off → confirm/subscribe according to workspace rules
Response 200
{
"public_id": "01H...",
"status": "pending"
}
Common statuses
| Status | Meaning |
|---|---|
pending |
Waiting for confirmation |
subscribed |
Can receive marketing (unless suppressed) |
unsubscribed |
Opted out |
suppressed |
Blocked by bounce/complaint/manual suppression |
Example
curl -sS -X POST "https://app.mailpirate.com/api/v1/marketing/subscribe" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"store_slug": "main",
"email": "[email protected]",
"first_name": "Ada"
}'
Related
- Profiles & consent product guide
- Outbound webhooks (
profile.subscribed)