Skip to content

Inbound Emails API

All endpoints require authentication and projects tool permissions.

Supports inbound emails for any resource type: project, deal, contact, company, candidate, or task.

GET /api/inbound-emails

Permission: projects:view

Query parameters:

ParamTypeRequiredDescription
resource_typestringYesResource type (e.g. project, deal, contact)
resource_idstringYesResource ID
statusstringNoFilter by status

Response: { emails } — each email includes task_title if linked to a task. Limited to 100 results, ordered by received_at descending.

GET /api/inbound-emails/unrouted

Permission: projects:manage

Returns emails with resource_type = 'unrouted' for manual triage. Limited to 100 results.

Response: { emails }

GET /api/inbound-emails/:id

Permission: projects:view

Response: { email } — includes task_title if linked.

PUT /api/inbound-emails/:id

Permission: projects:update

Body:

FieldTypeDescription
statusstringNew status
task_idstring or nullLink/unlink a task
resource_typestringReassign resource type (requires resource_id)
resource_idstringReassign resource ID (requires resource_type)

When reassigning to a new resource, matched_by is set to manual.

Response: { email }

DELETE /api/inbound-emails/:id

Permission: projects:update

Response: { ok: true }

POST /api/inbound-emails/:id/convert

Permission: projects:update

Creates a new task from the email’s subject and body. The task is linked to the email’s resource if it is a project or deal. The email status is set to converted and linked to the new task.

Response: { task }

POST /api/inbound-emails/:id/reply

Permission: projects:update

Sends a threaded reply via the Gmail API. Includes the user’s email signature (if configured) and a quoted version of the original email. Threading is maintained via RFC822 Message-ID headers and Gmail thread IDs.

Body:

FieldTypeRequiredDescription
bodystringYesHTML body of the reply

The reply is stored as an outbound inbound_emails record with status read. The original email is also marked as read if previously unread.

Response: { ok: true, gmail_message_id, reply_id, thread_id }