Receiving 400 Errors "Cannot provide more than 10 location_ids." for POST /orders/search

We are providing only 10 location ids in this search but we are receiving this 400 error:
"Cannot provide more than 10 location_ids."

POST /orders/search

{
data: None,

json: {

location_ids: [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10"
],

query: {
filter: {"date_time_filter":"{'updated_at': {'start_at': '2024-07-28T14:42:42.508201', 'end_at': '2024-08-27T14:42:42.508201'}}"},
sort: {"sort_field":"'UPDATED_AT'"}
}
}
}

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

https://developer.squareup.com/docs/app-marketplace/requirements/locations-api

Additional Documentation

Locations API Overview
Locations API Overview
Locations API Overview

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Those aren’t Square location_ids. The Square location_id will look like: A4A2HPSFKWTV8. If you don’t know the location_ids you can use the Locations API to get a list of all the locations. :slightly_smiling_face:

Thank you @Bryan-Square , but I obfuscated the ids. We are using similar ID’s to your example. The problem is we are providing 10 locations and the error is telling us that we cannot provide more than 10 location ids.

That’s correct. There is a maximum of 10 location_ids for a SearchOrders API call. If you have more then 10 locations you’ll need to call the endpoint again with a different set of location_ids configured in the request. :slightly_smiling_face:

Thank you, but I think there is a miscommunication. To clarify: we are sending 10 valid location ids, but we are getting a 400 error that says “Cannot provide more than 10 location_ids”.

We are unable to determine why we are getting this error when we are sending 10, not more than 10, location ids.

What is your application ID? :slightly_smiling_face:

Also I think the request is malformed which is why it’s failing. If you configure this does it work:

{
    "location_ids": [
      "{{location_id}}", "{{location_id_2}}"
    ],
    "query": {
      "filter": {
        "date_time_filter": {
          "updated_at": {
            "start_at": "2024-07-28T14:42:42.508201",
            "end_at": "2024-08-27T14:42:42.508201"
          }
        }
      },
      "sort": {
        "sort_field": "UPDATED_AT"
      }
    }
  }

:slightly_smiling_face: