Search Documentation
Search for a documentation page...
Contact Messages API
REST API endpoints for contact form submissions and customer inbox management.
Contact messages cover two surfaces: a contact form endpoint for visitors to submit messages, and a customer inbox for store owners to browse, read, and reply to those messages.
The inbox merges two sources: email messages (sent and received via Resend) and contact-form submissions (from the storefront contact form). Every message in the list and detail responses includes a source field — "email" or "contact" — so you can distinguish them. Contact-form messages are always direction: "inbound" and have to, cc, bcc, replyTo, subject, html, and reason set to null.
Create Contact Message
Saves a contact form message and notifies the merchant by email. The email notification is sent in the background, so the response returns as soon as the message is stored.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Sender email address |
message | string | Yes | Message content (1-5000 characters) |
routingKey | string | No | Opaque label assigned by the storefront form (max 100 chars). The merchant maps labels to recipient mailboxes via settings.contactRoutingEmails; unmatched or missing keys fall back to notificationEmail. |
Response (201)
A 400 is returned with { error, details } when the email is malformed or the message is empty or over 5000 characters.
List Messages
Returns a paginated list of inbound and outbound messages in the store's inbox.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Messages per page (1-100) |
offset | number | 0 | Messages to skip |
query | string | — | Search by sender address or subject |
filter | string | all | Message status: all, unread, or read |
direction | string | — | Filter by inbound or outbound |
Response (200)
When direction=outbound is set, contact-form messages are excluded automatically since they are always inbound.
Get Message
Returns a single message by UUID.
Returns 404 if the message does not exist.
Mark as Read
Marks an inbox message as read (sets readAt to the current time). Returns the updated message.
Reply to Message
Sends a reply email to the customer and records the outbound message in the inbox. Works for both email and contact-form messages — for contact-form submissions the default subject is "Re: your message". Only inbound messages can be replied to.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
body | string | Yes | Plain-text reply (1-50000 chars). Blank lines become paragraphs. |
subject | string | No | Override subject line (defaults to Re: <original subject>) |
Response (201)
| Status | Description |
|---|---|
409 | Cannot reply to outbound messages |
502 | Email delivery failed |
Delete Message
Permanently deletes a message from the inbox.