POST api/2.0/mail/accounts/oauth This function requires authentication

Description

Creates a mail account with OAuth (only Google OAuth is supported).

Parameters
Name Description Type Example
code
sent in body
OAuth code string some text
type
sent in body
OAuth service type: 0 - Unknown, 1 - Google byte 0
Example
POST api/2.0/mail/accounts/oauth
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json

{
  "code": "some text",
  "type": 0
}
Returns

Created account

Example Response

application/json

{
  "status": 0,
  "response": {
    "mailboxId": 12,
    "email": "email@only.com",
    "enabled": true,
    "name": "name",
    "oAuthConnection": true,
    "signature": {
      "mailboxId": "132",
      "html": "html",
      "isActive": true
    },
    "autoreply": {
      "mailboxId": 33,
      "turnOn": true,
      "onlyContacts": false,
      "turnOnToDate": true,
      "fromDate": "2020-10-01T17:04:32.0000000",
      "toDate": "2020-10-01T17:04:32.0000000",
      "subject": "subject",
      "html": "html"
    },
    "eMailInFolder": "eMailInFolder",
    "quotaError": false,
    "authError": false,
    "isGroup": true,
    "isAlias": true,
    "isTeamlabMailbox": true,
    "isDefault": true,
    "isSharedDomainMailbox": true
  }
}

text/xml

<result>
  <status>0</status>
  <response>
    <mailboxId>12</mailboxId>
    <email>email@only.com</email>
    <enabled>True</enabled>
    <name>name</name>
    <oAuthConnection>True</oAuthConnection>
    <signature>
      <mailboxId>132</mailboxId>
      <html>html</html>
      <isActive>True</isActive>
    </signature>
    <autoreply>
      <mailboxId>33</mailboxId>
      <turnOn>True</turnOn>
      <onlyContacts>False</onlyContacts>
      <turnOnToDate>True</turnOnToDate>
      <fromDate>2020-10-01T17:04:32.0000000</fromDate>
      <toDate>2020-10-01T17:04:32.0000000</toDate>
      <subject>subject</subject>
      <html>html</html>
    </autoreply>
    <eMailInFolder>eMailInFolder</eMailInFolder>
    <quotaError>False</quotaError>
    <authError>False</authError>
    <isGroup>True</isGroup>
    <isAlias>True</isAlias>
    <isTeamlabMailbox>True</isTeamlabMailbox>
    <isDefault>True</isDefault>
    <isSharedDomainMailbox>True</isSharedDomainMailbox>
  </response>
</result>