SharePoint Online Search REST API parameter sortlist is causing an error (again)
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Developer environment
None
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [x] 💥 Microsoft Edge
- [ ] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
No response
Describe the bug / error
The SharePoint API endpoint _api/search is returning an error when using the sortlist parameter sortlist='[docid]:ascending'
The error returned is 400 BAD REQUEST with the message:
We didn't understand your search terms. Make sure they're using proper syntax
The full error code is:
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.Office.Server.Search.REST.SearchServiceException</m:code>
<m:message xml:lang="en-US">We didn't understand your search terms. Make sure they're using proper syntax.</m:message>
</m:error>
This appears to be the same error, or similar to, the one I reported in May 2024 which was subsequently fixed.
If this is a breaking change that has been deployed to SharePoint Online, we need the breaking change rollout stopped and then reverted before the impact spreads further to other tenants.
The sortlist parameter with [docid]=ascending is valid search syntax as per the Microsoft help article here. https://learn.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets
Steps to reproduce
Open Edge browser, sign in to your SharePoint site then copy and paste this URL in to the address bar and hit return, after changing YOURDOMAIN for your SharePoint tenant name:
https://YOURDOMAIN.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site+(WebTemplate:GROUP OR WebTemplate:TEAMCHANNEL)'&sortlist='[docid]:ascending'
You will receive an error message.
If the sortlist parameter is removed from the query then it will succeed:
https://YOURDOMAIN.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site+(WebTemplate:GROUP OR WebTemplate:TEAMCHANNEL)'
This will return an error on impacted tenants only. It appears to be affecting only a subset of tenants at present.
Expected behavior
The expected SharePoint search results should be returned, not an error.
👋 Hi @mcgeeky,
Thank you for reporting this issue. Here is an AI-generated initial response:
Classification: Bug — the reported 400 response for sortlist='[docid]:ascending' conflicts with the documented SharePoint Search REST behavior. The cause of the current failure is not yet confirmed.
- Microsoft Learn explicitly uses bracketed
[docid]for ascending sorting and large-result pagination. - The reporter’s query and error closely mirror the 2024 report; users reported that the earlier failure later stopped. That history does not establish a new rollout or rollback.
What to do now:
- Recheck the same query with and without
sortliston affected and unaffected tenants. Omitting it is only a temporary option if sorted results and DocId-based pagination are unnecessary. - Open a Microsoft 365 support case with the request URL, UTC timestamp, tenant, response headers/correlation ID, and both responses. Request investigation of the documented syntax; no current fix or rollout is verified.
Useful links:
Note: AI-generated guidance may be incomplete or incorrect. Please verify suggestions before applying them.
Bringing this to your attention @wobba
I had reports of this happening yesterday too, looks like that issue from 2024 is back.
I am seeing this as well. On one tenant sortList fails, on a different tenant it's working.
Does it work without brackets? docid:ascending
Does it work without brackets? docid:ascending
No, it does not work without brackets either. The error is:
We didn't understand your search terms. Make sure they're using proper syntax
Without brackets does work for me.
Something else I've just found is that the square brackets do work if there is no sourceid parameter specified. It seems to be the combination of sourceid and [docid]:ascending that is breaking (at least for me)
Thanks for the details. I’ve reached out internally to the engineering team for confirmation on the issue. I’ll post an update here once I hear back from them.
For those with the issue, please remove [] if possible. We will likely update documentation of https://learn.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets to remove []. That said, we are investigating the regression.
See https://github.com/SharePoint/sp-dev-docs/pull/11049
Thanks for the update @wobba . I'm assuming your plan is to revert the regression after your investigation to avoid impact on customers? We have at least one customer with a situation where [docid] and DocId (no square brackets) are causing a search error.
@mcgeeky still not sure what cause the regression as we should handle with both [] and without in the downstream logic. Mitigation should be to remove it until we find the root cause.
@wobba The earliest report we had of the issue was on 1st October, if that is any help with isolating the cause/update. I can provide the name of one of the affected tenants via private message on X?
Removing the [] also works for me on the tenant it was failing. Supporting both syntax would be great.
@wobba suddenly we having this problem too on our tenants. Its now the next thing with the search api. What is going on here?
Sending this via post (pnpjs). Was working this morning and now suddenly I am getting 400 errors and colleagues reporting that our solution stopped working?
"SortList":[{"Direction":0,"Property":"DocId"}],
Fallback with removing the SortList completly from the request works, but thats results in changes in the results...
We are seeing more reports of the issue with [docid] with square brackets. Is it not possible to stop the rollout of the change request that contains the regression to limit the impact?
@hstuermann that's what I see too: DocId is broken, but was previously working, and [docid] is broken but was previously working. docid without square brackets does work.
So there are two forms for [docid]/DocId for the sortlist parameter that have regressed.
Yes I had to implement a fallback now when the API is failing and changed the DocId to docid. But changing the solution every few days to fix sudden changes on MS side is not a working scenario.
But changing the solution every few days to fix sudden changes on MS side is not a working scenario.
I agree.
Thanks for investigating this issue.
We can confirm that we are experiencing the same problem in our SharePoint Online customer environments, starting on October 8, 2026.
In our case, requests to /_api/search/postquery using "Property": "[docId]" now return 400 BadRequest, while changing the property to "docId" resolves the issue.
One important concern is that the [official Microsoft documentation for pagination](https://learn.microsoft.com/en-us/sharepoint/dev/general-development/pagination-for-large-result-sets) was updated on October 7, 2026, just one day before we started experiencing the errors.
The documentation previously recommended [docid] for REST queries and [DocId] for CSOM. The updated version now uses docid / DocId, but explicitly states:
Earlier versions of this article used a bracketed field name in the REST and CSOM examples. The examples now use
docidin REST queries andDocIdin CSOM. This documentation change does not announce deprecation or removal of the bracketed form.
Given this statement, and @wobba's comment that the downstream logic should support both forms, could the Microsoft team please clarify the following?
-
Is
[docId]still officially supported? Should both the bracketed and non-bracketed syntaxes continue to work, or is Microsoft planning to deprecate the bracketed syntax? -
Will this regression be reverted? Since
[docId]was previously documented and has been working for years, can we expect backward compatibility to be restored? -
Is
docidwithout brackets guaranteed to remain supported? If we update our applications to use the workaround, could a future revert potentially break the non-bracketed syntax? We are particularly concerned given the similar regression and subsequent revert reported in [#9728](https://github.com/SharePoint/sp-dev-docs/issues/9728). -
Are both syntaxes functionally equivalent? Can we safely replace
[docId]withdocidwithout affecting sorting behavior or pagination usingIndexDocId? -
What is Microsoft's recommended long-term approach? Should developers proactively update their implementations, or wait for the regression to be fixed?
This is affecting production applications used by our customers. While changing the sorting property appears to be a straightforward workaround, deploying updates across multiple customer environments requires coordination, testing, and releases.
Our main concern is avoiding repeated production disruptions caused by changes in previously documented API behavior. We need confidence that the syntax we choose will remain supported in future SharePoint Online updates.
We would really appreciate an official confirmation of the intended long-term behavior and backward compatibility.
Thanks!