web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

contacts API query is very slow

(1) ShareShare
ReportReport
Posted on by 7
Hi,
Our production app is calling the Dynamics API to query for contacts, but we are noticing it is very slow, taking around 13-15 seconds to respond. We are querying for contacts that match an email address or name.
 
Here is a sample query:
https://{subdomain}.crm.dynamics.com/api/data/v9.2/contacts?$top=25&$filter=(contains(fullname,'test')%20or%20contains(emailaddress1,'test'))%20and%20(Microsoft.Dynamics.CRM.NotIn(PropertyName='statecode',PropertyValues=['0','1']))&$select=fullname,firstname,lastname,emailaddress1&$expand=owninguser($select=fullname,windowsliveid)
 
I've tried reducing limit from 25, but that doesn't seem to make a difference. Is there anything else we can do to optimize the query? What is the expected latency of this API?
Categories:
I have the same question (0)
  • AR-07012221-0 Profile Picture
    7 on at
    contacts API query is very slow
    Thanks for the reply. From what I've found:
     
    - full query: 13-14 seconds
    - only status code check: 2-3 seconds
    - only email check: 8-9 seconds
    - only full name check: 16-18 seconds
  • Suggested answer
    PerezAguiar Profile Picture
    Microsoft Employee on at
    contacts API query is very slow
    Hey!
     
    I think you should reach to Microsoft Support to get some assistance on this.  But before that:  Typically, the "contains" operation consumes a lot of time/Resources as this must perform substring searches.  I would ask you to:
    - make the first search without the "Contains" string part, and only with the Statecode search.
    - then, the other way around:  only with ONE contains (for example, the FullName) and removing the StatusCode part
     
    The idea is to verify which of those 3 operations (FullName, Email or StatusCode) is taking more time to complete.  Once this is identified, then, probably reaching Microsoft to understand if there's any action that can be taken to improve.
     
    Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
DAnny3211 Profile Picture

DAnny3211 433

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 137 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 67 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans