Issue with Thread Search Using Nylas API v3 - search_query_native Parameter

Hi Nylas Support,

I am encountering an issue while searching threads using the Nylas API v3. Specifically, when I search with the keyword "MAN-45", I receive the following error:
{

“request_id”: “5282526796-ddd399af-c51d-4cbe-a7e5-0f4410fafec4”, “error”: { “type”: “provider_error”, “message”: “Bad Request”, “provider_error”: { “error”: { “code”: “BadRequest”, “message”: “Syntax error: character ‘-’ is not valid at position 3 in ‘MAN-45’.” } } }

}

The issue persists even when I search using only digits. However, searching with complete words containing only characters works fine. But if I use two-character words separated by spaces (e.g., "AN 45"), the search also fails.

Could you clarify the expected behavior for the search_query_native parameter in thread searches? I am following the documentation from this link:

Here is the logged URL I am using:

threads?limit=20&in=AQMkADAwATY0MDABLTQ1YzAtZTNiMy0wMAItMDAKAC4AAAPxxufuAEQOQqXEmH6_yhvrAQA72M2hjLZKTpt2YD42X5QQAAACAQwAAAA=&search_query_native=MAN-45

If i paste this word with a space “Email cover” then it search nothing, not show any matching thread with this keyword “Email cover”.

Could you please advise on how to resolve this issue or provide guidance on the correct usage of the search_query_native parameter?

Thank you for your support.

Best regards,

Emmad Altaf

Contact:

nylasv3@gmail.com

@Blag @ram please look into my issue

I have tested searching in the Outlook app and other Microsoft inboxes using various queries. For example, when I search with subject ‘NDD-001100’, it returns the correct results. Similarly, searching with any number (e.g., ‘5678’), symbols (e.g., ‘- _ @’), or multiple words with spaces (e.g., ‘Test search’) works without issues.

However, when I try using the search_query_native parameter in the Nylas API, it fails and throws a syntax error for numbers, symbols, or spaces. Even though I followed the Nylas search documentation and encoded the URL properly, the issue persists.

I believe this is a problem with the Nylas API, and the backend team should investigate and resolve it as soon as possible. You can reproduce the issue by testing a search on any Nylas inbox.

Search with “NDD-111100”:

Search with “AAZ:AH12”:

Search with “Tahir test” , Here i am trying with space but it search nothing, not returning me matching record:

Hi @Emmad_Altaf! I’m a software engineer at Nylas, thanks for raising this issue. It looks very reproducible, so I’ll be taking a look at it this week, and hope to get it resolved for you ASAP.

1 Like

Hi @omkar , any update please ? kindly try to fix this issue today.

@omkar please update on this

Hi @Emmad_Altaf I am so sorry, there were other issues I needed to attend to first, and this slipped out of my rader. I’m picking it up again today, and hope to have a response for you by EOD.

1 Like

Hi @omkar ,
No worries! Thanks for the update. I’ll look forward to hearing from you by EOD.

Hi @Emmad_Altaf - I’ve found the issue and am working on a fix. You can expect it to be in production by Friday. If it’s still not working by then (and if you have any more issues), please file a customer support ticket here as we do not track forums posts as rigorously.

https://support.nylas.com/hc/en-us/requests/new

Hi @Emmad_Altaf! We actually ended up not shipping any code change at all, and I’ll explain why.

To fix the issues you are seeing with strings like MAN-45, you need to wrap them in double quotes. So what you should be passing to search_query_native is “MAN-45” or %22MAN-45%22. Then, you should see the results you are expecting.

I believe there is also a bit of confusion here about what search_query_native actually does. It is not meant for you to directly copy what is in the UI search bar, and then pass it to this query param (although that is very close, but there is a subtle difference). Our intention is to allow you to query the providers using their native syntax. For the case of Microsoft accounts, that means using the $search query param provided by the Graph API, which powers the UI. The Graph API will return 400 Bad Request if you do not use the quotes like I showed above and pass in non-alphabet characters.

For more details on $search, check out this link: Use the $search query parameter in Microsoft Graph - Microsoft Graph

We also have links to all the provider query languages in our docs here: Searching with Nylas | Nylas Docs

Hope this helps and unblocks you!