Hi Box Support / Community,
I’m working on a Box integration where I need to programmatically retrieve only all files and folders that were modified within a given date range — for example, from 2025-06-22
to 2025-06-28
.
What I’ve Tried:
1. Search API with updated_at_range
I referred to the SDK documentation here: Box Python SDK Search Query Documentation
Example:
search_results = client.search().query(
query='S',
ancestor_folder_ids=_folder_id],
updated_at_range=('2025-06-22T00:00:00Z', '2025-06-28T23:59:59Z'))
Issue:
This still returns records whose modified_at
(or created_at
) values fall outside the specified range.
For example, even with the range set as 2025-06-22
to 2025-06-28
, I received a result like:
{ "id": "1903231782703", "name": "Screenshot 2025-06-16 at 7.15.16 PM.png", "created_at": "2025-06-18T23:55:45-07:00", "modified_at": "2025-06-18T23:55:45-07:00" }
This was clearly outside the defined date range, yet still returned by the search query.
I also tested with created_at_range
and encountered the same issue.
2. Folders API get_items()
+ Client-side Filtering
Example:
items = client.folder(folder_id).get_items() for item in items: # Compare item.modified_at after converting to UTC
Issue:
This works correctly but returns every item in the folder (would include 2+ years of data when I need only 8 days - 1month data), which is inefficient and involves excessive API calls and unnecessary data transfer just to identify a small subset.
---------------------------------------------------------------------------------------------------------------------------------------
- What I Have Not Considered Suitable:
-
Metadata Query API / Metadata Templates:
I have ruled out this approach because it requires each file to be added to a metadata template.
This isn’t viable for my use case since I need to retrieve date-based results directly without requiring any manual or user-driven actions (like adding metadata to each file) on their end.
- What I’m Trying to Achieve:
- I’m looking for a reliable, efficient way to retrieve only the items (files and folders) that were modified within a given date range — ideally via a server-side filter or query — without requiring a full folder scan or client-side filtering.
Questions:
-
Is there a recommended, supported approach for achieving this?
-
Are there any limitations when using
updated_at_range
with the Search API that would explain why it returns results outside the specified range? -
Is there a way to apply a modified date filter directly on a folder’s contents via SDK method
client.folder(folder_id).get_items()
without requiring client-side filtering? - Preferred -
Are there any planned improvements or enhancements for supporting this type of query natively?
Context:
-
Using Box Python SDK (latest version)
-
Enterprise Box account
-
Issue reproducible consistently
-
Timestamps properly converted to UTC before comparison when filtering client-side
Would greatly appreciate any advice or recommendations from the Box team or community on the best way to approach this.
Thank you!