Postman NFT Workspace
Part 1: Generate Dynamic NFT Metadata
Overview
This workspace demonstrates how to generate realistic, randomized NFT metadata using external NPM libraries inside Postman’s Pre-request Script. This serves as the foundational step before pinning the data to IPFS via services like Pinata.
Technologies Used
- Postman Pre-request Script
- External Libraries via
pm.require():
faker: To generate realistic fake names and locations
uuid: To generate unique identifiers
crypto-js: For SHA-256 and HMAC-based hashing
lodash: For sampling and randomization
Address Generation Logic
Instead of requiring MetaMask or Ethereum wallets, you generate a pseudo wallet address using:
const ownerAddress = "0x" + CryptoJS.SHA256(ownerName + timestamp).toString().substring(0, 40);
const { v4: uuidv4 } = pm.require('npm:uuid');
const CryptoJS = pm.require('npm:crypto-js');
const {faker} = pm.require('npm:@faker-js/[email protected]');
const _ = pm.require('npm:lodash');
const colors = ['🔴', '🟠', '🟡', '🟢', '🔵', '🟣', '⚫', '⚪'];
const animals = ['🦁', '🐯', '🐻', '🦊', '🐺', '🦄', '🐉', '🐸'];
const backgrounds = ['🌟', '🌈', '🔥', '❄️', '🌊', '🌙', '☀️', '⭐'];
const ownerName = faker.name.fullName();
const timestamp = Date.now().toString();
const randomSeed = ownerName + timestamp;
const ownerAddress = "0x" + CryptoJS.SHA256(randomSeed).toString().substring(0, 40);
const nftData = {
id: uuidv4(),
name: `${_.sample(animals)} ${faker.name.firstName()}`,
description: \`A magical \${_.sample(['rare', 'epic', 'legendary', 'mythical'])} creature from \${faker.address.city()}\`,
emoji: \`\${_.sample(backgrounds)}\${_.sample(animals)}\${_.sample(colors)}\`,
rarity: _.sample(['Common', 'Rare', 'Epic', 'Legendary']),
power: _.random(1, 100),
creator: ownerName,
owner: {
address: ownerAddress,
acquired_at: new Date().toISOString(),
ownership_proof: CryptoJS.HmacSHA256(ownerAddress + timestamp, "nft_ownership_key").toString()
}
};
pm.collectionVariables.set("metadata", JSON.stringify(nftData));
console.log("🎨 Generated NFT:", nftData);
console.log("🖼️ Created artwork with emoji:", nftData.emoji);
Stored Output
{
"IpfsHash": "QmPWWB8JTeV3jyFd3SA2Sjg81xG1NgrMEks97Xwdmq9ozx",
"PinSize": 2630237,
"Timestamp": "2025-06-28T21:27:31.915Z",
"ID": "08c36afd-9857-44c6-b0d9-af93502b6766",
"Name": "🐺 Anais",
"NumberOfFiles": 1,
"MimeType": "image/jpeg",
"GroupId": null,
"Keyvalues": null
}
Use Case
This metadata is essential for:
- Uploading to IPFS (e.g., via Pinata)
- Creating visual previews
- Displaying on NFT dashboards or explorers
- Minting smart contracts with verifiable metadata
Part 2: Upload Image to IPFS with Metadata (Pinata + Postman)
Objective:
In this step, we upload an NFT image along with its generated metadata to Pinata’s IPFS network using the pinFileToIPFS API.
What We Upload:
Image file (form-data)
Metadata as a JSON object (inside Metadata)
Request Configuration
Method: POST
URL: https://api.pinata.cloud/pinning/pinFileToIPFS
Authorization:
Use API Key and Secret Key from Pinata via Headers:
pinata_api_key: {{your_pinata_api_key}}
pinata_secret_api_key: {{your_pinata_secret_api_key}}
Body → form-data
| Key |
Type |
Value |
Description |
file |
File |
Your NFT image |
The image you want to upload |
Metadata |
Text |
Raw JSON stringified metadata |
NFT metadata from Part 1 |
Test Script(Post-Response)
pm.test("✅ Image uploaded to IPFS", function () {
pm.response.to.have.status(200);
});
if (pm.response.code === 200) {
const response = pm.response.json();
const imageUrl = `https://gateway.pinata.cloud/ipfs/${response.IpfsHash}`;
pm.collectionVariables.set("image_hash", response.IpfsHash);
pm.collectionVariables.set("image_url", imageUrl);
console.log("🔗 Image uploaded! IPFS URL:", imageUrl);
} else {
console.log("❌ Image upload failed:", pm.response.text());
}
Response Bar
{
"IpfsHash": "QmPWWB8JTeV3jyFd3SA2Sjg81xG1NgrMEks97Xwdmq9ozx",
"PinSize": 2630237,
"Timestamp": "2025-06-28T21:27:31.915Z",
"ID": "08c36afd-9857-44c6-b0d9-af93502b6766",
"Name": "🐺 Anais",
"NumberOfFiles": 1,
"MimeType": "image/jpeg",
"GroupId": null,
"Keyvalues": null
}
IpfsHash: The hash for your image (retrievable at https://gateway.pinata.cloud/ipfs/<hash>)
- The uploaded file is also linked with the metadata you passed in
Metadata.
My NFT Link
https://gateway.pinata.cloud/ipfs/QmPWWB8JTeV3jyFd3SA2Sjg81xG1NgrMEks97Xwdmq9ozx
What This Step Completes:
- Image stored on IPFS
- Metadata attached to it via Pinata’s
keyvalues
image_url stored in Postman collection variables for next steps
Part 3: Fetch & Display NFT Metadata from IPFS
Objective:
Use the image_hash stored earlier to retrieve NFT pin details from Pinata and display full metadata, ownership info, and IPFS details inside Postman using Visualizer.
Request Setup
Method: GET
URL: https://api.pinata.cloud/data/pinList?hashContains={{image_hash}}
Replace {{image_hash}} with the collection variable set in Part 2 after image upload.
Headers (same as previous)
| Key |
Value |
pinata_api_key |
Your Pinata API Key |
pinata_secret_api_key |
Your Pinata Secret API Key |
Purpose of This Step
This step fetches the pinning info of the image file and visualizes the corresponding NFT details.
Even though IPFS is a decentralized store, Pinata keeps a record of:
- who pinned it
- what metadata was attached
- date pinned
- and the IPFS CID (
IpfsHash)
Visualization and Post-Reponse
const data = pm.response.json();
const nft = data.rows?.[0] || {};
const imageUrl = `https://gateway.pinata.cloud/ipfs/${nft.ipfs_pin_hash || ''}`;
// Extract owner information from metadata
const metadata = JSON.parse(pm.collectionVariables.get("metadata") || "{}");
const owner = metadata.owner || {};
const template = `
<html>
<body style="font-family: 'Segoe UI', sans-serif; background:#121218; color:#f5f5f5; padding:20px;">
<div style="max-width:700px; margin:0 auto; background:#1e1e2f; padding:25px; border-radius:12px; box-shadow:0 0 15px rgba(0,0,0,0.4);">
<h2 style="text-align:center; color:#00d4aa; margin-bottom:30px;">🖼️ NFT Preview</h2>
<div style="display:flex; flex-wrap:wrap; gap:20px;">
<!-- Left: Image -->
<div style="flex:1 1 250px;">
{{#if imageUrl}}
<img src="{{imageUrl}}" style="width:100%; max-width:300px; border-radius:12px; border:2px solid #00d4aa; object-fit:cover;" />
{{else}}
<div style="width:100%; height:300px; background:#333; border-radius:12px; display:flex; align-items:center; justify-content:center; border:2px dashed #666; color:#999;">
<p>No Image Available</p>
</div>
{{/if}}
</div>
<!-- Right: Metadata -->
<div style="flex:1 1 300px;">
<h3 style="color:#00d4aa; border-bottom:1px solid #333; padding-bottom:5px;">📝 NFT Details</h3>
<p><strong>Name:</strong> {{name}}</p>
<p><strong>Description:</strong> {{description}}</p>
<p><strong>Rarity:</strong> <span style="color:#ffd700;">{{rarity}}</span></p>
<p><strong>Power:</strong> {{power}}</p>
<p><strong>Creator:</strong> {{creator}}</p>
<h3 style="color:#00d4aa; margin-top:20px; border-bottom:1px solid #333; padding-bottom:5px;">👤 Owner Information</h3>
<p><strong>Owner Name:</strong> {{name}}</p>
<p><strong>Owner Address:</strong> <code style="background:#2b2b3d; padding:3px 6px; border-radius:5px;">{{ownerAddress}}</code></p>
<p><strong>Acquired At:</strong> {{acquiredAt}}</p>
</div>
</div>
<!-- Technical Info -->
<div style="margin-top:30px;">
<h3 style="color:#00d4aa; border-bottom:1px solid #333; padding-bottom:5px;">⚙️ Technical Info</h3>
<p><strong>IPFS Hash:</strong> <code style="background:#2b2b3d; padding:3px 6px; border-radius:5px;">{{ipfsHash}}</code></p>
<p><strong>NFT Created:</strong> {{nftCreationTime}}</p>
<p><strong>Pinned Date:</strong> {{pinnedDate}}</p>
<p><strong>NFT ID:</strong> {{nftId}}</p>
</div>
<!-- Ownership Proof -->
<div style="background:#2a2a3e; padding:20px; border-radius:10px; margin-top:30px;">
<h4 style="color:#00d4aa; margin-top:0;">🔐 Ownership Verification</h4>
<p><strong>Ownership Proof:</strong></p>
<code style="background:#1e1e2f; padding:10px; border-radius:6px; font-size:12px; word-break:break-all; display:block;">{{ownershipProof}}</code>
</div>
</div>
</body>
</html>`;
pm.visualizer.set(template, {
imageUrl,
ipfsHash: nft.ipfs_pin_hash || "No hash available",
name: metadata.name || "Unnamed NFT",
description: metadata.description || "No description available",
rarity: metadata.rarity || "Unknown",
power: metadata.power || "N/A",
creator: metadata.creator || "Unknown Creator",
// Owner information
ownerName: owner.name || "Unknown Owner",
ownerAddress: owner.address || "No address available",
acquiredAt: owner.acquired_at ? new Date(owner.acquired_at).toLocaleString() : "Unknown",
ownershipProof: owner.ownership_proof || "No proof available",
// NFT creation and technical info
nftCreationTime: metadata.timestamp ? new Date(metadata.timestamp).toLocaleString() : "Unknown",
pinnedDate: nft.date_pinned ? new Date(nft.date_pinned).toLocaleString() : "Unknown",
nftId: metadata.id || "No ID"
});
Final Outcome
- You fetch the pinned file info using Pinata’s API
- Visualizer renders the NFT image + full metadata beautifully
- You track & verify ownership using hashed pseudo-wallet logic
- Everything is self-contained using Postman’s variables — no backend needed
Summary
This Postman workspace demonstrates a complete flow for creating and managing NFTs using only Postman and Pinata. It includes three parts:
- Metadata Generation – Random NFT metadata is generated using
faker, lodash, and crypto-js libraries, and stored in a collection variable.
- NFT Upload – An image and the generated metadata are uploaded to IPFS using Pinata’s API via
form-data. Dummy metadata is used for demonstration, but users can customize it.
- NFT Retrieval & Visualization – The pinned NFT is retrieved using the IPFS hash, and a custom visualizer displays the NFT’s image, details, and ownership information stored earlier.
This setup requires no external server and offers a hands-on, educational way to understand NFT minting, IPFS storage, and metadata structuring using simple tools.