HELP. API Call for Search using Query parameter
Asked by A:

Can someone give me an example on how to write an API call for searching cards edited recently. Here is my implementation. What is wrong with this?

[https://api.trello.com/1/search?query={5ee0fc79f2168d8f019b76ea}](https://api.trello.com/1/search?query=%7B5ee0fc79f2168d8f019b76ea%7D)

It would be nice if you guys can provide some examples on your website. Thank you. Here is the link.

<https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get>

There is an example towards the bottom of the page, but I am not following it. Only 1 parameter ("query") is required. I also know that "edited:day" is needed to find the cards that were edited recently.

**How do I assemble the complete API call with the filter "edited:day"?** I have been testing my API calls in Postman but nothing seems to work. Thank you.


Answers:
author: Lara
body: Hi there,

Thanks for reaching out!

Firstly, you'll need to authorize with Trello's API at <https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/> so you can have a **key** and **token** which is used to authorize your access to Trello's API.

To specifically call a search query that returns all cards that have been edited in the past day, it would be the following query:

```
https://api.trello.com/1/search?query=test%20edited%3Aday%20&modelTypes=cards&key={key}&token={token}
```

Since the "**edited:day**" filter is a modifier to the query, it must be updated to the query string as such (%20 is a space and %3A is the colon). The key and token would be the values from the authorization process above.

For example:

```
https://api.trello.com/1/search?query=test%20edited%3Aday%20&modelTypes=cards&key=qwertyrandomkeyqwerty&token=1234randomtoken1234
```

Please let us know if you have any other questions, and we'll be happy to help.

All the best,

Lara  
The Trello Team

comments: author: A
body: Hello Lara,

Thank you so much. One more question. If I want to search by List, where should I put it in that link.

In my python code, I loop through each board. On each board, I loop though each list. Once I am inside a list, I want to retrieve the cards that were edited in the last X number of days. The documentation says to search like this:

list:name

However, I don't understand where to insert it in the link. Here is the link for this information.

<https://help.trello.com/article/808-searching-for-cards-all-boards>

Thank you :=)


author: Lara
body: Hi there,

Similarly to the first query, the **list:name** filter is a modifier to the query, so it must be updated to the query string as such (%20 is a space and %3A is the colon). In the example below, **{name}**is the list name.

```
https://api.trello.com/1/search?query=test%20edited%3Aday%20list%3A{name}&modelTypes=cards&key={key}
&token={token}
```

Our team is aware that our modifiers are not well constructed and are working towards improving the search space overall!

Please let us know if you have any other questions, and we'll be happy to help.

All the best,

Lara  
The Trello Team


author: A
body: Thank you, Lara! I appreciate your time and effort in answering my questions.


author: A
body: Hello Lara,

In this call, I noticed:

query=test

What is test?

I am only looking for the cards Updated/Edited AND Created in the last X number of days. X is the number of days depending on my criterion.

Thank you.

```
https://api.trello.com/1/search?query=test%20edited%3Aday%20list%3A{name}&modelTypes=cards&key={key}
&token={token}
```


author: Lara
body: Hi there,

The example "test" you're seeing is the search query. If you don't need a search query, you can just use **edited:day** and **created:day** to find cards that were edited in the past 24 hours, and cards created in the past 24 hours.

```
https://api.trello.com/1/search?query=edited%3Aday%20created%3Aday&modelTypes=cards&key={key}&token={token}
```

Hope that helps!

All the best,

Lara  
The Trello Team


author: A
body: Hi Laura,

Thank you so much. I really appreciate your help. I have one more question. If I want to narrow my search down to a board and a list on that board, how can I do that.

Example:

Name of board: a_board

Name of list: a_list

Simply giving the name of the list is not helpful because there are many boards with same list name. That's why I would like to narrow it down by a board and a list. If we cannot include both modifiers, then I would like to use the List ID as modifier, because that would unique.

Thank you!


author: Lara
body: Hi there,

If you'd like to perform the search for a specific board(s), you'll need to include **idBoard** in your request, and enter the board ID.

For example:

```
https://api.trello.com/1/search?query=edited%3Aday%20&modelTypes=cards&idBoard={boardid}&key={apikey}&token={apitoken}
```

Hope that helps!

All the best,

Lara  
The Trello Team