> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mint NFTs for Farcaster Users

> Mint NFTs directly to Farcaster users using their FID with Neynar's server wallets

<Info>
  ### Related API: [Mint NFT](/reference/post-nft-mint)
</Info>

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.

<Warning>
  **Wallet ID Required:** This endpoint always requires a [`x-wallet-id` header](/docs/managing-onchain-wallets) to execute NFT minting transactions.
</Warning>

<Info>
  ### Currently Limited to Highlight

  This API currently only works with NFTs deployed through [Highlight](https://highlight.xyz) on EVM networks. We're working on expanding support to other NFT platforms, so if you have a specific request [let us know](https://t.me/rishdoteth).

  App wallets can be created self-service in the [Developer Portal](https://dev.neynar.com). See [Managing Onchain Wallets](/docs/managing-onchain-wallets) for setup instructions.
</Info>

## 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:

<CodeGroup>
  ```javascript Node.js theme={"system"}
  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]);
  ```
</CodeGroup>

Example response:

```json theme={"system"}
{
  "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:

<CodeGroup>
  ```javascript Node.js theme={"system"}
  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);
  ```
</CodeGroup>

## Async vs Sync Execution

You can choose how to handle transaction execution:

### Sync Mode (Recommended)

Set `async: false` to wait for transaction confirmation and get the receipt:

```json theme={"system"}
{
  "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:

```json theme={"system"}
{
  "transactions": [{
    "transaction_hash": "0xabc...",
    "recipient": { "fid": 14206, "quantity": 1 }
  }]
}
```

## Batch Minting

Mint to multiple Farcaster users in a single API call:

<CodeGroup>
  ```javascript Node.js theme={"system"}
  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`);
  ```
</CodeGroup>

## 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

<Info>
  ### Getting Set Up

  To use this API, you'll need:

  1. An app wallet created in the [Developer Portal](https://dev.neynar.com) (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](/docs/managing-onchain-wallets) for step-by-step setup instructions!
</Info>

## Error Handling

If you don't include the required [`x-wallet-id` header](/docs/managing-onchain-wallets), you'll get:

```json theme={"system"}
{
  "code": "RequiredField",
  "message": "x-wallet-id header is required"
}
```

If you don't have a wallet\_id, [reach out](https://t.me/rishdoteth) to get one setup or see the [wallet setup guide](/docs/managing-onchain-wallets).

Each transaction in batch minting will either succeed with a `transaction_hash` or fail with an `error` field.

## Next Steps

<CardGroup cols={2}>
  <Card title="Manage Your Wallet" href="/docs/managing-onchain-wallets" icon="wallet">
    Fund your wallet and monitor balance
  </Card>

  <Card title="Send Fungibles" href="/reference/send-fungibles-to-users" icon="coins">
    Send tokens to Farcaster users
  </Card>

  <Card title="Create Accounts" href="/docs/how-to-create-a-new-farcaster-account-with-neynar" icon="user-plus">
    Register new Farcaster accounts
  </Card>

  <Card title="Contact Support" href="https://t.me/rishdoteth" icon="telegram">
    Need help? Reach out to our team
  </Card>
</CardGroup>

***

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

Enjoy building! 🚀
