Tatum
Search…
How to store metadata to IPFS and include it in an NFT
Use Tatum's native IPFS integration and free storage to easily upload NFT metadata.
Making NFTs with Tatum is just a matter of a few simple API calls. One very important step in the process is uploading your metadata (image, video, audio file, etc.) to IPFS and including it in your NFT. In this guide, you’ll learn how to do exactly that.

Why IPFS?

The InterPlanetary File System (IPFS) is a distributed file storage system that is perfect for storing NFT metadata. It ensures long-term data resilience and security, and now that Tatum has partnered with NFT.storage, you can store your files on it for free!

How to do it

We’ve built native IPFS integration into our platform, so you just need a couple of API calls to store your metadata.
    1.
    First, upload your metadata (image, video, audio file, etc.) to IPFS using the following API call:
Request
1
curl --request POST \
2
--url https://api-eu1.tatum.io/v3/ipfs \
3
--header 'content-type: multipart/form-data' \
4
--header 'x-api-key: REPLACE_KEY_VALUE' \
5
-F upload=@local_path_to_your_file_e_q_test-356.jpg
Copied!
2. A successful call will return a response that includes an IPFS hash.
1
{
2
"ipfsHash": "bafybeihrumg5hfzqj6x47q63azflcpf6nkgcvhzzm6f6nhic2eg6uvozlq/test-356.jpg"
3
}
Copied!
3. Using this hash, create a JSON metadata scheme in your development environment and save it. The required fields are:
    Name of NFT
    Description of NFT
    IPFS hash
4. Here is an example JSON metadata scheme which is connected to this NFT for reference:
1
{
2
"name": "Lorem Ipsum Dolor Test",
3
"description": "Friendly Lorem OpenSea Creature that enjoys long swims in the ocean.",
4
"image": "ipfs://bafybeihrumg5hfzqj6x47q63azflcpf6nkgcvhzzm6f6nhic2eg6uvozlq/test-356.jpg"
5
}
Copied!
5. Now, upload your saved JSON metadata scheme to IPFS using the same API call as above.
6. Again, a successful upload will return an IPFS hash in the response.
7. Include this hash in the “URL” field of the Mint NFT API call when you mint a new NFT.
1
curl --request POST \
2
--url https://api-eu1.tatum.io/v3/nft/mint \
3
--header 'content-type: application/json' \
4
--header 'x-api-key: REPLACE_KEY_VALUE' \
5
--data '{
6
"chain":"MATIC",
7
"tokenId":"100000",
8
"to":"0x687422eEA2cB73B5d3e242bA5456b782919AFc85",
9
"contractAddress":"0x687422eEA2cB73B5d3e242bA5456b782919AFc85",
10
"url":"ipfs://bafybeidi7xixphrxar6humruz4mn6ul7nzmres7j4triakpfabiezll4ti/metadata.json",
11
"fromPrivateKey":"0x05e150c73f1920ec14caa1e0b6aa09940899678051a78542840c2668ce5080c2"
12
}'
Copied!
And there you have it! You've successfully uploaded your metadata to IPFS, created a JSON metadata scheme containing the URL of the file, uploaded the scheme, and minted an NFT connected to it.
Last modified 1mo ago
Copy link