Using the Python SDK
The Nylas Python SDK is an open-source software development kit that enables you to use Python to integrate the Nylas APIs with your application.
⚠️ The v6.x Nylas Python SDK is only compatible with v3.x Nylas APIs. If you're still using an earlier version of Nylas, you should keep using the v5.x Python SDK until you can upgrade to Nylas v3.
Before you begin
Before you can start using the Nylas Python SDK, make sure you have done the following:
- Create a free Nylas v3 developer account.
- Get your developer keys. You need to have your...
NYLAS_API_KEY
: The API key for your application in the Nylas Dashboard.NYLAS_API_URI
: The URI for your application according to your data residency.NYLAS_GRANT_ID
: The grant ID provided when you authenticate an account to your Nylas application.
- Install pip and create a virtual environment. See the official Python documentation for more information.
Install the Nylas Python SDK
To install the Nylas Python SDK, run the following command in a terminal.
pip install nylas
Initialize a Nylas instance
You can initialize a nylas
instance by passing your API key to the constructor, as below.
from nylas import Client
nylas = Client(
api_key="<NYLAS_API_KEY>",
api_uri="<NYLAS_API_URI>"
)
(Optional) Change the base API URL
You can choose to change the base API URL depending on your location, as in the table below.
Location | Nylas API URL |
---|---|
United States (Oregon) | https://api.us.nylas.com |
Europe (Ireland) | http://api.eu.nylas.com |
For more information, see the data residency documentation and the Migration guide for data centers.
To change the API URL, pass the NYLAS_API_URI
parameter with the API URL of your location.
from nylas import Client
nylas = Client(
os.environ.get('NYLAS_API_KEY'),
os.environ.get('NYLAS_API_URI')
)
🔍 The base API URL defaults to the Nylas U.S. region. See the data residency documentation for more information.
Latest supported version
For the latest supported version of the SDK, see the Releases page on GitHub.
Function and model reference
The Nylas Python SDK includes function and model documentation, so you can easily find the implementation details that you need.
GitHub repositories
The Nylas Python SDK repository houses the Python SDK. You can contribute to the SDK by creating an issue or opening a pull request.
For Nylas code samples, visit the Nylas Samples repository.