Retrieve a verification code from an email inbox or generate a TOTP 2FA token. If a 2fa header is provided, returns a 6-digit TOTP token. Otherwise, connects via IMAP and searches recent messages for a numeric code. Supports IMAP mailboxes of the popular services, Outlook over OAuth2, and mail.tm — it has no IMAP, so the code is fetched through their HTTP API with the same email and password. The current list of services and their availability is at GET /code/providers.
| Name | Type | Description | |
|---|---|---|---|
| string | optional | Email address to connect to | |
| password | string | optional | Email password or app-password |
| 2fa | string | optional | TOTP secret key — if set, email/password are ignored |
| code_length | integer | optional | Number of digits to look for (default 6) |
| search_in | string | optional | subject, body or both (default) |
| sender_filter | string | optional | Only match emails whose sender contains this value |
| refresh-token | string | optional | OAuth2 refresh token (Outlook) |
| client-id | string | optional | OAuth2 client ID (Outlook) |
"success": true,
"code": "482916",
"sender": "Example Service",
"sender_mail": "[email protected]",
"mail_date": "2025-01-01T12:00:00+00:00",
"type": "email"
}
"success": true,
"code": "739201",
"remaining_seconds": 18,
"type": "2fa"
}
"success": false,
"message": "Код не найден."
}