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.
Check out this Getting started guide to learn how to set up your environment and get an API key.
First, initialize the client:
// npm i @neynar/nodejs-sdk
import { NeynarAPIClient } from "@neynar/nodejs-sdk";
// make sure to set your NEYNAR_API_KEY .env
// don't have an API key yet? get one at neynar.com
const client = new NeynarAPIClient(process.env.NEYNAR_API_KEY);
First we fetch the custody address for a user:
const FID = 3;
const response = await client.lookupCustodyAddressForUser(FID);
const custodyAddress = response.result.custodyAddress;
Then we fetch the relevant mints for the user:
// Farcats contract address
const contractAddress = "0x9340204616750cb61e56437befc95172c6ff6606";
const relevantMints = await client.fetchRelevantMints(
custodyAddress,
contractAddress
);
console.log(relevantMints);
Example output:
{
"mints": [
{
"minter": {
"object": "user",
"fid": 129,
"custody_address": "0xf6fd7deec77d7b1061435585df1d7fdfd4682577",
"username": "phil",
"display_name": "phil",
"pfp_url": "https://i.imgur.com/sx6qqM7.jpg",
"profile": {
"bio": {
"text": "Building @brightmoments - an IRL NFT gallery DAO. https://brightmoments.io | @purple #15",
"mentioned_profiles": []
}
},
"follower_count": 14867,
"following_count": 1146,
"verifications": [
"0x18b7511938fbe2ee08adf3d4a24edb00a5c9b783",
"0x925afeb19355e289ed1346ede709633ca8788b25"
],
"active_status": "active"
},
"tx_hash": "0x2ed2ebb4b048677133eda3a8609bae694d2ba730c7fa2082691f508e711b6075",
"block_number": 17610874,
"contract_address": "0x9340204616750cb61e56437befc95172c6ff6606",
"token_id": "353"
},
// other mints
]
}
It’s that easy to get relevant mints for a Farcaster user!
Ready to start building?
Get your subscription at neynar.com and reach out to us on Slack with any questions!