Related API: Token balance
Fetching User Balances Using Farcaster FID with Neynar API
This API abstracts the complexity of finding Ethereum addresses and querying multiple providers, allowing developers to retrieve balances with a single API call.Overview
-
API Endpoint:
/farcaster/user/balance -
Method:
GET -
Parameters:
fid(required): The Farcaster FID of the user.networks(required): A comma-separated list of networks to fetch balances for. Currently, only “base” is supported.
Prerequisites
- API Key: Ensure you have a Neynar API key. You can obtain one by signing up at neynar.com.
- Node.js SDK: Install the Neynar Node.js SDK.
Fetching User Balances
1
Initialize the Neynar Client
First, set up the Neynar client using your API key.
2
Fetch User Balances
Use the
fetchUserBalance method to retrieve the token balances for a user by their FID.
