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

# How to get relevant mints of Farcaster user

> This guide demonstrates how to use the Neynar SDK to fetch all mint actions relevant to a contract address (and optionally tokenId for ERC1155s) given a user's Ethereum address.

Check out this [Getting started guide](/docs/getting-started-with-neynar) to learn how to set up your environment and get an API key.

First, initialize the client:

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

First we fetch the custody address for a user:

<CodeGroup>
  ```javascript Javascript theme={"system"}
  const FID = 3;
  const response = await client.lookupCustodyAddressForUser(FID);
  const custodyAddress = response.result.custodyAddress;
  ```
</CodeGroup>

Then we fetch the relevant mints for the user:

<CodeGroup>
  ```javascript Javascript theme={"system"}
  // Farcats contract address
  const contractAddress = "0x9340204616750cb61e56437befc95172c6ff6606";
  const relevantMints = await client.fetchRelevantMints(
    custodyAddress,
    contractAddress
  );

  console.log(relevantMints);
  ```
</CodeGroup>

Example output:

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

<Info>
  ### Ready to start building?

  Get your subscription at [neynar.com](https://neynar.com) and reach out to us on [Slack](https://neynar.com/slack) with any questions!
</Info>
