---
title: "Add a reply to an appmail"
method: POST
path: "/appmail/{id}/replies"
tags: ["App Mail Records"]
---

# Add a reply to an appmail

`POST /appmail/{id}/replies`

## Request

- Base URL: `https://api.surense.com/api/v1`
- URL: `https://api.surense.com/api/v1/appmail/{id}/replies`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://api.surense.com/oauth/token`

Adds an internal reply of the caller on the email and publishes an `EAppMailRepliedEvent`. Mentions must be of type `user`, reference users of the tenant and have distinct `order` values. Returns the updated record.

The record is looked up within the caller's tenant, and the caller must also be allowed to access the entity the email is linked to (employer, customer, lead, workflow or meeting, checked in that order); otherwise that entity's access check rejects the request. The caller also needs the update permission of the linked entity type (`employers:write`, `leads:update`, `workflows:update`, `customers:update` or `meetings:update`), checked in the service layer.

Errors: 400 if a mention is invalid; 403 if the update permission is missing; 404 if the record or a mentioned user does not exist.

## Path parameters

- `id` string, uuid, required

## Request body

- AddReplyRequest: Request to add a reply to an appmail
  - `jsonContent` JsonNode: Reply JSON content
    - `empty` boolean
    - `array` boolean
    - `null` boolean
    - `object` boolean
    - `float` boolean
    - `container` boolean
    - `string` boolean
    - `pojo` boolean
    - `floatingPointNumber` boolean
    - `short` boolean
    - `int` boolean
    - `long` boolean
    - `valueNode` boolean
    - `missingNode` boolean
    - `nodeType` 'ARRAY' | 'BINARY' | 'BOOLEAN' | 'MISSING' | 'NULL' | 'NUMBER' | 'OBJECT' | 'POJO' | 'STRING'
    - `integralNumber` boolean
    - `double` boolean
    - `bigDecimal` boolean
    - `bigInteger` boolean
    - `textual` boolean
    - `boolean` boolean
    - `binary` boolean
    - `number` boolean
    - `embeddedValue` boolean
  - `htmlContent` string, required: Reply HTML content
  - `mentions` AppMailMention[]: Mentions present in the reply
    - `type` string
    - `entityId` string, uuid
    - `label` string
    - `order` integer

## Response `200`

OK

- AppMailValue: An email logged as an activity on exactly one parent entity (employer, customer, lead, workflow or meeting).
  - `tenantId` string, uuid
  - `createdDate` string, date-time
  - `createdBy` string, uuid
  - `creatorName` string
  - `lastModifiedDate` string, date-time
  - `lastModifiedBy` string, uuid
  - `version` integer
  - `id` string, uuid: Email record ID.
  - `employerId` string, uuid: Employer the email is linked to, if any.
  - `customerId` string, uuid: Customer the email is linked to, if any.
  - `leadId` string, uuid: Lead the email is linked to, if any.
  - `workflowId` string, uuid: Workflow the email is linked to, if any.
  - `meetingId` string, uuid: Meeting the email is linked to, if any.
  - `plainContent` string: Plain-text body of the email.
  - `subject` string: Email subject.
  - `fromPersonal` string: Display name of the sender.
  - `fromAddress` string: Email address of the sender.
  - `to` InternetAddress[]: To recipients.
    - `personal` string
    - `address` string
    - `fullAddress` string
  - `cc` InternetAddress[]: Cc recipients.
    - `personal` string
    - `address` string
    - `fullAddress` string
  - `bcc` InternetAddress[]: Bcc recipients.
    - `personal` string
    - `address` string
    - `fullAddress` string
  - `attachments` AppMailAttachment[]: Attachments, each stored as a document.
    - `documentId` string, uuid
    - `documentName` string
  - `emlSize` integer: Size of the stored EML file, in bytes.
  - `htmlSize` integer: Size of the stored HTML file, in bytes.
  - `provider` string: Provider of the connected mailbox the email was sent from through Direct Send; null for any other email.
  - `providerMessageId` string: The provider's own ID of the sent email, when the provider named one.
  - `providerWebLink` string: Link opening the sent email in the provider's web client (Outlook only).
  - `reactions` AppMailReaction[]: Reactions of users on the email, oldest first.
    - `id` string, uuid
    - `userId` string, uuid
    - `userName` string
    - `reaction` string
    - `reactedAt` string, date-time
  - `replies` AppMailReply[]: Replies of users on the email, oldest first.
    - `id` string, uuid
    - `userId` string, uuid
    - `userName` string
    - `jsonContent` JsonNode: Reply JSON content
      - `empty` boolean
      - `array` boolean
      - `null` boolean
      - `object` boolean
      - `float` boolean
      - `container` boolean
      - `string` boolean
      - `pojo` boolean
      - `floatingPointNumber` boolean
      - `short` boolean
      - `int` boolean
      - `long` boolean
      - `valueNode` boolean
      - `missingNode` boolean
      - `nodeType` 'ARRAY' | 'BINARY' | 'BOOLEAN' | 'MISSING' | 'NULL' | 'NUMBER' | 'OBJECT' | 'POJO' | 'STRING'
      - `integralNumber` boolean
      - `double` boolean
      - `bigDecimal` boolean
      - `bigInteger` boolean
      - `textual` boolean
      - `boolean` boolean
      - `binary` boolean
      - `number` boolean
      - `embeddedValue` boolean
    - `htmlContent` string
    - `createdAt` string, date-time
    - `updatedAt` string, date-time
    - `mentions` AppMailMention[]
      - `type` string
      - `entityId` string, uuid
      - `label` string
      - `order` integer
    - `reactions` AppMailReaction[]
      - `id` string, uuid
      - `userId` string, uuid
      - `userName` string
      - `reaction` string
      - `reactedAt` string, date-time

---

[API](https://skmtc.dev/surense/apis/appmail-api.md) - [All operations](https://skmtc.dev/surense/apis/appmail-api/llms.txt) - [OpenAPI document](https://skmtc.dev/surense/apis/appmail-api/revisions/dd959778fa2e?raw)
