Accessing archived Items in a board via monday API

I am looking for accessing archived items from an active board (not archived board) via Monday API (not via UI). How do I do that?
I see that on the manual Item has a field called “state” which provides the state of the board. So it is always active in this scenario as I have only archived single item. Any help is greatly appreciated.

1 Like

Hi @spb,

There is no value for state in the argument to query items which means you can’t filter based on the item state.

You would need to collect all items, and then filter by state in your application logic.

1 Like

Hey @mitchell.hudson ,

Thanks for helping out here! :slight_smile: We really appreciate your assistance throughout the community.

-Alex

Hi @mitchell.hudson/@AlexSavchuk,
Correct. But what I am saying is, let’s say I archive an item like this:


Now those items can be seen here on UI

But when I query on API to get all the items:

{
       "query": "{boards(ids:xxxxxx){ items() { id name group { title}  state }  } }"
 }

I cant see those archived data.

I also tried to do this:

   {
          "query": "{boards(ids:xxxxxx,state:all){ items() { id name group { title}  state }  } }"
    }

I know this is query is to include archived and deleted boards as well (not archived items in an active board). But I still went ahead and tried. But I still cant find the archived items.
What should be the correct query?

@spb

I have just done a bit of testing, and it seems you are correct. The boards query does not return archived items. I don’t see a way to alter the default behaviour of this as this stage.

I have found two other workarounds, however they do both have limitations.
The first is using the `items_by_column_values’ query.

{
  items_by_column_values(state: archived, board_id: BOARD_ID, column_id:"COLUMN_ID", column_value:"COLUMN_VALUE") {
    id
    state
    board {
      id
    }
  }
}

This does require a column_id and column_value field in the query. You could potentially have a hidden column on the board and then query this value, you would set a default value or just make it null and query this. This option is probably better as you can filter by board.

The other option is to use the items query.

This would essentially return all items in your monday account, and then you would need to filter them by state and board in your application logic, this would be pretty expensive as you would need to make multiple API calls and loop over every item just to filter the results.

@AlexSavchuk Do you have any other ideas on how to achieve this?

As there is an option for a state argument on the boards query, this may be something that is implemented at a later date.

2 Likes

I am having the same issues with not being able to query archived groups as well. Boosting the signal for Monday.com support.

Hey @mitchell.hudson / @arnold_wikey - my apologies for the delay on getting back on this.

As you’ve seen this isn’t something that is possible right now. The ‘boards’ query does have an argument for the state of the items, but at this time it is not able to pull archived items. It’s something we’ve passed along to our developers internally as feedback, as we too would like to see the ability to query archived items in the future. That being said, I can’t really offer an ETA on this at the moment.

The closest workaround at the moment would be something like what Mitchell listed above using either the column values or items query, although both do have limitations.

Let me know if I can assist with anything else.

-Daniel