Add API to query for instances and filter by metadata