SearchOrders
Search all orders for one or more locations. Orders include all sales, returns, and exchanges regardless of how or when they entered the Square ecosystem (such as Point of Sale, Invoices, and Connect APIs).
SearchOrders requests need to specify which locations to search and define a SearchOrdersQuery object that controls how to sort or filter the results. Your SearchOrdersQuery can:
Set filter criteria. Set the sort order. Determine whether to return results as complete Order objects or as OrderEntry objects.
Note that details for orders processed with Square Point of Sale while in offline mode might not be transmitted to Square for up to 72 hours. Offline orders have a created_at value that reflects the time the order was created, not the time it was subsequently transmitted to Square.
Request body
Example request
{
"request_body": {
"limit": 3,
"location_ids": [
"057P5VYJ4A5X1",
"18YC4JDH91E1H"
],
"query": {
"filter": {
"date_time_filter": {
"closed_at": {
"end_at": "2019-03-04T21:54:45+00:00",
"start_at": "2018-03-03T20:00:00+00:00"
}
},
"state_filter": {
"states": [
"COMPLETED"
]
}
},
"sort": {
"sort_field": "CLOSED_AT",
"sort_order": "DESC"
}
},
"return_entries": true
}
}Response
Success
Example response
{
"cursor": "123",
"order_entries": [
{
"location_id": "057P5VYJ4A5X1",
"order_id": "CAISEM82RcpmcFBM0TfOyiHV3es",
"version": 1
},
{
"location_id": "18YC4JDH91E1H",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY"
},
{
"location_id": "057P5VYJ4A5X1",
"order_id": "CAISEM52YcpmcWAzERDOyiWS3ty"
}
]
}