Skip to content
Skip to main content

Quickstart: Email API

The Nylas Email API lets you send, read, and search email across Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP — all through a single API. Instead of building separate integrations for each provider, you write your code once and Nylas handles the differences.

This quickstart walks you through sending and reading email on behalf of a connected user using the Nylas SDKs and API.

You need two things from Nylas to make API calls:

  1. An API key — authenticates your application. You’ll pass it as a Bearer token.
  2. A grant ID — identifies which user’s email account to act on. You get one when you connect an email account to Nylas.

If you don’t have these yet, follow one of the setup guides first:

Then install the Nylas SDK for your language:

For Java and Kotlin, see the Kotlin/Java SDK setup guide.

Replace <NYLAS_GRANT_ID> and <NYLAS_API_KEY> with the values from setup. Change the to address to your own email so you can see it arrive.

Check the recipient’s inbox — the message should arrive within a few seconds. That same code works whether the grant is a Gmail account, Outlook, or any other supported provider.

List the five most recent messages from a connected user’s account.

The search_query_native parameter uses each provider’s native search syntax (Gmail search operators, Microsoft KQL, etc.), so it works the way your users expect regardless of their email provider.

You can also filter by standard fields like from, to, subject, and received_after without relying on provider-specific syntax. See the Messages API reference for all available filters.