Create an account by custom mail servers

POST /api/2.0/mail/accounts

Request

Creates an account using full information about mail servers 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

namestring

Account name

emailstring

Account email address in the name@domain format

accountstring

IMAP or POP server login

passwordstring

IMAP or POP server password

portinteger

IMAP or POP server port

serverstring

IMAP or POP server address or IP

smtp_accountstring

SMTP server login

smtp_passwordstring

SMTP server password

smtp_portinteger

SMTP server port

smtp_serverstring

SMTP server address or IP

smtp_authboolean

Specifies if the authentication is needed for the SMTP server or not

imapboolean

Specifies if the IMAP server is used for incoming mails or not

restrictboolean

Specifies if all the mails should be downloaded from the account (false) or not (true). If true, then messages for the last 30 days only will be imported

incoming_encryption_typeinteger

Encryption type for the IMAP or POP server: 0 - None, 1 - SSL, 2 - StartTLS

outcoming_encryption_typeinteger

Encryption type for the SMTP server: 0 - None, 1 - SSL, 2 - StartTLS

auth_type_ininteger

Authentication type for the IMAP or POP server: 0 - None, 1 - Login, 4 - CramMd5, 5 - OAuth2

auth_type_smtpinteger

Authentication type for the SMTP server: 0 - None, 1 - Login, 4 - CramMd5, 5 - OAuth2

Examples

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

Responses

200

Created account

MailboxIdintegerformat: int32
Emailstring
Enabledboolean
Namestring
OAuthConnectionboolean
Signatureobject
MailboxIdintegerformat: int32
Htmlstring
IsActiveboolean
Autoreplyobject
MailboxIdintegerformat: int32
TurnOnboolean
OnlyContactsboolean
TurnOnToDateboolean
FromDatestringformat: date-time
ToDatestringformat: date-time
Subjectstring
Htmlstring
EMailInFolderstring
QuotaErrorboolean
AuthErrorboolean
IsGroupboolean
IsAliasboolean
IsTeamlabMailboxboolean
IsDefaultboolean
IsSharedDomainMailboxboolean
DateCreatedarray of string

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).