Skip to content

Manage folders and labels with Kotlin/Java

This page explains how to use the Nylas Kotlin/Java SDK and Email API to manage the folders and labels in an email inbox. For more information, see the Email documentation.

Before you start, you must have done the following tasks:

Depending on the user’s email provider, there are two possible ways their inbox might be organized: using either folders or labels. Gmail uses labels, and all other providers use folders. Nylas consolidates both folders and labels under the Folders endpoint.

The following examples list all folders and labels from a user’s inbox.

The examples below create either a folder or label. Nylas automatically determines which to create based on the user’s provider.

The following examples use the Kotlin/Java SDK to get the most recent message in a user’s inbox and either move it to your new folder or apply the new label (see Create folders and labels).