Skip to main content
Want to reward your Farcaster community with NFTs? This guide shows you how to mint NFTs directly to Farcaster users using their FID (Farcaster ID) instead of wallet addresses.
Wallet ID Required: This endpoint always requires a x-wallet-id header to execute NFT minting transactions.

Currently Limited to Highlight

This API currently only works with NFTs deployed through Highlight on EVM networks. We’re working on expanding support to other NFT platforms, so if you have a specific request let us know.App wallets can be created self-service in the Developer Portal. See Managing Onchain Wallets for setup instructions.

Simulate vs Execute: GET vs POST

The API provides two modes of operation:
  • GET (Simulate): Returns transaction calldata without executing - perfect for previewing costs and validating parameters
  • POST (Execute): Actually executes the mint transaction using your server wallet

Getting Transaction Calldata (Simulate)

Use the GET endpoint to preview what the mint transaction will look like:
const response = await fetch('/farcaster/nft/mint?' + new URLSearchParams({
  nft_contract_address: '0x8F01e875C816eC2C9d94E62E47771EbDB82d9A8B',
  network: 'base-sepolia',
  recipients: JSON.stringify([{ fid: 14206, quantity: 1 }])
}));

const calldata = await response.json();
console.log(calldata[0]);
Example response:
{
  "recipient": {
    "fid": 14206,
    "quantity": 1
  },
  "abi": [...],
  "function_name": "mint",
  "args": [...],
  "to": "0x8F01e875C816eC2C9d94E62E47771EbDB82d9A8B",
  "data": "0x...",
  "value": "0",
  "network": "base-sepolia"
}

Executing the Mint Transaction

To actually mint the NFT, use the POST endpoint with your server wallet:
const response = await fetch('/farcaster/nft/mint', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-wallet-id': 'your-server-wallet-id'
  },
  body: JSON.stringify({
    nft_contract_address: '0x8F01e875C816eC2C9d94E62E47771EbDB82d9A8B',
    network: 'base-sepolia',
    recipients: [{ fid: 14206, quantity: 1 }],
    async: true
  })
});

const result = await response.json();
console.log(result.transactions[0].transaction_hash);

Async vs Sync Execution

You can choose how to handle transaction execution: Set async: false to wait for transaction confirmation and get the receipt:
{
  "transactions": [{
    "transaction_hash": "0xabc...",
    "recipient": { "fid": 14206, "quantity": 1 },
    "receipt": {
      "status": "success",
      "gas_used": "150000",
      "block_number": "12345"
    }
  }]
}

Async Mode

Set async: true to get the transaction hash immediately and check status separately, will not work with large recipient lists:
{
  "transactions": [{
    "transaction_hash": "0xabc...",
    "recipient": { "fid": 14206, "quantity": 1 }
  }]
}

Batch Minting

Mint to multiple Farcaster users in a single API call:
const recipients = [
  { fid: 14206, quantity: 1 },
  { fid: 14207, quantity: 2 },
  { fid: 14208, quantity: 1 }
];

const response = await fetch('/farcaster/nft/mint', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-wallet-id': 'your-server-wallet-id'
  },
  body: JSON.stringify({
    nft_contract_address: '0x8F01e875C816eC2C9d94E62E47771EbDB82d9A8B',
    network: 'base-sepolia',
    recipients,
    async: true
  })
});

const result = await response.json();
// Returns 3 separate transactions
console.log(`Minted to ${result.transactions.length} users`);

App Wallets

App wallets are managed wallets you create in the developer portal and fund with gas tokens. Neynar executes transactions on your behalf. Benefits include:
  • No gas management: We handle gas estimation and payment
  • Reliable execution: Built-in retry logic and error handling
  • FID resolution: Automatically resolves Farcaster IDs to wallet addresses

Getting Set Up

To use this API, you’ll need:
  1. An app wallet created in the Developer Portal (self-service!)
  2. Your x-wallet-id header value (found in the portal)
  3. An NFT contract deployed on Highlight
  4. Native gas tokens on the network of your choosing (fund your wallet address)
See Managing Onchain Wallets for step-by-step setup instructions!

Error Handling

If you don’t include the required x-wallet-id header, you’ll get:
{
  "code": "RequiredField",
  "message": "x-wallet-id header is required"
}
If you don’t have a wallet_id, reach out to get one setup or see the wallet setup guide. Each transaction in batch minting will either succeed with a transaction_hash or fail with an error field.

Next Steps


That’s it! You’re now ready to reward your Farcaster community with NFTs using just their FIDs. Enjoy building! 🚀