Read Email Verification Code

TypeScriptUtility
POST api.upapi.io/email-read-verification-code.post

Connect to an IMAP mailbox and extract a verification code from the SUBJECT of a recent email. Polls with retries. Supports Gmail (with App Password), Outlook, and any IMAP server. Generic — works for any platform that puts its code in the subject line; for a token that only appears in the body, use email-read-verification-link.

emailverificationimaputility
AuthAPI key
Cost1 unit
Timeout120s
CacheNone

Request schema

FieldTypeDescription
imapHost
stringIMAP server hostname· default: "imap.gmail.com"
imapPassreq
stringIMAP password or app password
imapPort
integerIMAP server port· default: 993
imapUserreq
stringIMAP username (email address)
maxRetries
integerNumber of polling attempts· default: 5
codePattern
stringRegex to extract a verification code from the email SUBJECT (the body is not fetched — use email-read-verification-link for body tokens)· default: "\\b(\\d{6})\\b"
retryDelayMs
integerMilliseconds between retry attempts· default: 10000
senderFilterreq
stringFilter emails by sender (e.g. noreply@redditmail.com)
maxAgeMinutes
integerOnly look at emails received within this many minutes· default: 15
subjectPattern
stringRegex pattern to match subject line
recipientFilter
stringFilter by recipient address (useful with catch-all domains)

Response schema

FieldTypeDescription
toreq
stringRecipient address
codereq
stringExtracted verification code
fromreq
stringSender address
subjectreq
stringEmail subject line
elapsedMsreq
integer
fetchedAtreq
string
receivedAtreq
stringWhen the email was received

Try it

Try it

IMAP password or app password

IMAP username (email address)

Filter emails by sender (e.g. noreply@redditmail.com)

IMAP server hostname

IMAP server port

Number of polling attempts

Regex to extract a verification code from the email SUBJECT (the body is not fetched — use email-read-verification-link for body tokens)

Milliseconds between retry attempts

Only look at emails received within this many minutes

Regex pattern to match subject line

Filter by recipient address (useful with catch-all domains)

Run this endpoint live

Jump in as a guest — no signup — and run email-read-verification-code.post with your own inputs. Create a free account anytime to get your own API key.

Sign in

Code examples

curl -X POST https://api.upapi.io/email-read-verification-code.post \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{ "imapHost": "imap.gmail.com", "imapPass": "example", "imapPort": 993, "imapUser": "example", "maxRetries": 5, "codePattern": "\\b(\\d{6})\\b", "retryDelayMs": 10000, "senderFilter": "noreply@redditmail.com", "maxAgeMinutes": 15 }'

Developer tools

OpenAPI specImport the spec or collection into Postman, Insomnia, or any codegen tool.