Links
Comment on page
🔎

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.
In this tutorial, you will learn how to fetch Farcaster user details with various web3 identities.
In this guide you will learn how to use Airstack to:

Pre-requisites

  • An Airstack account (free)
  • Basic knowledge of GraphQL

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm
yarn
pnpm
pip

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

React

yarn add @airstack/airstack-react

Node

yarn add @airstack/node

React

pnpm install @airstack/airstack-react

Node

pnpm install @airstack/node
pip install airstack asyncio
Then, add the following snippets to your code:
React
Node
Python
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 (loading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {error.message}</p>;
}
// Render your component using the data returned by the query
};
import { init, fetchQuery } from "@airstack/airstack-react";
init("YOUR_AIRSTACK_API_KEY");
const query = "YOUR_QUERY"; // Replace with GraphQL Query
const { data, error } = fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = "YOUR_QUERY" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())

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.
Airstack AI (Demo)

Get Farcaster Profile Details By Farcaster ID

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

Try Demo

https://app.airstack.xyz/query/wJN8EPRanE
Show all farcaster profile details and registration info for farcaster user fc_fid:3

Code

Query
Response
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
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": "fc_fname:dwr.eth"
}
]
}
}
}

Get Farcaster Profile Details By Farcaster Name

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

Try Demo

https://app.airstack.xyz/query/k4bu90KgzA
Show all farcaster profile details and registration info for farcaster user fc_fname:dwr.eth

Code

Query
Response
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
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": "fc_fname:dwr.eth"
}
]
}
}
}

Get Farcaster Profile Details By 0x address

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

Try Demo

https://app.airstack.xyz/query/sxRKmMtrFz
Show all farcaster profile details and registration info for 0x74232bf61e994655592747e20bdf6fa9b9476f79

Code

Query
Response
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
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": "fc_fname:dwr.eth"
}
]
}
}
}

Get Farcaster Profile Details By ENS Domain

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

Try Demo

https://app.airstack.xyz/query/7GfIkzc5gx
Show all farcaster profile details and registration info for dwr.eth

Code

Query
Response
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
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": "fc_fname:dwr.eth"
}
]
}
}
}

Get Farcaster Profile Details By Lens Profile Name

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

Try Demo

https://app.airstack.xyz/query/KbcMBVVFsf
Show all farcaster profile details and registration info for danromero.lens

Code

Query
Response
query MyQuery {
Socials(
input: {filter: {dappName: {_eq: farcaster}, identity: {_eq: "danromero.lens"}}, blockchain: ethereum}
) {
Social {
id
chainId
blockchain
dappName
dappSlug
dappVersion
userId
userAddress
userCreatedAtBlockTimestamp
userCreatedAtBlockNumber
userLastUpdatedAtBlockTimestamp
userLastUpdatedAtBlockNumber
userHomeURL
userRecoveryAddress
userAssociatedAddresses
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": "fc_fname:dwr.eth"
}
]
}
}
}

Get Farcaster Profile Details By Lens Profile ID

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

Try Demo

https://app.airstack.xyz/query/2Lzos9c5Rr
Show all farcaster profile details and registration info for lens_id:0x0b46d

Code

Query
Response
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
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": "fc_fname:dwr.eth"
}
]
}
}
}

Bulk Query Farcaster Profile Details

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

Try Demo

https://app.airstack.xyz/query/8A9aPBliCG
Show all farcaster profile details and registration info for fc_fname:dwr.eth and vitalik.eth

Code

Query
Response
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
profileName
profileTokenId
profileTokenAddress
profileCreatedAtBlockTimestamp
profileCreatedAtBlockNumber
profileLastUpdatedAtBlockTimestamp
profileLastUpdatedAtBlockNumber
profileTokenUri
isDefault
identity
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"id": "1ee2f59c97582671b93635aebfc645d40510cbadd6339e532fcaec4295e6e037",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "5650",
"userAddress": "0xadd746be46ff36f10c81d6e3ba282537f4c68077",
"userCreatedAtBlockTimestamp": "2022-11-18T20:44:00Z",
"userCreatedAtBlockNumber": 7977439,
"userLastUpdatedAtBlockTimestamp": "2022-11-18T20:44:00Z",
"userLastUpdatedAtBlockNumber": 7977439,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0xadd746be46ff36f10c81d6e3ba282537f4c68077",
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
],
"profileName": "vitalik.eth",
"profileTokenId": "53546877787533711135172528420529478392632952428887988304966222706809455509504",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-11-18T20:44:00Z",
"profileCreatedAtBlockNumber": 7977439,
"profileLastUpdatedAtBlockTimestamp": "2022-11-18T20:44:00Z",
"profileLastUpdatedAtBlockNumber": 7977439,
"profileTokenUri": "http://www.farcaster.xyz/u/vbuterin.json",
"isDefault": false,
"identity": ""
},
{
"id": "c9067a911d67d849200404f1f7e1cc0b9eff4716e085d244db877dad59982b95",
"chainId": "5",
"blockchain": "ethereum_goerli",
"dappName": "farcaster",
"dappSlug": "farcaster_goerli",
"dappVersion": "goerli",
"userId": "3",
"userAddress": "0x74232bf61e994655592747e20bdf6fa9b9476f79",
"userCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userCreatedAtBlockNumber": 7648814,
"userLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"userLastUpdatedAtBlockNumber": 7648814,
"userHomeURL": "https://www.farcaster.xyz/",
"userRecoveryAddress": "0x0000000000000000000000000000000000000000",
"userAssociatedAddresses": [
"0x74232bf61e994655592747e20bdf6fa9b9476f79",
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
],
"profileName": "dwr.eth",
"profileTokenId": "45442326458118800696824595983775420889468637770166871407996878418806401138688",
"profileTokenAddress": "0xe3be01d99baa8db9905b33a3ca391238234b79d1",
"profileCreatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileCreatedAtBlockNumber": 7648814,
"profileLastUpdatedAtBlockTimestamp": "2022-09-24T03:08:48Z",
"profileLastUpdatedAtBlockNumber": 7648814,
"profileTokenUri": "http://www.farcaster.xyz/u/dwr.json",
"isDefault": false,
"identity": ""
}
]
}
}
}