# Ipfs dag put pinning

**URL:** <https://discuss.ipfs.tech/t/ipfs-dag-put-pinning/2528>\
**Category:** Help\
**Tags:** ipld\
**Created:** [April 8, 2018, 6:21pm UTC](https://discuss.ipfs.tech/t/ipfs-dag-put-pinning/2528 "2018-04-08T18:21:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nezzard](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/nezzard/32/2298_2.png) [@nezzard](https://discuss.ipfs.tech/u/nezzard)\
**Post date:** [April 8, 2018, 6:21pm UTC](https://discuss.ipfs.tech/t/ipfs-dag-put-pinning/2528/1 "2018-04-08T18:21:34Z")

</div>

Hey, can someone asnwer. How to pin a dag? When i doing “ipfs add file” it’s pinning automatically, but how to pin dag hash?

In this article we have example with adding foo and baz to foo.json, so if i add this json with “ipfs dag put foo.json”  
Is child hashesh will keep alive with root hash?

---

<div class="post-metadata">

**Author:** ![jkrone](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jkrone/32/2493_2.png) [@jkrone](https://discuss.ipfs.tech/u/jkrone)\
**Post date:** [April 13, 2018, 10:39pm UTC](https://discuss.ipfs.tech/t/ipfs-dag-put-pinning/2528/2 "2018-04-13T22:39:35Z")

</div>

Hey there, @nezzard. Thanks for your question. What article are you referring to?

There’s a flag for that! All you need is: `ipfs dag put --pin foo.json` 🙂

That’s essentially:

```auto
$ ipfs dag put foo.json
# outputs <hash>
$ ipfs pin add <hash>
# 'pinned <hash>'

```

Pinning `foo.json`’s hash will prevent that dag node from being removed.

* * *

> Is child hashesh will keep alive with root hash?

I don’t know what you mean by child hash here. If I haven’t answered your question, can you say it another way?

**Note that pinning is not yet available in `js-ipfs`.** We are super close to adding it, though. It should be in the next release or two.

---

<div class="post-metadata">

**Author:** ![billaimbibson](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/billaimbibson/32/5262_2.png) [@billaimbibson](https://discuss.ipfs.tech/u/billaimbibson)\
**Post date:** [January 6, 2022, 12:10am UTC](https://discuss.ipfs.tech/t/ipfs-dag-put-pinning/2528/3 "2022-01-06T00:10:57Z")

</div>

Is pinning a DAG supported yet in the IPFS javascript API? Thx
