Skip to main content
GET
/
v2
/
farcaster
/
user
/
fid
Fetch fresh FID
curl --request GET \
  --url https://api.neynar.com/v2/farcaster/user/fid/ \
  --header 'x-api-key: <api-key>'
{
  "fid": 3
}

Understanding Wallet ID for FID Operations

This endpoint fetches a fresh FID (Farcaster ID) that can be assigned to a new user. When you fetch a FID, Neynar maintains a “shelf” of pre-registered FIDs that are replenished asynchronously via onchain transactions.

Wallet ID (REQUIRED)

The x-wallet-id header is required for this endpoint. You must provide a wallet_id to cover the costs of async FID shelf replenishment.
New to Wallet IDs? See Managing Onchain Wallets to create your app wallet in the developer portal and obtain your x-wallet-id value.

Code Examples

const response = await fetch('https://api.neynar.com/v2/farcaster/user/fid', {
  headers: {
    'x-api-key': 'YOUR_NEYNAR_API_KEY',
    'x-wallet-id': 'your-wallet-id'  // REQUIRED
  }
});

const data = await response.json();
console.log('Fresh FID:', data.fid);

// Use this FID within 10 minutes to register an account

Error Handling

Error: Missing Wallet ID

{
  "code": "RequiredField",
  "message": "x-wallet-id header is required"
}
Solution: Add the x-wallet-id header. See Managing Onchain Wallets for setup instructions.

Error: Invalid Wallet ID

{
  "code": "InvalidWalletId",
  "message": "The provided wallet_id is invalid or not found."
}
Solution: Verify your wallet_id in the Developer Portal or contact support.

Error: Insufficient Wallet Balance

{
  "code": "InsufficientFunds",
  "message": "Wallet does not have enough balance to complete this transaction."
}
Solution: Fund your wallet with more ETH on Optimism.

Important Notes

10 Minute Deadline: After fetching a FID, you must call the register account endpoint within 10 minutes. Otherwise, Neynar will assign this FID to another user.

What Happens Behind the Scenes

  1. You call this endpoint → Neynar returns a pre-registered FID from the shelf
  2. Neynar replenishes → Async onchain transactions register new FIDs to refill the shelf
This architecture ensures fast FID fetching while handling blockchain complexity in the background.

Next Steps

Authorizations

x-api-key
string
header
default:NEYNAR_API_DOCS
required

API key to authorize requests

Headers

x-neynar-experimental
boolean
default:false

Enables experimental features including filtering based on the Neynar score. See docs for more details.

Response

Success

fid
integer<int32>
required

The unique identifier of a farcaster user or app (unsigned integer)

Required range: x >= 0
Example:

3