gregsdennis
gregsdennis

Reputation: 8428

How to retrieve all archived cards on a board through the Trello API?

The following question was asked on the Trello API board.

I thought I'd add it here.

How can I obtain all archived cards on a board?

Upvotes: 14

Views: 8158

Answers (2)

gregsdennis
gregsdennis

Reputation: 8428

You can achieve this through use of the [filter] option on the boards endpoint:

/1/boards/[boardId]/cards?filter=closed&key=[your appKey]

It's the filter=closed part that does the trick. It directs the API to only return cards which have been archived. I'm fairly certain it includes cards in archived lists, but I'm not 100% sure.

Upvotes: 16

MS Berends
MS Berends

Reputation: 5239

To elaborate on the previous answer, according to this part of the Trello REST API documentation, possible options for filter are: all, closed, none, open and visible.

So if anyone is looking for a way to get all cards, both archived and not archived, do

https://api.trello.com/1/boards/{board}/cards?filter=all&key={key}&token={token}
# ---------------------------------------------------^^^

For only archived cards:

https://api.trello.com/1/boards/{board}/cards?filter=closed&key={key}&token={token}
# ---------------------------------------------------^^^^^^

Upvotes: 1

Related Questions