# Email

**All the endpoints that can be called on the Email controller.**

All these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`

## newInboundMessage

> \*\*Creates a new inbound email message and decides if a new ticket is needed.\*\*\
> \
> If you want to add multiple items to a request, just copy the keys and add indices to the empty square brackets.

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}}},"paths":{"/api/v2/email/newInboundMessage":{"post":{"tags":["Email"],"summary":"newInboundMessage","description":"**Creates a new inbound email message and decides if a new ticket is needed.**\n\nIf you want to add multiple items to a request, just copy the keys and add indices to the empty square brackets.","operationId":"newInboundMessagePOST","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"messageID":{"description":"The ID for the message to be created. \n\nOnly used to check if the message exists already with this brand ID.","type":"string","default":""},"externalID":{"description":"External ID of the ticket.","type":"string","default":""},"fromAddress":{"type":"object","properties":{"name":{"description":"The name of where the email is being sent from.","type":"string","default":""},"address":{"description":"The address where the email is being sent from.","type":"string","default":""}}},"replyToAddress":{"type":"object","properties":{"name":{"description":"Alternative to `fromAddress[name]` if it is a reply.","type":"string","default":""},"address":{"description":"Alternative to `fromAddress[address]` if it is a reply.","type":"string","default":""}}},"toAddresses":{"type":"array","items":{"type":"object","properties":{"address":{"description":"The address where this message is being sent to.","type":"string"}}}},"ccAddresses":{"type":"array","default":[],"items":{"type":"object","properties":{"address":{"description":"The CC address where this message is being sent to.","type":"string"}}}},"bccAddresses":{"type":"array","default":[],"items":{"type":"object","properties":{"address":{"description":"The BCC address where this message is being sent to.","type":"string"}}}},"subject":{"type":"string","default":""},"htmlBody":{"description":"The HTML body of this message. This can just be a regular text as well.","type":"string","default":""},"references":{"description":"Use this if you want to reply to a thread as to make sure the application does not create a new ticket.","type":"array","default":[],"items":{"type":"string"}},"attachmentsBase64":{"type":"array","default":[]}}}}}},"responses":{"200":{"description":""}}}}}}
```

## address

> \*\*Returns all email addresses with optional filters such as search queries, grouping and result limits.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}},"parameters":{"query":{"name":"query","in":"query","schema":{"type":"string","pattern":"^[0-9a-zA-Z ]+$","minLength":1,"default":""}},"itemStart":{"name":"itemStart","in":"query","schema":{"type":"number","default":0}},"itemLimit":{"name":"itemLimit","in":"query","schema":{"type":"number","maximum":99,"default":15}}}},"paths":{"/api/v2/email/address":{"get":{"tags":["Email"],"summary":"address","description":"**Returns all email addresses with optional filters such as search queries, grouping and result limits.**","operationId":"addressGET","parameters":[{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/itemStart"},{"$ref":"#/components/parameters/itemLimit"},{"name":"groupByTime","in":"query","schema":{"type":"number","maximum":99,"default":1}},{"name":"groupByTimeAmount","in":"query","schema":{"type":"number","minimum":1,"maximum":999999,"default":604800}}],"responses":{"200":{"description":""}}}}}}
```

## address

> \*\*Creates a new email address.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}}},"paths":{"/api/v2/email/address":{"post":{"tags":["Email"],"summary":"address","description":"**Creates a new email address.**","operationId":"addressPOST","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","required":["brand_id","email","reply_email","is_primary"],"properties":{"brand_id":{"type":"number"},"email":{"type":"string","format":"email","minLength":1},"reply_email":{"type":"string","format":"email","minLength":1},"reply_email_title":{"type":"string","format":"^[a-zA-ZÀ-ÖØ-Þß-öø-ÿŠš\\.\\-\\'', ]+$","minLength":1},"is_primary":{"type":"number","maximum":1},"signature":{"type":"string","maxLength":65535,"default":""},"group_id":{"type":"number","default":0}}}}}},"responses":{"200":{"description":""}}}}}}
```

## itemAddress

> \*\*Returns this specific email address.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}}},"paths":{"/api/v2/email/address/{id}":{"get":{"tags":["Email"],"summary":"itemAddress","description":"**Returns this specific email address.**","operationId":"emailItemAddressGET","responses":{"200":{"description":""}}}}}}
```

## itemAddress

> \*\*Updates this specific email address.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}}},"paths":{"/api/v2/email/address/{id}":{"put":{"tags":["Email"],"summary":"itemAddress","description":"**Updates this specific email address.**","operationId":"emailItemAddressPUT","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["brand_id","email","reply_email","is_primary"],"properties":{"group_id":{"type":"number","default":0},"brand_id":{"type":"number"},"email":{"type":"string","format":"email","minLength":1},"reply_email":{"type":"string","format":"email","minLength":1},"reply_email_title":{"type":"string","pattern":"^[a-zA-ZÀ-ÖØ-Þß-öø-ÿŠš\\.\\-\\', ]+$","minLength":1},"is_primary":{"type":"number","maximum":1},"group_by_time":{"type":"number","maximum":99,"default":0},"group_by_time_amount":{"type":"number","maximum":999999,"default":0},"signature":{"type":"string","maxLength":65535,"default":""}}}}}},"responses":{"200":{"description":""}}}}}}
```

## itemAddress

> \*\*Permanently deletes this specific email address.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}}},"paths":{"/api/v2/email/address/{id}":{"delete":{"tags":["Email"],"summary":"itemAddress","description":"**Permanently deletes this specific email address.**","operationId":"emailItemAddressDELETE","responses":{"200":{"description":""}}}}}}
```

## itemDownloadMail

> \*\*Downloads a specific email based on its message ID.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Omnidesk API documentation","version":"2.0.0"},"tags":[{"name":"Email","description":"**All the endpoints that can be called on the Email controller.**\n\nAll these endpoints require the `SETTINGS_CRUD` permission, except for `GET` itemDownloadMail, which requires `TICKET_READ`"}],"servers":[{"url":"{{base_url}}"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","name":"apiKey","in":"header"}}},"paths":{"/api/v2/email/downloadMail/{id}":{"get":{"tags":["Email"],"summary":"itemDownloadMail","description":"**Downloads a specific email based on its message ID.**","operationId":"emailItemDownloadMailGET","responses":{"200":{"description":""}}}}}}
```
