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 begin

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

List folders and labels

Depending on the end 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 an end user’s inbox.

Create folders and labels

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

Organize an inbox with folders and labels

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