Get filtered messages

GET /api/2.0/mail/messages

Request

Returns the messages with the parameters specified in the request.

Authorization

An API key is a token that you provide when making API calls. Include the token in a header parameter called Authorization.

Example: Authorization: 864FE52C-1C1C-469F-9308-51DAFEFE7436.

Headers

Acceptenum of string

Can be one of: application/json.

Content-Typeenum of string

Can be one of: application/json.

Body

folderarray of integer

Folder ID

unreadarray of boolean

Message status: unread (true), read (false), or all (null) messages

attachmentsarray of boolean

Defines if a message has attachments or not: with attachments (true), without attachments (false), or all (null) messages

period_fromarray of integer

Start search period date

period_toarray of integer

End search period date

importantarray of boolean

Specifies if only important messages will be displayed or not

from_addressstring

Mail address from which a letter was received

to_addressstring

Mail address to which a letter was sent

mailbox_idarray of integer

Recipient mailbox ID

tagsarray of integer

IDs of tags linked to the target messages

searchstring

Text to search in the message bodies and subjects

pagearray of integer

Page number

with_calendararray of boolean

Specifies if the messages have a calendar or not

page_sizearray of integer

Number of messages on the page

user_folder_idarray of integer

User folder ID

sortorderstring

Sort order by date: "ascending" or "descending"

Examples

GET /api/2.0/mail/messages HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: example.com
curl --request GET \
  --url https://example.com/api/2.0/mail/messages \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json'

Responses

200

List of filtered messages

Attachmentsarray of object
fileIdintegerformat: int32
fileNamestring
sizeintegerformat: int64
contentTypestring
needSaveToTempboolean
contentIdstring
fileNumberintegerformat: int32
storedNamestring
streamIdstring
attachedAsLinkboolean
tempStoredUrlstring
Introductionstring
HtmlBodystring
ContentIsBlockedboolean
Importantboolean
Subjectstring
HasAttachmentsboolean
Bccstring
Ccstring
Tostring
Addressstring
Fromstring
ReplyTostring
Idintegerformat: int32
ChainIdstring
ChainDateStringstring
DateStringstring
DateDisplaystring
TagIdsarray of integer
LabelsInStringstring
IsNewboolean
IsAnsweredboolean
IsForwardedboolean
TextBodyOnlyboolean
Sizeintegerformat: int64
EMLLinkstring
StreamIdstring
RestoreFolderIdenum of integerformat: int32

[0 - Sending, 1 - Inbox, 2 - Sent, 3 - Draft, 4 - Trash, 5 - Spam, 6 - UserFolder, 7 - Templates]

Can be one of: Sending, Inbox, Sent, Draft, Trash, Spam, UserFolder, Templates.

Folderenum of integerformat: int32

[0 - Sending, 1 - Inbox, 2 - Sent, 3 - Draft, 4 - Trash, 5 - Spam, 6 - UserFolder, 7 - Templates]

Can be one of: Sending, Inbox, Sent, Draft, Trash, Spam, UserFolder, Templates.

UserFolderIdarray of integer
ChainLengthintegerformat: int32
WasNewboolean
IsTodayboolean
IsYesterdayboolean
ReceivedDatestring
IsBodyCorruptedboolean
HasParseErrorboolean
MimeMessageIdstring
MimeReplyToIdstring
CalendarUidstring
ReadRequestStatusboolean

401

Unauthorized

Get Help

  • If you have any questions about ONLYOFFICE Workspace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).