Using Pinata

The amazing thing about hackathons is the range of applications people come up with. Ideas flow freely, and sometimes you stumble across something you hadn’t thought about before. That was the case for us when we were judging the Eth Global NFT Hack competition. An app called MyMuzzay, now called CocoNFT, surprised us with a simple platform that pulled in Instagram posts and minted them as NFTs while storing the asset and metadata on IPFS. They did this by leveraging as many no-code tools as possible, including Zapier.

Brody Berson and Reid Robinson both work at Zapier and were able to build a custom app using the Zapier Developer Platform that would connect to Pinata and allow for easy storage of files on IPFS. For those that are not familiar with Zapier, it is a platform that allows you to connect multiple applications and automate tasks. For example, you could update a spreadsheet from a support chat by connecting Intercom and Google Sheets. Zapier now supports over 3,000 applications on the platform, which means the automation capabilities are nearly endless.

Because Brody and Reid proved it was possible, and because they laid the groundwork for us, we finished up the Pinata Zapier app and made it public. So starting today, you can use Zapier to connect thousands of applications to Pinata with no coding necessary. With that as the backdrop, let’s dive into the tutorial.

The Application

We’re going to build a simple app (with no code or very little code) that will automatically back up your new NFT purchases to IPFS using Pinata. This is an important topic that has gotten quite a bit of attention lately. We’ve talked about the concept of data responsibility in regards to NFTs in the past. This tool will allow you to have complete control over the assets that are associated with the NFTs you own.

This app is not really an app at all though. At least not in the sense that you will have a URL you can visit and see your app. Instead, think of it as your own personal Pinata robot putting in the work to find all the NFTs you own and pin the content to IPFS. This app is a Zap.

For the sake of the tutorial, we’re going to use the Etherscan API to find NFTs owned by a given address. However, you can extend this tool however you’d like.

Before we begin, a couple of things you’ll need:

You’ll also need some NFTs in your wallet for this to work. However, if you don’t have any NFTs currently, you can play around with the Ethereum testnet, buy some fake NFTs, and then you can swap out the Etherscan API with the Etherscan testnet API. I’ll point out the areas to change as we go.


Sign into your Zapier account, sign into your Pinata account, and sign into your Etherscan account. You’ll need to create a Pinata API token for use with Zapier, so we’ll do that first. On the left-side navigation, under the Developer section, click API Keys. Here you’ll create a new API Key. When you do so, you’ll be able to control the scope of the key. You always want to provide just enough access, nothing more. Here’s the access I selected for my key:

We’ll need Zapier to be able to pin files and JSON on our behalf. And we’ll need Zapier to be able to list existing pinned files (though we won’t use that feature in this tutorial).

When you create your key, a modal will display the API Key, API Secret, and the JWT. You’ll need the JWT. So, copy that and store it somewhere safe for now.

Next, you need to create an API key on Etherscan. You can create that key here.

If you’re using testnet, use the Rinkeby testnet and set up your Etherscan account and API Key here. You can also find testnet NFTs on OpenSea here. You’ll need to get some testnet Ethereum tokens, so you’ll have to do a Google search on getting those. There are a variety of ways to do it, but that is outside the scope of this tutorial.

When have your Etherscan API key, save the key with your Pinata JWT.

Now, at Zapier, click the menu and go to “My Zaps”. There, you’ll see a button that will allow you to create a new Zap.

Click Make a Zap and you’ll be prompted to choose an app that you’ll use as your trigger. Now, we’re going to be using Etherscan as our trigger. We want any new NFTs to trigger the Zap. The Zap itself will find the metadata associated with new NFTs and will pin the content to Pinata.

The app we’ll use for our trigger event is going to require a tiny bit of code since no NFT or Ethereum platform has an app on Zapier as of now. But don’t worry, I’ll provide the code snippet. Search for Code by Zapier and choose Run Javascript as your trigger.

When you click continue, you’ll be able to paste in the code that will need to run. Paste the following in:const yourAddress = "YOUR ETHEREUM ADDRESS"
const etherscanApiKey = "YOUR ETHERSCAN API KEY"
const res = await fetch(`${yourAddress}&startblock=0&endblock=999999999&sort=asc&apikey=${etherscanApiKey}`);
const body = await res.json();
const results = body.result;
let mainResult = {}
if(results && results.length > 0) {
const lastTx = results[0];
 if(lastTx) {
  const openSeaRes = await fetch(`${lastTx.contractAddress}/${lastTx.tokenID}`)
  const openSeaBody = await openSeaRes.json()
  mainResult = openSeaBody
return {id: 1, results: mainResult};

If you’re using testnet, replace the OpenSea api URL with and append the rest of the URL just like in the mainnet URL.

In this code, we are using Etherscan’s token transfer API to check for NFT transactions on your Ethereum wallet. This code will only grab the most recent transaction, so the idea is that it will run while you sleep and when a new transaction is found, the metadata will be fetched from OpenSea. That metadata is what we’ll use in the next step of the Zap.

If you have any NFTs in your wallet, you can test the trigger and you’ll get a result that looks something like this:

This next step is where we tell Zapier what to do with the information found in the trigger. You’ll search for an app to use in your action. Search for Pinata. When you’ve found it, you’ll be prompted to authenticate into your account. This is where you can paste in your JWT. That will allow Zapier to access the Pinata account.

Now, you can move on to the setup action step. This step is pretty simple. You’re going to provide the file URL and the filename. These are variables that come from the trigger step. Here’s what my set up looks like:

Now, test this step, and you should see that the file associated with the NFT was pinned to your Pinata account. Don’t believe me? Go back to your account and check the pin manager!

Pretty cool, right?

To turn on the Zap, give it a name in the top-left, and then just flip the toggle switch to on. And you’re done. You now have a bot that will make sure the assets associated with your NFTs are pinned to IPFS and owned by you.

Happy pinning!