Get the number of new messages

This request is used for getting:
  • the total number of unread messages in a mailbox.
  • the number of messages the mailbox owner has received since last checking email.

The mailbox can be specified using the email address or the mailbox ID. You can get the ID in the response to the Get the list of mailboxes request.

  1. Request syntax
  2. Request example
  3. Response structure

Request syntax

The request should be sent over the HTTPS protocol using the GET method.

GET /api2/admin/email/counters?
domain=<domain name>
&(login=<email address or username for mailbox>|uid=<mailbox ID>)

Host: pddimp.yandex.ru
PddToken: <PDD token>

Headers:

Name Description
PddToken

PDD token.

Name Description
PddToken

PDD token.

Parameters:

Parameter Type Value
Mandatory
domain String

Name of the domain.

login String

The email address of the mailbox, in the format “username@domain.ru” or “username”.

The request should only pass one of the parameters: login or uid.

uid Integer

Mailbox ID.

You can get the ID value in the response to the Get the list of mailboxes request.

The request should only pass one of the parameters: login or uid.

Parameter Type Value
Mandatory
domain String

Name of the domain.

login String

The email address of the mailbox, in the format “username@domain.ru” or “username”.

The request should only pass one of the parameters: login or uid.

uid Integer

Mailbox ID.

You can get the ID value in the response to the Get the list of mailboxes request.

The request should only pass one of the parameters: login or uid.

Request example

GET /api2/admin/email/counters?domain=domain.com&uid=12345678901 HTTP/1.1
Host: pddimp.yandex.ru
PddToken: 123456789ABCDEF0000000000000000000000000000000000000
cURL
curl -H 'PddToken: 123456789ABCDEF0000000000000000000000000000000000000' 'https://pddimp.yandex.ru/api2/admin/email/counters?domain=domain.com&uid=12345678901'

Response structure

{
  "domain": "{domain name}",
  "login": {email address of the mailbox},
  "uid": {mailbox ID},
  "counters":
    {
      "unread": "{number of unread messages}",
      "new": "{number of messages received since last checking email}"
    },
  "success": "{status of request execution}"
}
Name Type of value Description
domain String

Name of the domain.

login String

Email address of the mailbox.

uid Integer

Mailbox ID.

counters Object

The number of unread messages and messages received since last checking email.

success String

Status of request execution.

Possible values:
  • ok — Request executed successfully.
  • error — Request executed with error.
error String

Error code.

Included in the response if the request resulted in an error.

Possible values:
  • unknown — A temporary failure or API error occurred (repeat the request again later).
  • no_token (no_domain, no_ip ) — A mandatory parameter was omitted.
  • bad_domain — The domain name was not specified or does not conform to the RFC.
  • prohibited — A forbidden domain name.
  • bad_token (bad_login, bad_passwd) — An invalid PDD token (or username/password) was passed.
  • no_auth — The PddToken header was omitted.
  • not_allowed — This operation is not allowed for this user (the user is not the domain administrator).
  • blocked — Blocked domain (for example, due to spam and so on).
  • occupied — The domain name is in use by another user.
  • domain_limit_reached — Exceeded the acceptable number of connected domains (50).
  • no_reply — Yandex.Mail for Domain cannot connect to the server source for the import.
Keys for the counters object
unread Integer

Total number of unread messages.

new Integer

The number of messages the mailbox owner has received since last checking email.

Name Type of value Description
domain String

Name of the domain.

login String

Email address of the mailbox.

uid Integer

Mailbox ID.

counters Object

The number of unread messages and messages received since last checking email.

success String

Status of request execution.

Possible values:
  • ok — Request executed successfully.
  • error — Request executed with error.
error String

Error code.

Included in the response if the request resulted in an error.

Possible values:
  • unknown — A temporary failure or API error occurred (repeat the request again later).
  • no_token (no_domain, no_ip ) — A mandatory parameter was omitted.
  • bad_domain — The domain name was not specified or does not conform to the RFC.
  • prohibited — A forbidden domain name.
  • bad_token (bad_login, bad_passwd) — An invalid PDD token (or username/password) was passed.
  • no_auth — The PddToken header was omitted.
  • not_allowed — This operation is not allowed for this user (the user is not the domain administrator).
  • blocked — Blocked domain (for example, due to spam and so on).
  • occupied — The domain name is in use by another user.
  • domain_limit_reached — Exceeded the acceptable number of connected domains (50).
  • no_reply — Yandex.Mail for Domain cannot connect to the server source for the import.
Keys for the counters object
unread Integer

Total number of unread messages.

new Integer

The number of messages the mailbox owner has received since last checking email.