ERC-721 · ERC-1155 · Multi-Chain

NFT API
for AI Agents

Enable your AI agent to autonomously acquire, trade, and manage NFTs across Ethereum, Polygon, Solana, Base, and Arbitrum. From floor price queries to mempool-based mint sniping — all via a single REST API.

View API Docs Get Free API Key
5
Chains
ERC-721
Token Standard
ERC-1155
Multi-Token
SPL
Solana NFTs
<100ms
Ownership Lookup

Why AI Agents Need Native NFT Capabilities

Non-fungible tokens are no longer just profile pictures. They encode ownership of in-game assets, ENS domains, DeFi positions (Uniswap v3 LP positions are ERC-721 tokens), real-world asset certificates, and identity attestations. An agent that can interact with NFTs opens up an entirely new surface area of autonomous action.

Purple Flea's NFT API abstracts away the chain-specific complexity of interacting with ERC-721 and ERC-1155 contracts. You don't need to encode ABI calldata, manage gas estimation for safeTransferFrom, or integrate five different marketplace APIs to get floor prices. The API handles all of that, exposing clean JSON endpoints your agent can call with no additional dependencies.

Agents can use the NFT API to build a wide range of autonomous strategies: hold a collection until the floor rises and auto-sell via limit-floor orders, snipe mint launches by monitoring the mempool, acquire ENS domains for brand or resale, or manage in-game NFT inventories across multiple wallets.

Supported Chains

Ethereum Mainnet Polygon Solana (SPL NFTs) Base Arbitrum One

Cross-chain support means a single agent can manage NFT holdings across all five networks. The API normalizes chain-specific differences: Solana NFTs are handled through the Metaplex standard and queried via the same /nft/balance endpoint as their EVM counterparts.

Key Capabilities

🔎

Ownership Lookup

Query whether a specific wallet address owns a given NFT. Pass contract address + token ID (or Solana mint address). Returns owner address, acquisition block, and transfer history.

🔁

Transfer NFTs

Execute ERC-721 safeTransferFrom and ERC-1155 safeTransferFrom with quantity via API. Gas is estimated automatically. Supports both approval-based and direct transfer flows.

💰

Floor Price Queries

Aggregated floor prices from OpenSea, Blur, and LooksRare. Returns min floor, mean floor, and 24h/7d change. Updated every 60 seconds.

🌐

Token Metadata

Full metadata for any NFT: name, image URL, attributes/traits, rarity rank (within collection), and IPFS/Arweave resolution. Cached for performance.

🆕

Mint Monitoring

Subscribe to upcoming mints by contract address or collection name. Webhook callbacks when mint opens. Configurable auto-mint on trigger.

📊

ERC-1155 Batch Operations

Batch transfers, quantity checks, and balance-of-batch queries for ERC-1155 semi-fungible tokens. Single API call for multi-token operations.

NFT Sniping

Mempool-Based Mint Sniping

Purple Flea monitors the Ethereum and Polygon mempools for mint transactions targeting registered contract addresses. When a mint transaction is detected, the API can automatically submit a competing transaction with higher gas (configurable gas multiplier) to land in the same block.

Sniping is configured per-contract: set a max-mint-price, max-gas-multiplier, and quantity. The agent receives a webhook callback with the transaction hash and minted token IDs once the block is confirmed.

API Endpoints

Endpoint Method Description
/nft/balance GET All NFTs owned by a wallet. Params: address, chain, contract (optional filter)
/nft/owner GET Owner of a specific token. Params: contract, tokenId, chain
/nft/transfer POST Transfer an ERC-721 or ERC-1155 token. Body: from, to, contract, tokenId, quantity (1155)
/nft/floor GET Floor price for a collection. Params: contract or slug. Aggregated from OpenSea + Blur.
/nft/metadata GET Token metadata: image, traits, rarity rank. Params: contract, tokenId, chain
/nft/mint POST Mint from a contract. Body: contract, quantity, maxPrice, gasMultiplier, chain
/nft/snipe/register POST Register a contract for mempool-based auto-mint sniping
/nft/batch-transfer POST ERC-1155 safeBatchTransferFrom. Body: from, to, contract, ids[], amounts[]

Code Examples

Check NFT Balance

javascript List all NFTs owned by an address
const PURPLE_FLEA_KEY = 'pf_your_api_key_here';

async function getNftBalance(walletAddress) {
  const params = new URLSearchParams({
    address: walletAddress,
    chain: 'ethereum'
  });

  const res = await fetch(
    `https://purpleflea.com/api/nft/balance?${params}`,
    { headers: { 'Authorization': `Bearer ${PURPLE_FLEA_KEY}` } }
  );
  const { nfts, total } = await res.json();

  console.log(`Wallet holds ${total} NFTs`);
  nfts.forEach(nft => {
    console.log(`  ${nft.collection_name} #${nft.token_id}`);
  });

  return nfts;
}

Transfer an NFT

javascript Transfer ERC-721 to another wallet
async function transferNft(from, to, contract, tokenId) {
  const res = await fetch('https://purpleflea.com/api/nft/transfer', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${PURPLE_FLEA_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ from: from, to: to, contract: contract, tokenId: tokenId, chain: 'ethereum' })
  });
  const { txHash, status } = await res.json();

  console.log(`Transfer submitted: ${txHash} — status: ${status}`);
  return txHash;
}

Get Collection Floor Price

javascript Query aggregated floor from OpenSea + Blur
async function getFloorPrice(contractAddress) {
  const res = await fetch(
    `https://purpleflea.com/api/nft/floor?contract=${contractAddress}&chain=ethereum`,
    { headers: { 'Authorization': `Bearer ${PURPLE_FLEA_KEY}` } }
  );
  const { floor_eth, floor_usd, change_24h } = await res.json();

  console.log(`Floor: ${floor_eth} ETH ($${floor_usd}) | 24h: ${change_24h}%`);
  return { floor_eth, floor_usd };
}

Register Auto-Mint Snipe

javascript Monitor mempool and auto-mint at launch block
async function registerMintSnipe(contract) {
  const res = await fetch('https://purpleflea.com/api/nft/snipe/register', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${PURPLE_FLEA_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      contract: contract,
      chain: 'ethereum',
      quantity: 2,
      maxMintPriceEth: '0.08',
      gasMultiplier: 1.3,
      // webhook called when mint succeeds
      webhookUrl: 'https://my-agent.example.com/nft-minted'
    })
  });
  const { snipeId, status } = await res.json();
  console.log(`Snipe registered: ${snipeId}`);
}

Agent Use Cases

💸

NFT Portfolio Agents

Monitor floor prices across a collection portfolio. Automatically sell when floor rises above a target multiple of acquisition price.

🏪

Domain NFT Acquisition

Acquire ENS domains and Unstoppable Domains for target keyword names. Monitor expiries and re-register valuable domains.

🎮

Gaming NFT Agents

Autonomously mint, trade, and equip in-game NFT items across blockchain games. Optimize inventory for maximum yield from game economies.

📌

Mint Sniping Bots

Register collections for mempool monitoring and auto-mint at launch with configurable gas strategy. Capture early mints before price discovery.

💏

Royalty Monitoring

Track secondary sales of owned or monitored collections. Verify on-chain royalty payments and alert on wash trading patterns.

💵

LP Position Management

Manage Uniswap v3 LP positions (ERC-721 tokens). Monitor in-range status, collect fees, and rebalance price ranges autonomously.


Related APIs and Tools

The NFT API integrates with Purple Flea's broader ecosystem of agent-native financial tools.