Skip to content
Skip to main content
GET
/v3/grants/{grant_id}/threads

Return all threads

Returns all threads.

For Microsoft, IMAP, iCloud, Yahoo, and EWS, threads are ordered reverse chronologically by the latest message received.

For Google, thread ordering is not guaranteed to be reverse chronological due to a Gmail API limitation. However, setting the in query parameter improves the likelihood of reverse chronological ordering significantly (approximately 40%). While reverse chronological ordering remains unguaranteed even with the in parameter, we recommend using it to increase the chance of this ordering pattern.

⚠️ Your users might receive a large number of threaded messages. If you encounter 429 errors or provider rate limits when listing all threads, Nylas recommends you set the limit parameter to 20 and add query parameters to your request to limit the results.
NYLAS API KEYACCESS TOKEN

Parameters

Path parameters

grant_id*string

ID of the grant to access. You can also use the email address associated with the grant, or use /me/ to refer to the grant associated with an access token.

Query parameters

any_emailstring

Filter for threads that contain messages sent to or received from the email addresses in the comma-separated list. You may specify a maximum of 25 email addresses per query.

bccstring

Filter for threads that contain messages BCC'd to the specified email address. Because most SMTP gateways remove BCC information from sent messages, any messages that Nylas returns are likely sent from the parent account.

For Microsoft grants, Nylas sometimes doesn't return messages that satisfy the conditions of this query parameter. This is because of a limitation on the provider. Instead, you can use the thread_id to retrieve a specific conversation.

ccstring

Filter for threads that contain messages CC'd to the specified email address.

For Microsoft grants, Nylas sometimes doesn't return messages that satisfy the conditions of this query parameter. This is because of a limitation on the provider. Instead, you can use the thread_id to retrieve a specific conversation.

fromstring

Filter for threads that include messages sent from the specified email address. If you want to filter for threads that include messages sent from the current grant, use the in query parameter and specify the Sent folder instead.

For Microsoft grants, Nylas sometimes doesn't return messages that satisfy the conditions of this query parameter. This is because of a limitation on the provider. Instead, you can use the thread_id to retrieve a specific conversation.

has_attachmentboolean

When true, filters for threads that include attachments.

Default: false
instring

Return messages in the specified folder or label, by folder ID. Required when using shared_from.

earliest_message_dateinteger

Returns the date when the earliest or first message in the thread was sent or received, in Unix timestamp format.

latest_message_afterinteger

Filter for threads whose most recent message was received after the specified time, in Unix timestamp format.

latest_message_beforeinteger

Filter for threads whose most recent message was received before the specified time, in Unix timestamp format.

limitinteger

The maximum number of objects to return. See pagination for more information.

Default: 20
page_tokenstring

An identifier that specifies which page of data to return. You can get this value from the next_cursor response field. See Pagination for more information.

search_query_nativestring

Specify a URL-encoded provider-specific query string. Each provider supports a limited set of query parameters that you can use in your request alongside search_query_native:

  • Google: in, limit, and page_token
  • Microsoft: in, limit, and page_token
  • IMAP/Yahoo/iCloud: Any parameter
  • EWS: Any parameter except thread_id

For more information, see Searching with Nylas.

selectstring

Specify fields that you want Nylas to return, as a comma-separated list (for example, select=id,updated_at). This allows you to receive only the portion of object data that you're interested in. You can use select to optimize response size and reduce latency by limiting queries to only the information that you need.

shared_folder_idstring

(Microsoft only) When provided, Nylas returns items from the specified shared folder ID. Required when using shared_from. This parameter only accepts a single folder ID. Check out the Shared folders guide for more information.

shared_fromstring

(Microsoft only) When provided, Nylas returns items that were shared from the specified email address. It also accepts grant ID. This parameter only accepts single email address or grant ID. Check out the Shared folders guide for more information.

starredboolean

Filter for threads that contain one or more starred messages.

subjectstring

Return threads that contain messages with a matching subject. This filter is case-sensitive and returns partial matches.

tostring

Filter for threads that contain messages sent to the specified email address.

For Microsoft grants, Nylas sometimes doesn't return messages that satisfy the conditions of this query parameter. This is because of a limitation on the provider. Instead, you can use the thread_id to retrieve a specific conversation.

unreadboolean

Filter for threads that contain one or more unread messages.

Responses

request_idstring

The request ID.

dataobject
next_cursorstringnull

A cursor pointing to the next page of results for the request.

GEThttps://api.us.nylas.com/v3/grants/nyla%40example.com/threads?any_email=mail1%40example.com%2Cmail2%40example.com&has_attachment=false&limit=20

Find your API key in the Nylas Dashboard under API Keys in your application settings.

grant_idrequiredstring

ID of the grant to access. You can also use the email address associated with the grant, or use /me/ to refer to the grant associated with an access token.