Filter orders in business day for restaurants that stay open past midnight

Hi, I’m building a report for some restaurants, and I’m trying to filter orders by business day using the API. For instance, I would like to get all the orders for April 23, 2024.

I’m using the search orders endpoint, which accepts a start_at and end_at filters. The issue is that some restaurants may stay open past midnight, for instance until 1 AM or 2 AM depending on the restaurant, so it is not so simple as to set start_at=2024-04-23T00:00:00 and end_at=2024-04-23T23:59:59.999.

I would need somehow to know which is the start_at and end_at for the business day, for each restaurant. Do you know a way I could do that? Or any alternative solution?

I know the retrieve location endpoints returns a business hours object, like this:

"business_hours": {
    "periods": [
            "day_of_week": "FRI",
            "start_local_time": "11:00:00",
            "end_local_time": "15:00:00"
            "day_of_week": "FRI",
            "start_local_time": "19:00:00",
            "end_local_time": "23:00:00"

but I don’t think this would be useful for my use case.

: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:

Additional Documentation

Orders API: How It Works
Order-Ahead Application Use Case
Orders API Requirements

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.

At this time the ability to get a businesses close of day that’s set in the Transfer settings isn’t currently available with our APIs. Only business hours are available via the Locations API. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. :slightly_smiling_face:

1 Like