✍ī¸Farcaster Users Details

Learn how to fetch Farcaster user details with 0x address, ENS domain, Farcaster name and ID, and Lens profile name and ID.

Airstack provides easy-to-use APIs for enriching Farcaster applications and integrating on-chain and off-chain data with Farcaster.

Table Of Contents

In this guide you will learn how to use Airstack to:

Pre-requisites

  • An Airstack account

  • Basic knowledge of GraphQL

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

Then, add the following snippets to your code:

import { init, useQuery } from "@airstack/airstack-react";

init("YOUR_AIRSTACK_API_KEY");

const query = `YOUR_QUERY`; // Replace with GraphQL Query

const Component = () => {
  const { data, loading, error } = useQuery(query);

  if (data) {
    return <p>Data: {JSON.stringify(data)}</p>;
  }

  if (loading) {
    return <p>Loading...</p>;
  }

  if (error) {
    return <p>Error: {error.message}</p>;
  }
};

Other Programming Languages

To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.

🤖 AI Natural Language​

Airstack provides an AI solution for you to build GraphQL queries to fulfill your use case easily. You can find the AI prompt of each query in the demo's caption or title for yourself to try.

Get Farcaster Profile Details By Farcaster ID

You can get the Farcaster user profile details by their Farcaster ID:

Try Demo

Show all farcaster profile details and registration info for farcaster user fc_fid:3

Code

query MyQuery {
  Socials(
    input: {
      filter: { dappName: { _eq: farcaster }, identity: { _eq: "fc_fid:3" } }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Get Farcaster Profile Details By Farcaster Name

You can get the Farcaster user profile details by their Farcaster Name:

Try Demo

Show all farcaster profile details and registration info for farcaster user fc_fname:dwr.eth

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: farcaster }
        identity: { _eq: "fc_fname:dwr.eth" }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Get Farcaster Profile Details By 0x address

You can get the Farcaster user profile details by their 0x address:

Try Demo

Show all farcaster profile details and registration info for 0x74232bf61e994655592747e20bdf6fa9b9476f79

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: farcaster }
        identity: { _eq: "0x74232bf61e994655592747e20bdf6fa9b9476f79" }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Get Farcaster Profile Details By ENS Domain

You can get the Farcaster user profile details by their ENS domain:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: { dappName: { _eq: farcaster }, identity: { _eq: "dwr.eth" } }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Get Farcaster Profile Details By Lens Profile Name

You can get the Farcaster user profile details by their Lens profile name:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: farcaster }
        identity: { _eq: "lens/@danromero" }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Get Farcaster Profile Details By Lens Profile ID

You can get the Farcaster user profile details by their Lens profile ID:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: farcaster }
        identity: { _eq: "lens_id:0x0b46d" }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Bulk Query Farcaster Profile Details

You can bulk query the profile details of multiple Farcaster users by their various web3 identities:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: farcaster }
        identity: { _in: ["fc_fname:dwr.eth", "vitalik.eth"] }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

If you want want to get Farcaster user with fid in certain range, e.g. fid 1 to 3, then you can use the fid as an array to the userId input to fetch the data as shown below:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: { dappName: { _eq: farcaster }, userId: { _in: ["1", "2", "3"] } }
      blockchain: ethereum
    }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

For larger range, it is recommended that you generate the array programmatically instead of manually typing them. It is best practice that you keep the size of the array to a maximum length of 200 per API call.

Bulk Query All Farcaster Users Profile Details

You can bulk query the profile details of all Farcaster users:

Try Demo

Code

query MyQuery {
  Socials(
    input: { filter: { dappName: { _eq: farcaster } }, blockchain: ethereum }
  ) {
    Social {
      id
      chainId
      blockchain
      dappName
      dappSlug
      dappVersion
      userId
      userAddress
      userCreatedAtBlockTimestamp
      userCreatedAtBlockNumber
      userLastUpdatedAtBlockTimestamp
      userLastUpdatedAtBlockNumber
      userHomeURL
      userRecoveryAddress
      userAssociatedAddresses
      profileBio
      profileDisplayName
      profileImage
      profileUrl
      profileName
      profileTokenId
      profileTokenAddress
      profileCreatedAtBlockTimestamp
      profileCreatedAtBlockNumber
      profileLastUpdatedAtBlockTimestamp
      profileLastUpdatedAtBlockNumber
      profileTokenUri
      isDefault
      identity
      fnames
      isFarcasterPowerUser
    }
  }
}

Developer Support

If you have any questions or need help regarding fetching Farcaster user(s) profile details, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?