---
title: Email Management API
slug: email-management-api
createdAt: 2022-09-02T09:16:51.000Z
---

:::hint{type="warning"}
This is a technical guide on the development of OElite Management Portal.
:::



| Production API Endpoint | https\://ama-beta.api.oelite.io                                                                         |
| ----------------------- | ------------------------------------------------------------------------------------------------------- |
| Production API Swagger  | [[https://api.oelite.io/swagger](https://ama.api.oelite.io/swagger)](https://ama.api.oelite.io/swagger) |

# Email Accounts

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/accounts",
  "name": "Email Account - Fetch Authorized Mail Accounts",
  "method": "GET",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "OYgciUgOoTX_WlAPIrlYo",
        "code": "{\n   \"data\":[\n      {\n         \"name\":\"Test User\",\n         \"displayName\":\"Test User\",\n         \"isExternalAccount\":false,\n         \"emailAddress\":\"test-user@abc.com\",\n         \"integratedMailAccountUserId\":\"635b6d31a3ea7b3fa0fb93f5\",\n         \"outgoingMailServerPort\":0,\n         \"sslEnabled\":false,\n         \"ownerAccountId\":121,\n         \"ownerUserId\":323,\n         \"createdOnUtc\":\"2022-09-09T17:40:49Z\",\n         \"incomingMailServerPort\":0,\n         \"sharedUserId\":0,\n         \"canRead\":true,\n         \"canWrite\":true,\n         \"canDelete\":true,\n         \"sharedUserStatus\":10,\n         \"searchIndexAllowed\":true,\n         \"id\":1,\n         \"status\":0,\n         \"baseSearchCount\":0,\n         \"searchIndexId\":\"1\",\n         \"isDeleted\":false\n      },\n      {\n         \"name\":\"Test Shared\",\n         \"displayName\":\" Test Shared\",\n         \"isExternalAccount\":false,\n         \"integratedMailAccountUserId\":\"621b6dab5c20c8b24be9f00d\",\n         \"outgoingMailServerPort\":0,\n         \"sslEnabled\":false,\n         \"ownerAccountId\":121,\n         \"ownerUserId\":323,\n         \"createdOnUtc\":\"2022-09-09T17:40:50Z\",\n         \"incomingMailServerPort\":0,\n         \"sharedUserId\":0,\n         \"canRead\":true,\n         \"canWrite\":true,\n         \"canDelete\":true,\n         \"sharedUserStatus\":10,\n         \"searchIndexAllowed\":true,\n         \"id\":2,\n         \"status\":0,\n         \"baseSearchCount\":0,\n         \"searchIndexId\":\"2\",\n         \"isDeleted\":false\n      }\n   ],\n   \"total\":2,\n   \"message\":\"\",\n   \"success\":true,\n   \"createdOnUtc\":\"0001-01-01T00:00:00Z\",\n   \"expiryOnUtc\":\"0001-01-01T00:00:00Z\",\n   \"graceTillUtc\":\"0001-01-01T00:00:00Z\",\n   \"associatedTotalCountPropertyName\":\"TotalRecordsCount\"\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "OYgciUgOoTX_WlAPIrlYo"
  },
  "examples": {
    "languages": [
      {
        "id": "jxzS5rZNKIdbP024E_lBn",
        "code": "",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "jxzS5rZNKIdbP024E_lBn"
  },
  "description": "Get all authorized mail account for the current requesting user",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Response**

A list of "**MailAccount**" should be expected.



***

# Mailboxes

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/mailboxes",
  "name": "Mailbox - Fetch Mailboxes",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account, used as part of the url path"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "specialUse",
        "type": "Boolean",
        "children": [],
        "description": "should the response include only folders with specialUse flag"
      },
      {
        "kind": "optional",
        "name": "showHidden",
        "type": "Boolean",
        "children": [],
        "description": "if true, hidden folders will also be returned"
      },
      {
        "kind": "optional",
        "name": "counters",
        "type": "Boolean",
        "children": [],
        "description": "if true, response will include the stats for total and unseen. Default is true. However stating it as false will improve the query performance."
      },
      {
        "kind": "optional",
        "name": "sizes",
        "type": "Boolean",
        "children": [],
        "description": "if true, the size of the mailbox in bytes will be returned."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "uiBURv4f9VLWfI7N1x5rw",
        "code": "{\n    \"data\": [\n        {\n            \"id\": \"631b6c3153ea7b3fa0fb93f6\",\n            \"name\": \"INBOX\",\n            \"path\": \"INBOX\",\n            \"modifyIndex\": 90,\n            \"subscribed\": true,\n            \"total\": 26,\n            \"unseen\": 4\n        },\n        {\n            \"id\": \"631db923ea92bcffbb88c60a\",\n            \"name\": \"Archive\",\n            \"path\": \"Archive\",\n            \"modifyIndex\": 0,\n            \"subscribed\": true,\n            \"total\": 0,\n            \"unseen\": 0\n        },\n        {\n            \"id\": \"631b6c3153ea7b3fa0fb93f9\",\n            \"name\": \"Drafts\",\n            \"path\": \"Drafts\",\n            \"specialUse\": \"\\\\Drafts\",\n            \"modifyIndex\": 397,\n            \"subscribed\": true,\n            \"total\": 1,\n            \"unseen\": 0\n        },\n        {\n            \"id\": \"631b6c3153ea7b3fa0fb93fa\",\n            \"name\": \"Junk\",\n            \"path\": \"Junk\",\n            \"specialUse\": \"\\\\Junk\",\n            \"modifyIndex\": 0,\n            \"subscribed\": true,\n            \"total\": 0,\n            \"unseen\": 0\n        },\n        {\n            \"id\": \"631b6c3153ea7b3fa0fb93f7\",\n            \"name\": \"Sent Mail\",\n            \"path\": \"Sent Mail\",\n            \"specialUse\": \"\\\\Sent\",\n            \"modifyIndex\": 3,\n            \"subscribed\": true,\n            \"total\": 3,\n            \"unseen\": 0\n        },\n        {\n            \"id\": \"631b6c3153ea7b3fa0fb93f8\",\n            \"name\": \"Trash\",\n            \"path\": \"Trash\",\n            \"specialUse\": \"\\\\Trash\",\n            \"modifyIndex\": 6,\n            \"subscribed\": true,\n            \"total\": 6,\n            \"unseen\": 0\n        }\n    ],\n    \"total\": 1,\n    \"message\": \"\",\n    \"success\": true,\n    \"createdOnUtc\": \"0001-01-01T00:00:00Z\",\n    \"expiryOnUtc\": \"0001-01-01T00:00:00Z\",\n    \"graceTillUtc\": \"0001-01-01T00:00:00Z\",\n    \"associatedTotalCountPropertyName\": \"TotalRecordsCount\"\n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "bkiJ2IH2mALelcXOuLb_x",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "uiBURv4f9VLWfI7N1x5rw"
  },
  "examples": {
    "languages": [
      {
        "id": "XaacFZS60tRhEX8cAIFxv",
        "code": "",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "XaacFZS60tRhEX8cAIFxv"
  },
  "description": "This endpoint is used to retreive a list of mailboxes of a requested mail account. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Response**

A list of "**WdMailboxInfo**" should be expected.



***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/purge/{mailboxId}",
  "name": "Mailbox - Purge Mailbox Message",
  "method": "DELETE",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "8GIs7qbUtO8hRzZjoTg-k",
        "code": "true",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "DADnb3yRlUtHDENP1Zs3x",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "8GIs7qbUtO8hRzZjoTg-k"
  },
  "examples": {
    "languages": [
      {
        "id": "nRWVdpnOCUgUg72RVMSHM",
        "code": "",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "nRWVdpnOCUgUg72RVMSHM"
  },
  "description": "Delete all messages of a requested mailbox",
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  }
}
```
:::

**Response**

"true" or "false"  should be expected

***





# Mailbox Messages

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/messages",
  "name": "Message - Fetch Mailbox Messages",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account as part of the request url"
      }
    ],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox"
      },
      {
        "kind": "optional",
        "name": "pageSize",
        "type": "Number",
        "children": [],
        "description": "number of messages to be returned"
      },
      {
        "kind": "optional",
        "name": "pageIndex",
        "type": "Number",
        "children": [],
        "description": "requested page number. start from 0."
      },
      {
        "kind": "optional",
        "name": "unreadOnly",
        "type": "Boolean",
        "children": [],
        "description": "if true, then returns only unread messages"
      },
      {
        "kind": "optional",
        "name": "includeMetaData",
        "type": "Boolean",
        "children": [],
        "description": "if true, then includes the metaData in the response"
      },
      {
        "kind": "optional",
        "name": "includeThreadMessageCount",
        "type": "Boolean",
        "children": [],
        "description": "if true, then include the threadMessageCount in the response. Counters slow down the query's performance."
      },
      {
        "kind": "optional",
        "name": "sortOrder",
        "type": "string",
        "children": [],
        "description": "ordering of the records' creation date. sortOrder can only take \"asc\" or \"desc\""
      },
      {
        "kind": "optional",
        "name": "nextCursor",
        "type": "string",
        "children": [],
        "description": "cursor value for the next page, retrieved from nextCursor in response value"
      },
      {
        "kind": "optional",
        "name": "previousCursor",
        "type": "string",
        "children": [],
        "description": "cursor value for the previous page, retrieved from previousCurosr in response value"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "0IrUkJCkTh9rNk5p2qDDY",
        "code": "{\n   \"success\":true,\n   \"total\":1,\n   \"page\":1,\n   \"previousCursor\":\"false\",\n   \"nextCursor\":\"false\",\n   \"results\":[\n      {\n         \"id\":1,\n         \"mailbox\":\"631b6c3153ea7b3fa0fb93f6\",\n         \"thread\":\"631db933ea92bcffbb88c60d\",\n         \"from\":{\n            \"name\":\"\",\n            \"address\":\"test-user@abc.com\"\n         },\n         \"to\":[\n            {\n               \"name\":\"\",\n               \"address\":\"test-user@abc.com\"\n            }\n         ],\n         \"cc\":[\n            \n         ],\n         \"bcc\":[\n            \n         ],\n         \"subject\":\"test-test-to-self\",\n         \"intro\":\"test This e-mail is scanned by OElite Enterprise Mail Gateway for virus and intentional spam checks. E-mail transmission cannot…\",\n         \"attachments\":false,\n         \"seen\":false,\n         \"deleted\":false,\n         \"draft\":false,\n         \"flagged\":false,\n         \"answered\":false,\n         \"forwarded\":false,\n         \"contentType\":{\n            \"value\":\"multipart/alternative\",\n            \"params\":{\n               \"boundary\":\"--=_RainLoop_617_437411321.1662892339\"\n            }\n         }\n      }\n   ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "0IrUkJCkTh9rNk5p2qDDY"
  },
  "examples": {
    "languages": [
      {
        "id": "7-RAF4WcSv4aiD6scMsGn",
        "code": "{\n   \"pageSize\":20,\n   \"pageIndex\":0,\n   \"mailboxId\":\"631b6c3153ea7b3fa0fb93f6\"\n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "7-RAF4WcSv4aiD6scMsGn"
  },
  "description": "This endpoint is used to retreive a list of emails of a requested mail box. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Response**

A "**WdBaseEntityCollectionResponse\<WdMessageBaseInfo>**"  object should be expected



***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/{mailboxId}/messages",
  "name": "Message - Update & Move Messages",
  "method": "PUT",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox where requesting messages are currently stored in"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "messageIds",
        "type": "Array",
        "description": "an array of requesting message ids."
      },
      {
        "kind": "optional",
        "name": "moveToMailboxId",
        "type": "string",
        "children": [],
        "description": "id of a mailbox when requesting to move messages from current mailbox to the specified mailbox"
      },
      {
        "kind": "optional",
        "name": "markAsSeen",
        "type": "Boolean",
        "children": [],
        "description": "if true, mark all requesting messages as read"
      },
      {
        "kind": "optional",
        "name": "markAsFlagged",
        "type": "Boolean",
        "children": [],
        "description": "if true, mark all requesting messages as flagged."
      },
      {
        "kind": "optional",
        "name": "markAsDraft",
        "type": "Boolean",
        "children": [],
        "description": "if true, mark asll requesting messages as draft"
      },
      {
        "kind": "optional",
        "name": "expires",
        "type": "string",
        "children": [],
        "description": "a ISO Date string for auto-expiring the message.  If submitted as 'false' in string, it will turn off auto-expiring feature of the requesting messages."
      },
      {
        "kind": "optional",
        "name": "metaData",
        "type": "string",
        "children": [],
        "description": "metaData information update for the requesting message"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "7ZF6DSyv8wftfEq6_AZ7E",
        "code": "{\n    success: true,\n    data: {\n      ids: [\n        6,\n        12\n      ],\n      updateCount: 2\n    }\n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "fbEigS7270PDWSAGGlD00",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "7ZF6DSyv8wftfEq6_AZ7E"
  },
  "examples": {
    "languages": [
      {
        "id": "vGrPxlkoqqepZdSlgekMm",
        "code": "{\n  \"messagIds\": [],\n  \"moveToMailboxId\": \"string\",\n  \"markAsSeen\": true,\n  \"markAsFlagged\": true,\n  \"markAsDraft\": true,\n  \"expires\": \"string\",\n  \"metaData\": \"string\"\n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "vGrPxlkoqqepZdSlgekMm"
  },
  "description": "This endpoint is used to update one or more message statuses. It is also used when moving messages to a different mailbox.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Response**

A **ResponseMessage** object will be returned. If successful, the 'data' field should contain field "**ids**" which is an array of messageId and "**updateCount**" which indicates how many messages were updated. In OElite OCC project, a "**WdMessageUpdateResponse**" object is defined for the return data.



***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/{mailboxId}/{messageId}/{markAsSeen}",
  "name": "Message - Get Messsage Details",
  "method": "GET",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "string",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mail box"
      },
      {
        "kind": "required",
        "name": "messageId",
        "type": "Number",
        "children": [],
        "description": "id of the email"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "Cd6VfGG-Blo1JH90MCUvX",
        "code": "{\n   \"success\":true,\n   \"total\":1,\n   \"page\":1,\n   \"previousCursor\":\"false\",\n   \"nextCursor\":\"false\",\n   \"results\":[\n      {\n         \"id\":1,\n         \"mailbox\":\"631b6c3153ea7b3fa0fb93f6\",\n         \"thread\":\"631db933ea92bcffbb88c60d\",\n         \"from\":{\n            \"name\":\"\",\n            \"address\":\"test-user@abc.com\"\n         },\n         \"to\":[\n            {\n               \"name\":\"\",\n               \"address\":\"test-user@abc.com\"\n            }\n         ],\n         \"cc\":[\n            \n         ],\n         \"bcc\":[\n            \n         ],\n         \"subject\":\"test-test-to-self\",\n         \"intro\":\"test This e-mail is scanned by OElite Enterprise Mail Gateway for virus and intentional spam checks. E-mail transmission cannot…\",\n         \"attachments\":false,\n         \"seen\":false,\n         \"deleted\":false,\n         \"draft\":false,\n         \"flagged\":false,\n         \"answered\":false,\n         \"forwarded\":false,\n         \"contentType\":{\n            \"value\":\"multipart/alternative\",\n            \"params\":{\n               \"boundary\":\"--=_RainLoop_617_437411321.1662892339\"\n            }\n         }\n      }\n   ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Cd6VfGG-Blo1JH90MCUvX"
  },
  "examples": {
    "languages": [
      {
        "id": "SO0Efj7EgZ2QwowgWCSkb",
        "code": "",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "SO0Efj7EgZ2QwowgWCSkb"
  },
  "description": "This endpoint is used to retreive a full message details of a requested email. ",
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  }
}
```
:::

**Response**

A "**WdMessageDetail**"  object should be expected



***



:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/{mailboxId}/message",
  "name": "Message - Upload a Mailbox Message",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "seen",
        "type": "Boolean",
        "children": [],
        "description": "is the message read or no"
      },
      {
        "kind": "optional",
        "name": "draft",
        "type": "Boolean",
        "children": [],
        "description": "is the message a draft. If the message is a draft (and later needs to be sent), you draft=true is required in order to use the \"Send Message\" endpoint."
      },
      {
        "kind": "optional",
        "name": "flagged",
        "type": "string",
        "children": [],
        "description": "is the message flagged"
      },
      {
        "kind": "optional",
        "name": "raw",
        "type": "string",
        "children": [],
        "description": "a message/rfc822 MIME formatted content which represent the entire email. When used, other message details will be discarded."
      },
      {
        "kind": "required",
        "name": "from",
        "type": "Object",
        "children": [],
        "description": "object of \"Address\""
      },
      {
        "kind": "required",
        "name": "to",
        "type": "Array",
        "children": [],
        "description": "An array of \"Address\" which are the recipients"
      },
      {
        "kind": "optional",
        "name": "cc",
        "type": "Array",
        "children": [],
        "description": "An array of \"Address\" which are the recipients to be copied in"
      },
      {
        "kind": "optional",
        "name": "bcc",
        "type": "Array",
        "children": [],
        "description": "An array of \"Address\" which are the recipients to be blind carbon copied"
      },
      {
        "kind": "required",
        "name": "subject",
        "type": "string",
        "children": [],
        "description": "subject of the message. if empty, resolve from \"reference\" message if available."
      },
      {
        "kind": "optional",
        "name": "text",
        "type": "string",
        "children": [],
        "description": "plaintext message"
      },
      {
        "kind": "optional",
        "name": "html",
        "type": "string",
        "children": [],
        "description": "html formatted message"
      },
      {
        "kind": "optional",
        "name": "headers",
        "type": "Array",
        "children": [],
        "description": "An array of name & value pairs for the message"
      },
      {
        "kind": "optional",
        "name": "files",
        "type": "Array",
        "children": [],
        "description": "An array of file IDs (in string) of the attachments. This is only used when the attachments are from storage files with referenced file Ids."
      },
      {
        "kind": "optional",
        "name": "attachments",
        "type": "Array",
        "children": [],
        "description": "An array of \"WdMessageAttachement\". Only the following fields are required: content, filename, contentType, cid. "
      },
      {
        "kind": "optional",
        "name": "metaData",
        "type": "String",
        "children": [],
        "description": "A JSON object or string for storing additional data. "
      },
      {
        "kind": "optional",
        "name": "reference",
        "type": "Object",
        "children": [],
        "description": "An object of WdReferenceWithAttachements. Note: this field is not yet developed in current feature."
      },
      {
        "kind": "optional",
        "name": "replacePrevious",
        "type": "Object",
        "children": [
          {
            "kind": "required",
            "name": "mailbox",
            "type": "string",
            "description": "id of the mailbox"
          },
          {
            "kind": "required",
            "name": "id",
            "type": "string",
            "description": "id of the message to be replaced"
          }
        ],
        "description": "If set, then delete the previous message with the same message id and replace it with the newly uploaded message. It's useful when auto-saving drafts."
      },
      {
        "kind": "optional",
        "name": "ess",
        "type": "string",
        "children": [],
        "description": "store a session identifier in the message for logging"
      },
      {
        "kind": "optional",
        "name": "ip",
        "type": "string",
        "children": [],
        "description": "ip address for message logging"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "8GIs7qbUtO8hRzZjoTg-k",
        "code": "{\n    success: \"true\",\n    data: {\n        id: 511,\n        mailbox: \"631b6c3153ea7b3fa0fb93f8\"\n    }\n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "DADnb3yRlUtHDENP1Zs3x",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "8GIs7qbUtO8hRzZjoTg-k"
  },
  "examples": {
    "languages": [
      {
        "id": "nRWVdpnOCUgUg72RVMSHM",
        "code": "{\n  \"unseen\": true,\n  \"draft\": true,\n  \"flagged\": true,\n  \"raw\": \"string\",\n  \"from\": {\n    \"name\": \"string\",\n    \"address\": \"string\"\n  },\n  \"to\": [\n    {\n      \"name\": \"string\",\n      \"address\": \"string\"\n    }\n  ],\n  \"cc\": [\n    {\n      \"name\": \"string\",\n      \"address\": \"string\"\n    }\n  ],\n  \"bcc\": [\n    {\n      \"name\": \"string\",\n      \"address\": \"string\"\n    }\n  ],\n  \"subject\": \"string\",\n  \"text\": \"string\",\n  \"html\": \"string\",\n  \"headers\": [\n    {\n      \"key\": \"string\",\n      \"value\": \"string\"\n    }\n  ],\n  \"files\": [\n    \"string\"\n  ],\n  \"attachments\": [\n    {\n      \"content\": \"string\",\n      \"filename\": \"string\",\n      \"contentType\": \"string\",\n      \"cid\": \"string\"\n    }\n  ],\n  \"metaData\": {},\n  \"reference\": {\n    \"mailbox\": \"string\",\n    \"id\": 0,\n    \"action\": \"string\",\n    \"attachments\": [\n      \"string\"\n    ]\n  },\n  \"replacePrevious\": {\n    \"mailbox\": \"string\",\n    \"id\": 0\n  },\n  \"sess\": \"string\",\n  \"ip\": \"string\"\n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "nRWVdpnOCUgUg72RVMSHM"
  },
  "description": "create anew email message",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Request Body**

Note: the body is "WdMessageUploadDetails" object, a derived structure from "WdMessageDetails". Only the fields listed above in Boday Parameters are used for the request.

**Response**

A **ResponseMessage** object with data containing the message id and mailbox id should be expected.



***





:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/{mailboxId}/{messageId}",
  "name": "Message - Delete Mailbox Message",
  "method": "DELETE",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox"
      },
      {
        "kind": "required",
        "name": "messageId",
        "type": "Number",
        "children": [],
        "description": "id of the message"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "8GIs7qbUtO8hRzZjoTg-k",
        "code": "true",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "DADnb3yRlUtHDENP1Zs3x",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "8GIs7qbUtO8hRzZjoTg-k"
  },
  "examples": {
    "languages": [
      {
        "id": "LzExa1E7M5QUS6hI8jiKu",
        "code": "",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "LzExa1E7M5QUS6hI8jiKu"
  },
  "description": "Delete a messages",
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  }
}
```
:::





***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/messages",
  "name": "Message - Batch Delete Mailbox Messages",
  "method": "DELETE",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "*",
        "type": "Array",
        "description": "an array of DeleteMessageRequest or WdDeleteMessageRequest object. "
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "WKqRYdRHpxpcRwNNFWDKY",
        "code": "{\n    success: true,\n    deleted: 2\n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "sw8RBVSY6Vfp8fvd-Ukso",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WKqRYdRHpxpcRwNNFWDKY"
  },
  "examples": {
    "languages": [
      {
        "id": "UemTzxi8PEtoEUupkv8yu",
        "code": "[\n   {\n      mailboxId: \"string\",\n      messageId: number\n   },\n   {\n      mailboxId: \"string\",\n      messageId: number\n   }\n]",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "UemTzxi8PEtoEUupkv8yu"
  },
  "description": "Delete a number of messages",
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  }
}
```
:::

**Response**

An object of **WdDeleteMessageResult** should be expected.



***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/{mailboxId}/{messageId}/attachment/download",
  "name": "Message - Download Attachment",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox"
      },
      {
        "kind": "required",
        "name": "messageId",
        "type": "Number",
        "children": [],
        "description": "id of the message"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "id",
        "type": "string",
        "children": [],
        "description": "id in WdMessageAttachment"
      },
      {
        "kind": "required",
        "name": "filename",
        "type": "string",
        "children": [],
        "description": "filename of the attachment - this is required for the download returning in correct file name"
      },
      {
        "kind": "optional",
        "name": "contentType",
        "type": "string",
        "children": [],
        "description": "if not specified, the default contentType is \"application/octet-stream\""
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "8GIs7qbUtO8hRzZjoTg-k",
        "code": "",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "DADnb3yRlUtHDENP1Zs3x",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "8GIs7qbUtO8hRzZjoTg-k"
  },
  "examples": {
    "languages": [
      {
        "id": "LzExa1E7M5QUS6hI8jiKu",
        "code": "{\n    \"id\": \"AT00001\",\n    \"filename\": \"text.xls\",\n    \"contentType\": \"application/vnd.ms-excel\"\n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "LzExa1E7M5QUS6hI8jiKu"
  },
  "description": "Download an attachment in a message",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Response**

A direct download file stream in "application/octet-stream" content type.



***

***



:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/messaging/emails/{mailAccountId}/{mailboxId}/{messageId}/deliver",
  "name": "Message - Send Message",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "mailAccountId",
        "type": "Number",
        "children": [],
        "description": "id of the mail account"
      },
      {
        "kind": "required",
        "name": "mailboxId",
        "type": "string",
        "children": [],
        "description": "id of the mailbox"
      },
      {
        "kind": "required",
        "name": "messageId",
        "type": "Number",
        "children": [],
        "description": "id of the message"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "deleteFiles",
        "type": "string",
        "children": [],
        "description": "if true then deletes attachment files listed in metaData.files array"
      },
      {
        "kind": "optional",
        "name": "sendTime",
        "type": "string",
        "children": [],
        "description": "this allows user to specify a future date time for delivery instead of sending the message out immediately."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "8GIs7qbUtO8hRzZjoTg-k",
        "code": "{\n \"success\": true,\n \"data\": {\n    \"id\": 0,\n    \"mailbox\": \"string\",\n    \"size\": 0\n }\n}\n",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "DADnb3yRlUtHDENP1Zs3x",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "8GIs7qbUtO8hRzZjoTg-k"
  },
  "examples": {
    "languages": [
      {
        "id": "LzExa1E7M5QUS6hI8jiKu",
        "code": "{\n    \"deleteFiles\": false\n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "LzExa1E7M5QUS6hI8jiKu"
  },
  "description": "Send a message for delivery. To deliver message using API, the message should have already been created as draft so a messageId can be obtained\n",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Request Body**

The Body parameters is available as "**WdMessageDeliverRequest**" object

**Response**

A "ResponseMessage" should be expected.


