TrustPager Docs

← Help Center

Communications

Email Send API � Entity Validation and Error Codes

How POST /v1/email/send validates entity IDs, what each error code means, and the three valid payload shapes for linking an email to a contact, opportunity, or company.

The TrustPager email send endpoint (POST /v1/email/send) validates any entity IDs in your payload before dispatching. If an ID references a contact, opportunity, or company that no longer exists in the workspace, the request is rejected with a 400 � the email is not sent. This prevents ghost threads appearing in the Inbox with "No messages in this thread".

Error codes

400 VALIDATION_ERROR � invalid entity ID

Returned when one or more of contact_id, deal_id / opportunity_id, or customer_id / company_id cannot be found in the workspace. The email is not sent.

Response body shape:

{
  "error": "VALIDATION_ERROR",
  "details": {
    "missing_entities": [
      { "field": "contact_id", "id": "<uuid>" }
    ]
  }
}

details.missing_entities lists every bad field in the payload � you may get more than one entry if multiple IDs are stale.

422 EMAIL_LOG_FAILED � email delivered, log not persisted

Returned when TrustPager Mail accepted the send and the email was delivered to the recipient, but the internal log row could not be written. The email reached the recipient. The response body includes the provider message ID so you have a delivery reference:

{
  "error": "EMAIL_LOG_FAILED",
  "message_id": "<provider-message-id>"
}

This is distinct from EMAIL_DELIVERY_FAILED, which means the email was not delivered. If you receive EMAIL_LOG_FAILED, the send succeeded � the log entry just won't appear in https://app.trustpager.com/data/emails.

Three valid payload shapes

Shape What to pass Result
Linked send A current, valid entity UUID in contact_id, opportunity_id, or company_id Email sends, log created, thread links to the entity in Inbox and the entity's activity feed
Unlinked send Omit the entity fields entirely, or pass null Email sends, log created, thread appears in Inbox unlinked. This is the standard path for free-form sends to an arbitrary address
Stale ID A UUID that no longer exists in the workspace 400 VALIDATION_ERROR � email not sent. Fix the ID or omit the field

Troubleshooting

← Back to Help Center Open on trustpager.com ↗