Skip to content

nylas/nylas-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

695 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nylas

Nylas Node.js SDK

The official Node.js SDK for Nylas β€” the infrastructure that powers communications

npm version code coverage downloads license

πŸ“– SDK Guide Β· πŸ“š API Reference Β· πŸš€ Sign up Β· πŸ’‘ Samples Β· πŸ’¬ Forum


The official Node.js SDK for Nylas β€” the infrastructure that powers communications. Integrate with Gmail, Microsoft, IMAP, Zoom, and 250+ email, calendar, and meeting providers in 5 minutes. Covers Email, Calendar, Contacts, Scheduler, Notetaker, and Agent Accounts.

This repository is for contributors and anyone installing the SDK from source. If you just want to use the SDK in your app, head straight to the Node.js SDK guide on developer.nylas.com.

Get started

  1. Sign up for a free Nylas account and grab your API key from the Nylas Dashboard.
  2. Read the Getting started guide for the core concepts (applications, grants, API keys).
  3. Install the SDK and make your first request β€” see below.

You can also bootstrap from the terminal:

brew install nylas/nylas-cli/nylas
nylas init

More options in the CLI getting-started guide.

βš™οΈ Install

Requirements: Node.js v18 or later.

npm install nylas
# or
yarn add nylas

The package ships its own TypeScript types β€” no @types/nylas needed. It's a hybrid ESM + CommonJS package, so both import and require work.

To install from source:

git clone https://github.com/nylas/nylas-nodejs.git
cd nylas-nodejs
npm install

Runtime support

Tested on Node.js 18+. Also runs on AWS Lambda, Cloudflare Workers, and Vite/edge environments β€” see the examples/ directory for working setups.

⚑️ Usage

You access Nylas resources (messages, calendars, events, contacts, …) through an instance of Nylas. Initialize it with your API key β€” and optionally an apiUri matching your data residency.

import Nylas from "nylas";
// or: const Nylas = require("nylas").default;

const nylas = new Nylas({
  apiKey: process.env.NYLAS_API_KEY,
  apiUri: process.env.NYLAS_API_URI, // e.g. https://api.us.nylas.com
  timeout: 30, // optional, in seconds
});

Once initialized, use it to make requests against a grant (an authenticated end-user account):

const calendars = await nylas.calendars.list({
  identifier: process.env.NYLAS_GRANT_ID,
});
console.log(calendars);

Error handling

The SDK throws typed errors you can catch and inspect. Every API error carries a requestId and flowId β€” include both when filing a support ticket so we can trace the request end-to-end.

import { NylasApiError, NylasOAuthError, NylasSdkTimeoutError } from "nylas";

try {
  await nylas.calendars.list({ identifier: grantId });
} catch (err) {
  if (err instanceof NylasApiError) {
    console.error(err.statusCode, err.type, err.message, err.requestId, err.flowId);
  } else if (err instanceof NylasSdkTimeoutError) {
    console.error("Timed out:", err.url, err.timeout);
  } else {
    throw err;
  }
}

Step-by-step walkthroughs in the SDK guide:

πŸ’‘ Examples

Runnable examples live in examples/ β€” including agent accounts, attachments (incl. large attachments), calendars, folders, grants, messages, notetakers, and edge runtimes (AWS Lambda, Cloudflare + Vite, generic edge).

For full sample apps and product quickstarts, browse nylas-samples on GitHub β€” every official SDK has Email, Calendar, Contacts, Scheduler, and Webhooks quickstarts.

πŸ€– AI agents

nylas/skills drops Nylas into Claude Code, Cursor, Codex, and other agents that support the skills format:

npx skills add nylas/skills
/plugin marketplace add nylas/skills   # Claude Code

The CLI also installs an MCP server for Claude Desktop, Claude Code, Cursor, Windsurf, or VS Code:

brew install nylas/nylas-cli/nylas
nylas mcp install

Walkthrough: give AI agents email access via MCP.

πŸ“š Reference

✨ Upgrading

See CHANGELOG.md for per-release notes. Older upgrade guidance lives in UPGRADE.md.

πŸ’™ Contributing

Issues, ideas, and pull requests welcome β€” see Contributing.md. Before opening a large change, please open an issue or post in the forum so we can sanity-check the direction.

πŸ”’ Security

Found a vulnerability? Please don't open a public issue. Report it through our Vulnerability Disclosure Policy.

πŸ”— Other Nylas SDKs

πŸ“ License

MIT β€” see LICENSE.txt.

About

A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors