Skip to main content
Nylas

Nylas Python SDK

The official Python SDK for Nylas — the infrastructure that powers communications

version code coverage downloads license

📖 SDK Guide · 📚 API Reference · 🚀 Sign up · 💡 Samples · 💬 Forum


The official Python 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 Python 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: Python 3.8 or later.

pip install nylas

To install from source:

git clone https://github.com/nylas/nylas-python.git
cd nylas-python
pip install -e .

Runtime support

Tested on CPython 3.8+. Runs on standard servers as well as serverless platforms like AWS Lambda, Google Cloud Functions, and Vercel — install nylas like any other dependency in your deployment package.

⚡️ Usage

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

import os
from nylas import Client

nylas = Client(
    api_key=os.environ["NYLAS_API_KEY"],
    api_uri=os.environ.get("NYLAS_API_URI", "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):

calendars, request_id, next_cursor = nylas.calendars.list(
    identifier=os.environ["NYLAS_GRANT_ID"],
)
print(calendars)

Resources expose a consistent CRUD surface — create(), find(), list(), update(), destroy() — plus resource-specific methods (e.g. messages.send(), events.send_rsvp()). Request and response models are dataclasses-json dataclasses, so every payload is fully type-hinted and supports to_dict() / from_dict().

Error handling

The SDK raises typed exceptions you can catch and inspect. Every API error carries a request_id and status_code — include both when filing a support ticket so we can trace the request end-to-end.

from nylas import Client
from nylas.models.errors import (
    NylasApiError,
    NylasOAuthError,
    NylasSdkTimeoutError,
)

try:
    nylas.calendars.list(identifier=grant_id)
except NylasApiError as err:
    print(err.status_code, err.type, str(err), err.request_id)
except NylasOAuthError as err:
    print(err.error, err.error_code, err.error_description)
except NylasSdkTimeoutError as err:
    print("Timed out:", err.url, err.timeout)

Step-by-step walkthroughs in the SDK guide:

Debugging

To inspect the raw HTTP traffic the SDK sends, turn on requests-level logging:

import logging

logging.basicConfig(level=logging.DEBUG)
logging.getLogger("urllib3").setLevel(logging.DEBUG)

💡 Examples

Runnable examples live in examples/ — including send email, inline attachments, folders, import events, events batch, Notetaker API, Notetaker calendar, message fields, metadata fields, provider errors, response headers, select parameter, special characters, hidden folders, and plain text.

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 (v5.x → v6.x) 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.

Metadata

Release files for nylas 6.19.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nylas 6.19.0
File Size Uploaded Provenance Actions
nylas-6.19.0.tar.gz 73.9 kB Without provenance Details for nylas-6.19.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nylas 6.19.0
File Interpreter ABI Platform Actions
nylas-6.19.0-py3-none-any.whl Python 3 none any Details for nylas-6.19.0-py3-none-any.whl

Total release size: 171.6 kB

Release files / nylas-6.19.0.tar.gz

Download URL nylas-6.19.0.tar.gz
Size 73.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f9f22b0f56fc662eaf7fffc557fd8cb32e9443eae51e73ad3df5c3106e995349
BLAKE2b-256 checksum
How to use checksums
93471d515136e57b80608b6e52d1d3dd0bf3c3e9b5863c12491eefeedc2a1d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.16

Release files / nylas-6.19.0-py3-none-any.whl

Download URL nylas-6.19.0-py3-none-any.whl
Size 97.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04fa43a5a059be3f95b52699b18f54faa09c12d5d9598f24dcb7fdda0b5cb1df
BLAKE2b-256 checksum
How to use checksums
ba53625f3be567a16e1c134916a0cf24642bf9e3347ec04706df4f17798532b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.16

Security for nylas 6.19.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.19.0 This release

2 release files No provenance

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page