# Query ipfs pinned items by date/time

**URL:** <https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676>\
**Category:** Help\
**Tags:** go-ipfs\
**Created:** [March 8, 2024, 1:54pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676 "2024-03-08T13:54:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [March 8, 2024, 1:54pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/1 "2024-03-08T13:54:28Z")

</div>

Hi,  
Is it possible to query ipfs pinned cids by date/time?  
For example return all new cids pinned from 01/JAN/2024 up to now?  
Is it possible to also query unpinned ones in the above date range?

(Specifically BadgerDs which does not use flat files)

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [March 11, 2024, 9:41am UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/2 "2024-03-11T09:41:44Z")

</div>

Not in ipfs.

In cluster, pins have a timestamp entry attached which should correspond to the time that they were added (iirc).

Querying unpinned ones is not possible easily, unless you go into manually parsing the CRDT chain and extracting data from there. But there would be no timestamp attached to those events, and thus time would have to be inferred from other pin events and causality relations to them.

---

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [March 11, 2024, 1:34pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/3 "2024-03-11T13:34:22Z")

</div>

In cluster can we query the pinned ones based on time or we should fetch all data and then filter?

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [March 11, 2024, 6:39pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/4 "2024-03-11T18:39:51Z")

</div>

Fetch all and filter.

---

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [March 21, 2024, 2:29pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/5 "2024-03-21T14:29:41Z")

</div>

the problem with /pins (boht pin ls and allocations) in cluster is that for some reason the created date is updated frequently for the same pin without anything changed! I am not sure why the date keeps being updated.I also tried the ipfsclute rapi in go and for some reason the statusAll does not return the timestamp although all other fields are there! Am I missing something?  
I have repinning enabled but nothing should be happening that would cause a repinning (like going offline and online). how can I check the events log?

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [March 22, 2024, 12:18pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/6 "2024-03-22T12:18:55Z")

</div>

What field are you using? The `timestamp` field in /allocations and the `Created` field in /pins should be equivalent and correspond to the moment the pin was submitted to the consensus layer.

---

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [March 25, 2024, 11:06pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/7 "2024-03-25T23:06:36Z")

</div>

I checked both fields and it seems they keep getting updated for some reason every 15min or so and get a new timestamp without any new activity in the cluster

---

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [March 25, 2024, 11:07pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/8 "2024-03-25T23:07:23Z")

</div>

for now I am parsing the blocks folder directly to find out the pinned items filtered by time instead of relying on the timestamp

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [March 26, 2024, 10:17am UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/9 "2024-03-26T10:17:40Z")

</div>

> [@ehsan6sha](#):
>
> I checked both fields and it seems they keep getting updated for some reason every 15min or so and get a new timestamp without any new activity in the cluster

I checked the code and I’m inclined to think that if the timestamp gets updated it means that the pin is getting re-pinned. Do you have automatic repinning enabled (`disable_repinning = false`) ? Has the pin reached pinned state, is it pinning or does it report errors? Do the dates correspond to the time you are calling the command? Do they update every X minutes but stay stable in between?

---

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [March 28, 2024, 3:08pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/10 "2024-03-28T15:08:15Z")

</div>

yes, I enabled repining. but shouldn’t repinning only happen when something changes in the cluster, like number of nodes goes below min pin, or something?  
Since in my cluster, there is no pinning error and the replication is more htan min replication set for the cluster

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [April 2, 2024, 2:57pm UTC](https://discuss.ipfs.tech/t/query-ipfs-pinned-items-by-date-time/17676/11 "2024-04-02T14:57:41Z")

</div>

Is it repinning though? Do you have a node going offline from time to time and causing general re-allocations? Do all peers connect fine to the rest (any peer could trigger repinnings). The logs should show if things are getting repinned.

Can you disable and see if the date stays stable?
