# Read Email Verification Code API

> 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.

Category: [Utility APIs](https://upapi.io/apis/utility) · Last updated 2026-11-02

## How to call it

- Endpoint: `POST https://api.upapi.io/email-read-verification-code.post`, key in the `X-Api-Key` header, JSON body.
- Cost: 1 weighted unit per call.
- Timeout: 120 seconds.
- Cache: none; every call runs the operation.
- Try it without writing code: https://app.upapi.io/try/email-read-verification-code.post

```bash
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 }'
```

## Request parameters

- `imapHost` (string) — IMAP server hostname
- `imapPass` (string, required) — IMAP password or app password
- `imapPort` (integer) — IMAP server port
- `imapUser` (string, required) — IMAP username (email address)
- `maxRetries` (integer) — Number of polling attempts
- `codePattern` (string) — Regex to extract a verification code from the email SUBJECT (the body is not fetched — use email-read-verification-link for body tokens)
- `retryDelayMs` (integer) — Milliseconds between retry attempts
- `senderFilter` (string, required) — Filter emails by sender (e.g. noreply@redditmail.com)
- `maxAgeMinutes` (integer) — Only look at emails received within this many minutes
- `subjectPattern` (string) — Regex pattern to match subject line
- `recipientFilter` (string) — Filter by recipient address (useful with catch-all domains)

## Response fields

- `to` (string, required) — Recipient address
- `code` (string, required) — Extracted verification code
- `from` (string, required) — Sender address
- `subject` (string, required) — Email subject line
- `elapsedMs` (integer, required)
- `fetchedAt` (string, required)
- `receivedAt` (string, required) — When the email was received

## Example request and response

The example response is generated from the published output schema: it shows the shape and field names, not values from a recorded call.

```json
{
  "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
}
```

```json
{
  "to": "example",
  "code": "US",
  "from": "example",
  "subject": "example",
  "elapsedMs": 1,
  "fetchedAt": "example",
  "receivedAt": "example"
}
```

## Frequently asked questions

### How much does the Read Email Verification Code API cost per call?

Each call spends 1 weighted unit of your plan's monthly quota. Full pricing is at https://upapi.io/pricing.

### How do I authenticate to the Read Email Verification Code API?

Send your key in the X-Api-Key header. A free guest key is available without creating an account.

### Are Read Email Verification Code API responses cached?

No — every call runs the operation live; responses are not cached.

## More Utility APIs

- [Read Email Verification Link](https://upapi.io/apis/utility/email-read-verification-link)
- [Email Read Verification Code (Microsoft Graph)](https://upapi.io/apis/utility/email-read-verification-code-graph)
- [Email Read Verification Link (Microsoft Graph)](https://upapi.io/apis/utility/email-read-verification-link-graph)
- [Email Generate Address](https://upapi.io/apis/utility/email-generate-address)
