Only show these results:

Getting Started with the CLI

Quickly install, set up credentials, and begin API requests with the steps in the guide below.

Prerequisites

To start using the Nylas CLI, you'll need the requirements below.

Installing the CLI

Install the Nylas CLI through homebrew or Binary Installation below.

Homebrew Installation

Run the command below to install the Nylas CLI using homebrew.

brew install nylas/nylas-cli/nylas

Also, for upgrading to the most recent version of the Nylas CLI, use the following brew command.

brew upgrade nylas

Binary Installation

For users wanting to install the binary file, the links below contain downloads for each respective operating system. The checksum is available for file verification.

At the Terminal

After installing the Nylas CLI, begin initializing and authenticating your Dashboard credentials. Once you’ve completed the process, these settings continue to work in the CLI for your application without having to input account information again.

Initializing the CLI

Setup your Nylas CLI with the Client ID and Client Secret from your Nylas Dashboard. Follow the steps from the terminal actions below.

Authenticating Your Account

With your account’s email address, start the authentication within your terminal. You can choose to authenticate through your browser or through the terminal prompts.

The code below shows the formatting of the command and response when authenticating.

nylas auth [email_address]
INFO Using Nylas's Hosted Authentication, we will obtain a valid access token that can be used to interact with Nylas's public APIs.
INFO For more info, visit: https://developer.nylas.com/docs/the-basics/authentication/hosted-authentication/

Browser Authentication

Input y to begin authenticating in your browser through Hosted Authentication.

? Open your browser to authenticate your account (Y/n): y
INFO Opening your browser for hosted authentication login...
? Check your browser, or, manually enter your access token:
SUCCESS Verified and saved your access token <ACCESS_TOKEN>.

In the response, the Nylas CLI also verifies your access token in the terminal when authenticating in the browser.

Manual Authentication in Terminal

Selecting n requires you to manually authenticate in the terminal with your credentials.

Making Your First Request

With your account credentials configured, you can begin to make API requests from your terminal.

GET Accounts Request

Retrieve your account information with a GET request in the Nylas CLI.

nylas api accounts get   

GET Accounts Response

You’ll see similar results to the example below with a successful request.

[
{
"id": "<ACCOUNT_ID>",
"account_id": "<ACCOUNT_ID>",
"billing_state": "paid",
"provider": "eas",
"sync_state": "running",
"trial": false,
"email": "william@outlook.com"
},
{
"id": "<ACCOUNT_ID>",
"account_id": "<ACCOUNT_ID>",
"billing_state": "paid",
"provider": "gmail",
"sync_state": "running",
"trial": false,
"email": "william@gmail.com"
}
]

Congratulations!

You’re well on your way to using the Nylas CLI in your workflow! Once you’ve completed the process, these settings continue to work in the CLI for your application without having to input account credentials again.

What's Next

When you’re ready to build your own application, you can use the credentials from your provider as the <CLIENT_ID> and <CLIENT_SECRET> for any requests as well. Learn more in the Create an App guide. The links below help you make the most of your Nylas CLI experience.