Skip to content
MailHaap
[00]Reference

API reference

The MailHaap REST API reference, rendered from the published OpenAPI specification: every operation, every field, every error, with a runnable example.

Base URL

https://api.mailhaap.com/v1
Version 2026-08-0112 operations across 6 resourcesDownload openapi.yaml

Versioning

The URL carries the major version. Behavioural changes ship behind a dated version header (Mailhaap-Version: 2026-08-01) that is pinned per workspace at signup, so nothing changes under you. Breaking changes get a new date, and the previous two dates stay supported for at least twelve months with deprecation headers.
POST/emailssendEmail

Send an email

Parameters

Parameters for sendEmail
FieldTypeNotes
Idempotency-KeystringReplays within 24 hours return the original response.header

Request body

Request body for sendEmail
FieldTypeNotes
fromreqstringe.g. ABC Emlak <[email protected]>
toreqoneOf
ccarray<string>
bccarray<string>
reply_toarray<string>
subjectstringmax 998 chars
htmlstring
textstring
template_idstring
template_dataobject
attachmentsarray<object>max 20 items
attachments[].filenamereqstringmax 255 chars
attachments[].contentstring
attachments[].urlstringuri
attachments[].content_typestring
attachments[].content_idstringFor inline images (cid:)
headersobject
tagsarray<object>
tags[].namereqstring
tags[].valuereqstringmax 128 chars
trackingobject
tracking.opensbooleandefault false
tracking.clicksbooleandefault true
scheduled_atstringdate-time

Response · 202 Accepted and queued

Response body for sendEmail
FieldTypeNotes
idstringe.g. msg_01J8XQ7M2K9PQRSTUV
status"queued" | "scheduled"
created_atstringdate-time

Errors

  • 401 · Missing, invalid or revoked API key
  • 403 · Insufficient scope, IP not allowed, or tenant suspended
  • 422 · Validation or business rule failure
  • 429 · Too many requests

Example

POST /emails
curl -X POST https://api.mailhaap.com/v1/emails \
  -H "Authorization: Bearer $MAILHAAP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "from": "ABC Emlak <[email protected]>",
    "to": "value"
  }'
POST/emails/batchsendEmailBatch

Send up to 100 emails in one request

Parameters

Parameters for sendEmailBatch
FieldTypeNotes
Idempotency-KeystringReplays within 24 hours return the original response.header

Response · 207 Per-item results in request order

Response body for sendEmailBatch
FieldTypeNotes
dataarray<object>

Example

POST /emails/batch
curl -X POST https://api.mailhaap.com/v1/emails/batch \
  -H "Authorization: Bearer $MAILHAAP_API_KEY"
GET/emails/{id}getEmail

Retrieve a message and its event timeline

Parameters

Parameters for getEmail
FieldTypeNotes
idreqstringpath

Response · 200 OK

Response body for getEmail
FieldTypeNotes
idstring
status"queued" | "scheduled" | "sending" | "sent" | "delivered" | "bounced" | "complained" | "failed" | "suppressed" | "cancelled"
plane"mailbox" | "transactional" | "campaign"
fromstring
toarray<string>
subjectstring
tagsarray<object>
tags[].namereqstring
tags[].valuereqstringmax 128 chars
created_atstringdate-time
eventsarray<object>
events[].type"email.queued" | "email.sent" | "email.delivered" | "email.deferred" | "email.bounced" | "email.complained" | "email.opened" | "email.clicked" | "email.failed" | "contact.unsubscribed" | "domain.verified" | "domain.degraded" | "campaign.completed" | "campaign.throttled" | "campaign.blocked" | "tenant.limit_reached"
events[].occurred_atstringdate-time
events[].detailobject

Errors

  • 404 · Not found (also returned for resources belonging to another tenant)

Example

GET /emails/{id}
curl -X GET https://api.mailhaap.com/v1/emails/msg_01J8XQ7M2K9PQRSTUV \
  -H "Authorization: Bearer $MAILHAAP_API_KEY"
POST/emails/{id}/cancelcancelEmail

Cancel a queued or scheduled message

Parameters

Parameters for cancelEmail
FieldTypeNotes
idreqstringpath

Response · 200 Cancelled

No body.

Errors

  • 422 · Validation or business rule failure

Example

POST /emails/{id}/cancel
curl -X POST https://api.mailhaap.com/v1/emails/msg_01J8XQ7M2K9PQRSTUV/cancel \
  -H "Authorization: Bearer $MAILHAAP_API_KEY"