The Nylas Dashboard is a web UI for managing your applications, API keys, and connected accounts. This guide walks you through creating your first application and making an API call.
Before you begin
Section titled “Before you begin”Before you start, you need to have a Nylas account. If you don’t have one already, you can create one here.
Create a Nylas application
Section titled “Create a Nylas application”- Log in to the Nylas Dashboard.
- On the All apps page, click Create new app.
- Select the Data residency.
- Select the Environment.
- Click Create application.
Generate an API key
Section titled “Generate an API key”You’ll need an API key for the last step.
- On your application’s page, click API Keys in the left navigation.
- Click Generate new key.
- Enter an API key name and select the Expiration time.
- Click Generate key.
Create a grant
Section titled “Create a grant”- On your application’s page, click Grants in the left navigation.
- Click Add Account.
You’ll be prompted to enter your email address. If the authentication is successful you’ll see your email address and grant ID with a valid status on the Grants page.
Make your first API call
Section titled “Make your first API call”Now that you have an API key and a connected account, you can call the Nylas API. This example uses the List messages endpoint to return the five most recent messages. Replace <NYLAS_GRANT_ID> and <NYLAS_API_KEY> with your values from the previous steps.
curl --request GET \ --url "https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/messages?limit=5" \ --header 'Accept: application/json, application/gzip' \ --header 'Authorization: Bearer <NYLAS_API_KEY>' \ --header 'Content-Type: application/json'{ "request_id": "d0c951b9-61db-4daa-ab19-cd44afeeabac", "data": [ { "starred": false, "unread": true, "folders": ["UNREAD", "CATEGORY_PERSONAL", "INBOX"], "grant_id": "1", "date": 1706811644, "attachments": [ { "id": "1", "grant_id": "1", "filename": "invite.ics", "size": 2504, "content_type": "text/calendar; charset=\"UTF-8\"; method=REQUEST" }, { "id": "2", "grant_id": "1", "filename": "invite.ics", "size": 2504, "content_type": "application/ics; name=\"invite.ics\"", "is_inline": false, "content_disposition": "attachment; filename=\"invite.ics\"" } ], "from": [ { "name": "Nylas DevRel", } ], "id": "1", "object": "message", "snippet": "Send Email with Nylas APIs", "subject": "Learn how to Send Email with Nylas APIs", "thread_id": "1", "to": [ { "name": "Nyla", } ], "created_at": 1706811644, "body": "Learn how to send emails using the Nylas APIs!" } ], "next_cursor": "123"}import Nylas from "nylas";
const nylas = new Nylas({ apiKey: "<NYLAS_API_KEY>", apiUri: "<NYLAS_API_URI>",});
async function fetchRecentEmails() { try { const messages = await nylas.messages.list({ identifier: "<NYLAS_GRANT_ID>", queryParams: { limit: 5, }, });
console.log("Messages:", messages); } catch (error) { console.error("Error fetching emails:", error); }}
fetchRecentEmails();from nylas import Client
nylas = Client( "<NYLAS_API_KEY>", "<NYLAS_API_URI>")
grant_id = "<NYLAS_GRANT_ID>"
messages = nylas.messages.list( grant_id, query_params={ "limit": 5 })
print(messages)require 'nylas'
nylas = Nylas::Client.new(api_key: '<NYLAS_API_KEY>')query_params = { limit: 5 }messages, _ = nylas.messages.list(identifier: '<NYLAS_GRANT_ID>', query_params: query_params)
messages.each {|message| puts "[#{Time.at(message[:date]).strftime("%d/%m/%Y at %H:%M:%S")}] \ #{message[:subject]}"}import com.nylas.NylasClient;import com.nylas.models.*;import java.text.SimpleDateFormat;
public class ReadInbox { public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError { NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build(); ListMessagesQueryParams queryParams = new ListMessagesQueryParams.Builder().limit(5).build(); ListResponse<Message> message = nylas.messages().list("<NYLAS_GRANT_ID>", queryParams);
for(Message email : message.getData()) { String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"). format(new java.util.Date((email.getDate() * 1000L)));
System.out.println("[" + date + "] | " + email.getSubject()); } }}import com.nylas.NylasClientimport com.nylas.models.*import java.text.SimpleDateFormatimport java.util.*
fun dateFormatter(milliseconds: String): String { return SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Date(milliseconds.toLong() * 1000)).toString()}
fun main(args: Array<String>) { val nylas: NylasClient = NylasClient(apiKey = "<NYLAS_API_KEY>") val queryParams = ListMessagesQueryParams(limit = 5, inFolder = listOf("Inbox")) val messages : List<Message> = nylas.messages().list("<NYLAS_GRANT_ID>", queryParams).data
for(message in messages) { println("[" + dateFormatter(message.date.toString()) + "] |" + message.subject + " | " + message.folders) }}What’s next
Section titled “What’s next”- Email quickstart — send your first email
- Calendar quickstart — create your first event
- Authentication — set up OAuth for your users
- API reference — full endpoint documentation