HomeLabsIPFS PinningAPI/CLI
Getting your pinned content
Jump toUpdate content

How to retrieve your pinned content

Reviewed on 27 November 2023Published on 30 May 2023

Retrieving content using a Kubo client

Once your content is pinned on our service, you can retrieve it via any other Kubo client, compatible with Linux, Mac, and Windows.

  1. Run the following CLI command to initialize your local IPFS node:

    ipfs init
  2. Run the following CLI command to launch the IPFS background process, effectively turning your device into a functioning node in the IPFS network:

    ipfs daemon
    Tip:

    If you wish to use the same terminal for future commands, you need to run ipfs daemon &. This will run the daemon in the background and return control to the terminal.

  3. Run the following command to fetch your content using its CID and store it in a file. Make sure to replace the example values with your own:

    ipfs get <YOUR_PINNED_CID> > myFile
    Note:

    Your content will be stored in a file called myFile.

Retrieving content using an HTTP gateway

There are different ways to access data over the HTTP or HTTPS protocols. You can either use a web browser or the curl command.

Paste the following link into your web browser to retrieve public content via an IPFS gateway. Make sure to replace the example value with your own:

https://ipfs.io/ipfs/<YOUR_PINNED_CID>

Alternatively, run the following curl command to retrieve it via a local client. Also make sure to replace the example value with your own:

curl https://ipfs.io/ipfs/<YOUR_PINNED_CID>

Retrieving content using a Go client

You can also retrieve pinned content via the Go program. To do so, we recommend using the official go-ipfs-api package.

In this case, you need to run an IPFS node (like Kubo) to perform operations with the IPFS network.

package main
import (
"fmt"
"os"
ipfs "github.com/ipfs-pinning/go-ipfs-pinning-api"
)
func main() {
// Where your local node is running on localhost:5001
sh := ipfs.NewShell("localhost:5001")
err := sh.Get("<YOUR_PINNED_CID>", "myFile")
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s", err)
os.Exit(1)
}
}