Account

Get account info

Returns stored information about the account. Credentials are masked: stored passwords, the credentials in any proxy or webhook URL, and the values of custom webhook headers all read back as "******". A masked value is not the stored one - leave the field out of an update rather than writing it back, otherwise the mask replaces the credential.<br/><br/>Quota reporting is not available for Gmail API or MS Graph accounts; the quota field is returned as false for those, the same value an IMAP server without QUOTA support produces.

get/v1/account/{account}

Request

  • Base URL: https://your-emailengine-host
  • URL: https://your-emailengine-host/v1/account/{account}
  • Auth: HTTP bearer

Path parameters

accountstring required

Unique identifier for the email account

Example:user123

Query parameters

quotaboolean

If true, then include quota information in the response

Headers

x-ee-timeoutinteger

Request timeout in milliseconds. Raises the command timeout above the EENGINE_TIMEOUT default for a long-running request; a value below the default has no effect

Example:30000

Response

Returns the account configuration, connection state and sync status.

accountstring required

Unique identifier for the email account

namestring

Display name for the account

emailstring

Default email address of the account

expectedEmailstring

Pins the account to an email address

copyboolean

Copy submitted messages to Sent folder

logsboolean

Store recent logs

notifyFromstring date-time nullable

Only send webhooks for messages received after this date. Defaults to account creation time. IMAP only.

pathstring[] nullable

Mailbox folders to monitor for changes (IMAP only). Use "*" to monitor all folders (default)

imapIndexer'full' | 'fast' nullable

Override the global IMAP indexing strategy for this account

authFailureDisabledAtstring date-time nullable

When EmailEngine switched syncing off for this account after repeated authentication failures, or null. Read-only. Supply working credentials - re-authorize an OAuth2 account, or save new IMAP settings - and syncing resumes. imap.disabled is also the operator's own send-only switch, so this is what tells an automatic disable from a deliberate one.

subconnectionsstring[]

Additional mailbox paths to monitor with dedicated IMAP connections for faster change detection. Use sparingly as connection limits are strict.

webhooksstring

Account-specific webhook URL

proxystring

Proxy for this account, used instead of the instance-wide proxy: its IMAP and SMTP connections and, for an OAuth2 account, its token requests and Gmail API or MS Graph API calls

smtpEhloNamestring nullable

Hostname to use in SMTP EHLO/HELO commands (defaults to system hostname)

state'init' | 'unset' | 'connected' | 'connecting' | 'syncing' | 'authenticationError' | 'connectError' | 'disconnected' | 'paused'

Informational account state

connectionsinteger

Number of open IMAP connections for this account (IMAP accounts only)

sendOnlyboolean

Whether this is a send-only account that does not sync messages

localestring

Optional locale

tzstring

Optional timezone

type'imap' | 'gmail' | 'gmailService' | 'outlook' | 'outlookService' | 'mailRu' | 'oauth2' | 'delegated' | 'sending' | 'invalid' required

How the account connects to its mailbox

appstring

OAuth2 application ID

baseScopes'imap' | 'api' | 'pubsub'

OAuth2 Base Scopes

syncTimestring date-time

Last sync time (IMAP accounts only)

Example response

{
  "account": "user123",
  "name": "My Email Account",
  "email": "user@example.com",
  "expectedEmail": "user@example.com",
  "copy": true,
  "notifyFrom": "2021-07-08T07:06:34.336Z",
  "path": [
    "*"
  ],
  "imapIndexer": "full",
  "authFailureDisabledAt": "2021-03-22T13:13:31.000Z",
  "subconnections": [
    "[Gmail]/Spam",
    "\\Sent"
  ],
  "webhooks": "https://myservice.com/imap/webhooks",
  "proxy": "socks5://proxy.example.com:1080",
  "smtpEhloName": "relay.example.com",
  "imap": {
    "auth": {
      "user": "myuser@gmail.com",
      "pass": "verysecret"
    },
    "secure": true,
    "tls": {
      "rejectUnauthorized": true,
      "minVersion": "TLSv1.2"
    },
    "resyncDelay": 900,
    "host": "imap.gmail.com",
    "port": 993,
    "sentMailPath": "Sent Mail",
    "draftsMailPath": "Drafts",
    "junkMailPath": "Junk",
    "trashMailPath": "Trash",
    "archiveMailPath": "Archive"
  },
  "smtp": {
    "auth": {
      "user": "myuser@gmail.com",
      "pass": "verysecret"
    },
    "host": "smtp.gmail.com",
    "port": 587,
    "tls": {
      "rejectUnauthorized": true,
      "minVersion": "TLSv1.2"
    }
  },
  "oauth2": {
    "redirectUrl": "https://myapp/account/settings.php",
    "provider": "AAABhaBPHscAAAAH",
    "auth": {
      "user": "user@outlook.com",
      "delegatedUser": "shared.mailbox@outlook.com",
      "delegatedAccount": "user123"
    },
    "accessToken": "ya29.a0ARrdaM8a...",
    "refreshToken": "1//09Ie3CtORQYm...",
    "expires": "2021-03-22T13:13:31.000Z",
    "scope": [
      "https://mail.google.com/"
    ],
    "tokenType": "Bearer",
    "generated": "2021-03-22T13:13:31.000Z",
    "refreshTokenGenerated": "2021-03-22T13:13:31.000Z"
  },
  "state": "connected",
  "smtpStatus": {
    "created": "2021-07-08T07:06:34.336Z",
    "response": "250 OK",
    "description": "Authentication failed",
    "responseCode": 500,
    "code": "EAUTH",
    "command": "AUTH PLAIN",
    "networkRouting": {
      "localAddress": "198.51.100.24",
      "name": "relay.example.com"
    }
  },
  "gmailWatch": {
    "state": "active",
    "lastCheck": "2021-07-08T07:06:34.336Z",
    "expires": "2021-07-15T07:06:34.336Z"
  },
  "syncError": {
    "path": "INBOX",
    "time": "2021-07-08T07:06:34.336Z",
    "error": "Failed to open mailbox"
  },
  "connections": 2,
  "webhooksCustomHeaders": [
    {
      "key": "Authorization",
      "value": "Bearer <token>"
    }
  ],
  "locale": "fr",
  "tz": "Europe/Tallinn",
  "type": "outlook",
  "app": "AAABhaBPHscAAAAH",
  "baseScopes": "imap",
  "counters": {
    "events": {
      "messageNew": 30,
      "messageDeleted": 5
    }
  },
  "quota": {
    "usage": 8547884032,
    "limit": 16106127360,
    "status": "53%"
  },
  "syncTime": "2021-02-17T13:43:18.860Z",
  "outlookSubscription": {
    "id": "0fc0f6bb-a3e1-4f7a-9d3a-8e2f1f8b9c11",
    "expirationDateTime": "2021-07-11T07:06:34.336Z",
    "state": {
      "time": 1625727994336,
      "error": "Subscription renewal was rejected"
    }
  },
  "lastError": {
    "response": "Token request failed for gmail (refresh_token, HTTP 400): invalid_grant - Token has been expired or revoked.",
    "description": "Authentication failed",
    "serverResponseCode": "OauthRenewError",
    "tokenRequest": {
      "url": "https://oauth2.googleapis.com/token",
      "method": "post",
      "grant": "refresh_token",
      "provider": "gmail",
      "status": 400,
      "clientId": "1023289917884-h3nu00e9cb7h252e24c23sv19l8k57ah.apps.googleusercontent.com",
      "clientSecret": "GOCSPX...V-Da",
      "authority": "common",
      "serviceClient": "113328088575113530522",
      "signer": "serviceKey",
      "googleProjectId": "project-name-425411",
      "serviceClientEmail": "service-account@project-name-425411.iam.gserviceaccount.com",
      "code": "AAABhaBPHscAAAAH",
      "error": "fetch failed",
      "errorCode": "ECONNREFUSED",
      "flag": {
        "message": "Please verify the OAuth2 application credentials",
        "code": "INVALID_CLIENT_SECRET",
        "url": "https://console.developers.google.com/"
      },
      "userFlag": {
        "message": "The grant for this account has been revoked"
      },
      "scopes": [
        "https://mail.google.com/"
      ],
      "response": {
        "error": "invalid_grant",
        "error_description": "Bad Request"
      }
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.