When using AI coding tools to build a Nylas integration, the LLM needs context about the Nylas APIs. There are three approaches: install the Nylas skill, point the tool at the docs, or paste a system prompt. Use whichever fits your tool.
Option 1: Install the Nylas skill (recommended)
Section titled “Option 1: Install the Nylas skill (recommended)”The Nylas skills pre-load your coding agent with current Nylas API, CLI, and SDK context. Skills work with Claude Code, Cursor, Codex CLI, and 40+ other agents — no system prompt or URL fetching required.
# Install both Nylas skills (API + CLI)npx skills add nylas/skills
# Or install individuallynpx skills add nylas/skills/nylas-apinpx skills add nylas/skills/nylas-cli/plugin marketplace add nylas/skills/plugin install nylas-skillsThe nylas-api skill covers authentication, email, calendar, contacts, webhooks, scheduler, notetaker, and SDK usage. The nylas-cli skill covers nylas init, auth, email, calendar, mcp, chat, and tui commands. Skills stay current by linking to llms.txt and fetchable doc pages.
Option 2: Point your tool at the docs
Section titled “Option 2: Point your tool at the docs”The Nylas docs are built for agents. There are three ways to consume them:
llms.txt— a curated sitemap of every key page, grouped by product area. Start here when you need to find the right doc.llms-full.txt— every doc page concatenated into one file. Good for tools with large context windows.Accept: text/markdownheader — fetch any individual page as clean markdown. Works on every URL ondeveloper.nylas.com. Returns anx-markdown-tokensresponse header with the estimated token count.
# Curated sitemap -- read this firstcurl https://developer.nylas.com/llms.txt
# Full docs in one filecurl https://developer.nylas.com/llms-full.txt
# Any single page as markdowncurl -H "Accept: text/markdown" https://developer.nylas.com/docs/v3/email/Most AI coding tools can fetch URLs. Add one of the snippets below to your tool’s rules file so it knows to read the docs on demand.
For Claude Code, add this to your project’s CLAUDE.md:
When working with Nylas APIs, read https://developer.nylas.com/llms.txt for a sitemapof all documentation. For specific pages, fetch them with the Accept: text/markdown header:curl -H "Accept: text/markdown" https://developer.nylas.com/docs/v3/email/For Cursor, add this to .cursor/rules:
When building with Nylas APIs, reference https://developer.nylas.com/llms.txt for documentation.Always use Nylas v3 (not v2). v3 uses API keys and grant IDs. v2 used access tokens and client secrets.For GitHub Copilot, add to .github/copilot-instructions.md:
For Nylas API integration, reference: https://developer.nylas.com/llms.txtUse Nylas v3 only. Authentication uses Bearer token with API key. Each user account is a "grant" with a grant_id.For OpenAI Codex CLI, add to your project’s AGENTS.md or pass via --instructions:
For Nylas API integration, reference: https://developer.nylas.com/llms.txtUse Nylas v3 only. v3 uses API keys (Bearer token) and grant IDs. Never use v2 patterns (access_token, client_secret).For ChatGPT / OpenAI API, include in your system prompt or custom GPT instructions:
When helping with Nylas API integration, always use Nylas v3. Reference: https://developer.nylas.com/llms.txtKey concepts: API key (Bearer token), grant_id (one per connected user account), base URL https://api.us.nylas.com.Option 3: Paste a system prompt
Section titled “Option 3: Paste a system prompt”If your tool doesn’t fetch URLs, or you want tighter control over context, paste one of these prompts directly.
Starter prompt (use this first)
Section titled “Starter prompt (use this first)”This gives the LLM the core mental model for building with Nylas. Paste it as a system prompt or rules file.
You are building with the Nylas v3 APIs. Follow these rules:
## API basics
- Base URL: `https://api.us.nylas.com` (US) or `https://api.eu.nylas.com` (EU)- Auth: Bearer token using the API key in the Authorization header- Every request to user data follows the pattern: `GET/POST /v3/grants/{grant_id}/{resource}`- A **grant** is one connected user account (Gmail, Outlook, etc). You get a grant_id when a user authenticates through OAuth.
## SDK setup
Use the official SDK for your language. Never use raw HTTP when an SDK is available.
```bashnpm install nylas # Node.jspip install nylas # Pythongem install nylas # Ruby```
Initialize the client:
```javascriptimport Nylas from "nylas";const nylas = new Nylas({ apiKey: process.env.NYLAS_API_KEY });```
```pythonfrom nylas import Clientnylas = Client(os.environ["NYLAS_API_KEY"])```
## Critical rules
- **Only use v3.** v2 is deprecated. v3 uses `api_key` and `grant_id`. If you see `access_token` or `client_secret`, that's v2 -- don't use it.- **Never hardcode API keys.** Use environment variables and .env files excluded from version control.- **Never expose the API key in client-side code.** All Nylas API calls must happen server-side.- **Handle pagination.** List endpoints return `next_cursor`. Use it to fetch subsequent pages.- **Use webhooks for real-time updates** instead of polling.
## Key endpoints
| Action | Method | Path ||--------|--------|------|| List messages | GET | `/v3/grants/{grant_id}/messages` || Send email | POST | `/v3/grants/{grant_id}/messages/send` || List events | GET | `/v3/grants/{grant_id}/events?calendar_id={id}` || Create event | POST | `/v3/grants/{grant_id}/events?calendar_id={id}` || Check availability | POST | `/v3/calendars/availability` || List calendars | GET | `/v3/grants/{grant_id}/calendars` || List contacts | GET | `/v3/grants/{grant_id}/contacts` |
## Documentation
- Full docs: https://developer.nylas.com/docs/v3/getting-started/- API reference: https://developer.nylas.com/docs/reference/api/- SDK docs: https://developer.nylas.com/docs/v3/sdks/- Any page as markdown: `curl -H "Accept: text/markdown" https://developer.nylas.com/docs/v3/email/`Email prompt
Section titled “Email prompt”Paste this after the starter prompt when building email features.
## Nylas Email API
Read messages:```javascriptconst messages = await nylas.messages.list({ identifier: grantId, queryParams: { limit: 10 },});```
Send a message:```javascriptconst sent = await nylas.messages.send({ identifier: grantId, requestBody: { subject: "Hello", body: "Email body here", },});```
Search messages (uses provider-native syntax):```javascriptconst results = await nylas.messages.list({ identifier: grantId,});```
Key points:- Messages are immutable -- you can't edit a sent message- Use `threads` endpoint to get conversation view- Attachments are accessed via separate download endpoint- Filter with `from`, `to`, `subject`, `received_after`, `received_before`, `in` (folder), `unread`- Docs: https://developer.nylas.com/docs/v3/email/Calendar prompt
Section titled “Calendar prompt”Paste this after the starter prompt when building calendar features.
## Nylas Calendar API
List events (calendar_id is required):```javascriptconst events = await nylas.events.list({ identifier: grantId, queryParams: { calendarId: "primary", limit: 10 },});```
Create an event with participants:```javascriptconst event = await nylas.events.create({ identifier: grantId, requestBody: { title: "Team sync", when: { startTime: startUnix, endTime: endUnix }, }, queryParams: { calendarId: "primary" },});```
Check availability across users:```javascriptconst availability = await nylas.calendars.getAvailability({ requestBody: { startTime: startUnix, endTime: endUnix, durationMinutes: 30, },});```
Key points:- Every event operation requires `calendar_id` as a query parameter- Use `primary` for the user's default calendar- Times are Unix timestamps in seconds, not milliseconds- Nylas sends invitations to participants automatically when creating events- RSVP via `POST /v3/grants/{grant_id}/events/{event_id}/send-rsvp`- Docs: https://developer.nylas.com/docs/v3/calendar/Authentication prompt
Section titled “Authentication prompt”Paste this when implementing the OAuth flow to connect your users’ accounts.
## Nylas Authentication (Hosted OAuth)
The flow: Your app redirects the user to Nylas -> Nylas redirects to the email provider -> user authenticates -> Nylas redirects back to your app with a code -> you exchange the code for a grant_id.
Generate the auth URL:```javascriptconst authUrl = nylas.auth.urlForOAuth2({ clientId: process.env.NYLAS_CLIENT_ID, redirectUri: "http://localhost:3000/callback",});// Redirect the user to authUrl```
Handle the callback:```javascriptconst response = await nylas.auth.exchangeCodeForToken({ clientId: process.env.NYLAS_CLIENT_ID, clientSecret: process.env.NYLAS_API_KEY, code: req.query.code, redirectUri: "http://localhost:3000/callback",});const grantId = response.grantId;// Store grantId associated with your user```
Key points:- Register your callback URI in the Nylas Dashboard under Hosted Authentication- The redirect URI in your code must exactly match what's registered in the Dashboard- Store the grant_id -- you'll use it for all subsequent API calls for that user- One grant = one connected email account- Docs: https://developer.nylas.com/docs/v3/auth/hosted-oauth-apikey/Before you begin
Section titled “Before you begin”If you haven’t set up your Nylas account yet:
- Get started with the CLI — run
nylas initto create an account, generate an API key, and connect a test account. - Get started with the Dashboard — do the same steps through the web UI.
What’s next
Section titled “What’s next”- Guide for AI coding agents — detailed rules and patterns for coding agents building with Nylas
- Email API quickstart — send and read email with full SDK examples in all languages
- Calendar API quickstart — schedule meetings and check availability
- Notetaker API quickstart — record meetings and get transcripts
- API reference — full endpoint documentation