Comment on page
🆔
Resolve Lens Profiles
Learn how to resolve Lens profiles to 0x address, ENS, Farcaster, and XMTP and Reverse Resolution.
In this guide you will learn how to use Airstack to:
- Basic knowledge of GraphQL
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
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 (data) {
return <p>Data: {JSON.stringify(data)}</p>;
}
if (loading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {error.message}</p>;
}
};
import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await 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.
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)
You can resolve an array of Lens profile(s) to their 0x addresses:
https://app.airstack.xyz/DTyOZg/UEnpGZrGhp
Show 0x addresses of lens/@nader and Lens profile id 0x0187b3
Query
Response
query GetAddressesOfLens {
Socials(
input: {
filter: {
identity: { _in: ["lens/@nader", "lens_id:0x0187b3"] }
dappName: { _eq: lens }
}
blockchain: ethereum
}
) {
Social {
profileName
profileTokenId
profileTokenIdHex
userAssociatedAddresses
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"profileName": "lens/@nader",
"profileTokenId": "10402",
"profileTokenIdHex": "0x028a2",
"userAssociatedAddresses": [
"0xb2ebc9b3a788afb1e942ed65b59e9e49a1ee500d"
]
},
{
"profileName": "lens/@vitalik",
"profileTokenId": "100275",
"profileTokenIdHex": "0x0187b3",
"userAssociatedAddresses": [
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
]
}
]
}
}
}
You can resolve an array of Lens profile(s) to their ENS domains:
https://app.airstack.xyz/query/UEnpGZrGhp
Show all ENS domains owned by lens/@bradorbradley and lens profile id 0x0187b3
Query
Response
query GetENSOfLens {
Domains(
input: {
filter: { owner: { _in: ["lens/@bradorbradley", "lens_id:0x0187b3"] } }
blockchain: ethereum
}
) {
Domain {
name
}
}
}
{
"data": {
"Domains": {
"Domain": [
{
"name": "vitalik.eth"
},
{
"name": "bradorbradley.eth"
}
]
}
}
}
You can resolve any 0x address or ENS to their web3 socials, which comprise of Lens and Farcaster:
https://app.airstack.xyz/query/IWRDgNkqlQ
Show web3 socials (Lens, Farcaster) owned by bradorbradley.eth and 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
Query
Response
query GetWeb3SocialsOfLens {
Socials(
input: {
filter: {
identity: {
_in: [
"bradorbradley.eth"
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
]
}
}
blockchain: ethereum
}
) {
Social {
dappName
profileName
profileTokenId
profileTokenIdHex
userId
userAssociatedAddresses
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"dappName": "lens",
"profileName": "lens/@westlakevillage",
"profileTokenId": "99755",
"profileTokenIdHex": "0x0185ab",
"userId": "0x8ec94086a724cbec4d37097b8792ce99cadcd520",
"userAssociatedAddresses": [
"0x8ec94086a724cbec4d37097b8792ce99cadcd520"
]
},
{
"dappName": "farcaster",
"profileName": "vitalik.eth",
"profileTokenId": "53546877787533711135172528420529478392632952428887988304966222706809455509504",
"profileTokenIdHex": "0x0766275746572696e000000000000000000000000000000000000000000000000",
"userId": "5650",
"userAssociatedAddresses": [
"0xadd746be46ff36f10c81d6e3ba282537f4c68077",
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
]
},
{
"dappName": "lens",
"profileName": "lens/@brad",
"profileTokenId": "116598",
"profileTokenIdHex": "0x01c776",
"userId": "0x8ec94086a724cbec4d37097b8792ce99cadcd520",
"userAssociatedAddresses": [
"0x8ec94086a724cbec4d37097b8792ce99cadcd520"
]
},
{
"dappName": "lens",
"profileName": "lens/@bradorbradley",
"profileTokenId": "36",
"profileTokenIdHex": "0x024",
"userId": "0x8ec94086a724cbec4d37097b8792ce99cadcd520",
"userAssociatedAddresses": [
"0x8ec94086a724cbec4d37097b8792ce99cadcd520"
]
},
{
"dappName": "lens",
"profileName": "lens/@vitalik",
"profileTokenId": "100275",
"profileTokenIdHex": "0x0187b3",
"userId": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"userAssociatedAddresses": [
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
]
},
{
"dappName": "lens",
"profileName": "lens/@hanimourra",
"profileTokenId": "116239",
"profileTokenIdHex": "0x01c60f",
"userId": "0x8ec94086a724cbec4d37097b8792ce99cadcd520",
"userAssociatedAddresses": [
"0x8ec94086a724cbec4d37097b8792ce99cadcd520"
]
}
]
}
}
}
You can resolve an array of Lens profile(s) to their Farcaster name and ID, if any:
https://app.airstack.xyz/query/Z1f9IjxWEg
Show Farcasters owned by lens/@betashop9 and lens profile id 0x0187b3
Query
Response
query GetFarcastersOfLens {
Socials(
input: {
filter: {
identity: { _in: ["lens/@betashop9", "lens_id:0x0187b3"] }
dappName: { _eq: farcaster }
}
blockchain: ethereum
}
) {
Social {
profileName
userId
userAssociatedAddresses
}
}
}
{
"data": {
"Socials": {
"Social": [
{
"profileName": "betashop.eth",
"userId": "602",
"userAssociatedAddresses": [
"0x66bd69c7064d35d146ca78e6b186e57679fba249",
"0xeaf55242a90bb3289db8184772b0b98562053559"
]
},
{
"profileName": "vitalik.eth",
"userId": "5650",
"userAssociatedAddresses": [
"0xadd746be46ff36f10c81d6e3ba282537f4c68077",
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
]
}
]
}
}
}
You can check if an array of Lens profile(s) have their XMTP enabled or not:
https://app.airstack.xyz/query/Jj3kxBbxP3
Show if XMTP is enabled for lens/@stani and Lens profile id 0x0187b3
Query
Response
query GetLensOfFarcasters {
XMTPs(
input: {
blockchain: ALL
filter: { owner: { _in: ["lens/@stani", "lens_id:0x0187b3"] } }
}
) {
XMTP {
isXMTPEnabled
owner {
socials(input: { filter: { dappName: { _eq: lens } } }) {
profileName
profileTokenId
profileTokenIdHex
userAssociatedAddresses
}
}
}
}
}
{
"data": {
"XMTPs": {
"XMTP": [
{
"isXMTPEnabled": true,
"owner": {
"socials": [
{
"profileName": "lens/@stani",
"profileTokenId": "5",
"profileTokenIdHex": "0x05",
"userAssociatedAddresses": [
"0x7241dddec3a6af367882eaf9651b87e1c7549dff"
]
},
{
"profileName": "lens/@lilgho",
"profileTokenId": "110056",
"profileTokenIdHex": "0x01ade8",
"userAssociatedAddresses": [
"0x7241dddec3a6af367882eaf9651b87e1c7549dff"
]
},
{
"profileName": "lens/@lensofficial",
"profileTokenId": "47319",
"profileTokenIdHex": "0x0b8d7",
"userAssociatedAddresses": [
"0x7241dddec3a6af367882eaf9651b87e1c7549dff"
]
}
]
}
},
{
"isXMTPEnabled": true,
"owner": {
"socials": [
{
"profileName": "lens/@vitalik",
"profileTokenId": "100275",
"profileTokenIdHex": "0x0187b3",
"userAssociatedAddresses": [
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
]
}
]
}
}
]
}
}
}
If you have any questions or need help regarding resolving identities for Lens profile(s), please join our Airstack's Telegram group.
Last modified 19h ago