How do I find cards updated within a time period?

We’re trying to get a list of cards updated within a range of time (e.g. 1 hour) to check for updates (yes we know about webhooks).

The Search Trello request looks promising but there is scant documentation and the questions in this forum and online aren’t helping me or ChatGPT.

Is there a way to use datelastactivity to find cards with a datelastactivity within a certain range? Examples please, not a link to the “How to search Trello article” which doesn’t help.

If datelastactivity isn’t the answer is there another way? Seems like a standard type request to poll an API for recent changes.

Hello @TroyChristmas

Is there a way to use datelastactivity to find cards with a datelastactivity within a certain range?

Sorry, but dateLastActivity isn’t supported as a search operator. The closest you can get is edited to at least narrow the range, as per the documentation:

edited:day - Returns cards edited in the last 24 hours. edited:week and edited:month also work as expected. You can search for a specific day range. For example, adding edited:21 to the search will include cards edited in the last 21 days.

Then, in the returned results, you have to use the dateLastActivity field to filter the results in your code.

1 Like

Thanks for the clear and quick response. I’ll push my luck and ask whether “edited:0.5” will work or any other fraction of a day. I’m looking for a window shorter than 24 hours if possible.

No idea, as I’ve never tried it. Try and see what happens… it either will work or it won’t :slight_smile:

Personally, I’ve found that dateLastActivity isn’t a reliable way of knowing when a card was ‘updated’ in the classic sense, as many things, like Butler automations, can mass change cards in tiny ways, so many cards can have almost near identical last activity times. I prefer to look for specific Actions that have been performed on cards and the times they happened; this filters out the ‘noise’ of general card activities.

Try and see what happens… it either will work or it won’t

Said I was pushing my luck. :stuck_out_tongue_winking_eye:

We’re ultimately trying to implement a backup polling process to replicate the webhooks that notify us of cards where due has changed from “incomplete” to “complete”. Trying to find the most efficient way possible, but we have to search the whole account and not board by board or list by list. That’s why looking at search endpoint.

Based on this discussion searching for due:completed with edited:day, would narrow down to cards marked complete and edited within 24 hours and then filter on datelastactivity if we wanted only cards edited within x timeframe within the day (knowing the edit could have been from anything).

Any ideas on a endpoint/query that would narrow more specifically on the timing of when the card was marked complete?

Nope, Trello just doesn’t provide that level of granularity when searching cards.

An alternative method would be, after searching for cards with due:complete and edited:day, for each card returned you could Get the actions for that card, filtering by updateCard:dueComplete, which would return those Actions when the dueComplete field changed, including when it changed from false to true :

        "id": "65dace753d6854b95b0d30d0",
        "idMemberCreator": "5f935b218574e6316bd7d97a",
        "data": {
            "card": {
                "dueComplete": true,  <-- Due date marked as complete
                "id": "65ca7c08c21059562a1bed38",
                "name": "Test card",
                "idShort": 269,
                "shortLink": "sbqFMaye"
            "old": {
                "dueComplete": false  <-- Due date was previously not complete
        "type": "updateCard",
        "date": "2024-02-25T05:21:57.184Z"  <-- When the updateCard Action happened 

This tells you the time the update to the card’s due date happened.

I think that’s as close as you’re going to get. If you really are intent on getting this information for all cards on all boards, then it’s going to be a fairly time consuming activity, any way you slice it.

1 Like