Skip to content

How to list Yahoo email messages

Yahoo Mail doesn’t have a public REST API. There’s no equivalent to Gmail’s API or Microsoft Graph. Under the hood, Nylas connects to Yahoo accounts over IMAP, but you don’t need to deal with IMAP protocols, socket connections, or MIME parsing yourself. The same Messages API you use for Gmail and Outlook works for Yahoo.

This guide covers listing messages from Yahoo accounts, including the OAuth setup process, the 90-day message cache, and how to reach older messages when you need them.

Yahoo’s only developer-facing email interface is raw IMAP. That means building your own connection pooling, MIME parsing, and sync infrastructure from scratch. On top of the protocol complexity, Yahoo OAuth requires signing a Commercial Access Agreement before you can even get API credentials, and the IMAP search implementation has known gaps (no NOT operator support, for example).

Nylas wraps all of that in a REST API with JSON responses. You don’t need to sign Yahoo’s agreement yourself, manage IMAP sockets, or work around IMAP search limitations. Your code works across Yahoo, Gmail, Outlook, and every other provider without modification.

If you’re only targeting Yahoo and are comfortable with IMAP, you can connect directly. For everything else, Nylas saves you significant development time.

You’ll need:

New to Nylas? Start with the quickstart guide to set up your app and connect a test account before continuing here.

Yahoo requires a few extra steps compared to Google or Microsoft. You’ll need to:

  1. Request API access by submitting the Yahoo Mail API Access form. Yahoo will send you a Commercial Access Agreement to sign.
  2. Create a Yahoo app by registering your application in the Yahoo Apps dashboard to get a client ID and secret.
  3. Create a Yahoo connector in Nylas and configure it with your Yahoo client ID and secret.

Yahoo OAuth scopes are simpler than Google’s tier system:

Access levelScopes required
Read-onlyemail, mail-r
Read-writeemail, mail-r, mail-w

You can only select one access level. Yahoo doesn’t let you request both mail-r and mail-w separately.

If you’d rather skip the OAuth setup for testing, you can also authenticate Yahoo accounts using IMAP with an app password. This uses the imap provider type instead of yahoo and requires each user to generate an app password in their Yahoo account settings. OAuth is the better choice for production apps.

The full setup walkthrough is in the Yahoo authentication guide.

Make a List Messages request with the grant ID. By default, Nylas returns the 50 most recent messages. These examples limit results to 5:

You can narrow results with query parameters. Here’s what works with Yahoo accounts:

ParameterWhat it doesExample
subjectMatch on subject line?subject=Weekly standup
fromFilter by sender[email protected]
toFilter by recipient[email protected]
unreadUnread messages only?unread=true
inFilter by folder or label ID?in=INBOX
received_afterAfter a Unix timestamp?received_after=1706000000
received_beforeBefore a Unix timestamp?received_before=1706100000
has_attachmentOnly messages with attachments?has_attachment=true

Here’s how to combine filters. This pulls unread messages from a specific sender:

Yahoo supports the search_query_native parameter for IMAP-style search. Unlike Google and Microsoft, Yahoo lets you combine search_query_native with any other query parameter, not just in, limit, and page_token.

Yahoo’s IMAP search doesn’t support NOT syntax. If you use a negation query, the results may still contain messages you intended to exclude. Filter those out in your application code instead.

See the search best practices guide for more on search_query_native across providers.

Yahoo is IMAP-based, which means it behaves differently from Google and Microsoft in a few important ways.

This is the most important Yahoo-specific detail. Nylas maintains a rolling cache of messages from the last 90 days. Anything received or created within that window is synced and available through the API. Messages older than 90 days are not in the cache, but you can still reach them by setting query_imap=true to query Yahoo’s IMAP server directly. This is slower due to provider latency, but it gives you access to the full mailbox.

When using query_imap, you must include the in parameter to specify which folder to search.

Nylas webhooks only fire for changes to messages within the 90-day cache window. If a user modifies or deletes a message older than 90 days, you won’t receive a notification. Plan your sync strategy accordingly if your app needs to track changes across the full mailbox.

Unlike Microsoft’s internal names (sentitems, deleteditems) or Google’s label system, Yahoo uses straightforward IMAP folder names:

Yahoo UI nameFolder ID
InboxInbox
SentSent
DraftDraft
TrashTrash
Bulk Mail (Spam)Bulk Mail
ArchiveArchive

Custom folders created by the user appear with their display names. Use the List Folders endpoint to get the complete list for a given account.

Yahoo doesn’t publish its API rate limits. If your app hits a rate limit, the response will include the duration you need to wait before retrying. Nylas handles retries automatically, but if you’re making a high volume of requests for many Yahoo users, you may see throttling.

As with other providers, webhooks are the best way to avoid hitting rate limits. Let Nylas notify you of changes instead of polling.

Yahoo accounts in Nylas use IMAP for reading and SMTP for sending. This is invisible to your code, but it explains a few behaviors:

  • Sync is slower than Google or Microsoft because those providers have native APIs with push notifications. Yahoo relies on periodic IMAP polling.
  • Message IDs are IMAP UIDs, which are numeric values like 12345 that are unique within a folder but may not be globally unique across the account.
  • Thread grouping relies on subject-line and header matching rather than a native threading system. This works well for most conversations but isn’t as precise as Gmail’s built-in thread_id.

Yahoo supports two authentication methods in Nylas:

MethodProvider typeBest for
Yahoo OAuthyahooProduction apps with a seamless user experience, no app passwords needed
IMAP with app passwordimapTesting or apps where users already manage app passwords

Yahoo OAuth is the recommended approach. It gives you a proper OAuth consent flow and doesn’t require users to create app passwords. See the Yahoo authentication guide for both methods.

The Messages API returns paginated responses. When there are more results, the response includes a next_cursor value. Pass it back as page_token to get the next page:

Keep paginating until the response comes back without a next_cursor.