✍️Lens Profile Details

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

✍ Lens Profile Details

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

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.

Get Lens Profile Details By Farcaster ID

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

Try Demo

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

Code

query MyQuery {
  Socials(
    input: {
      filter: { dappName: { _eq: lens }, 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
      handleTokenAddress
      handleTokenId
      metadataURI
      profileMetadata
      coverImageURI
      twitterUserName
      website
      location
      profileHandle
      profileHandleNft {
        address
      }
      coverImageContentValue {
        image {
          small
        }
      }
      profileImageContentValue {
        image {
          small
        }
      }
    }
  }
}

Get Lens Profile Details By Farcaster Name

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

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: lens }
        identity: { _eq: "fc_fname: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
      handleTokenAddress
      handleTokenId
      metadataURI
      profileMetadata
      coverImageURI
      twitterUserName
      website
      location
      profileHandle
      profileHandleNft {
        address
      }
      coverImageContentValue {
        image {
          small
        }
      }
      profileImageContentValue {
        image {
          small
        }
      }
    }
  }
}

Get Lens Profile Details By 0x address

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

Try Demo

Show all lens profile details and registration info for 0xd8da6bf26964af9d7eed9e03e53415d37aa96045

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: { _eq: lens }
        identity: { _eq: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" }
      }
      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
      handleTokenAddress
      handleTokenId
      metadataURI
      profileMetadata
      coverImageURI
      twitterUserName
      website
      location
      profileHandle
      profileHandleNft {
        address
      }
      coverImageContentValue {
        image {
          small
        }
      }
      profileImageContentValue {
        image {
          small
        }
      }
    }
  }
}

Get Lens 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: lens }, identity: { _eq: "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
      handleTokenAddress
      handleTokenId
      metadataURI
      profileMetadata
      coverImageURI
      twitterUserName
      website
      location
      profileHandle
      profileHandleNft {
        address
      }
      coverImageContentValue {
        image {
          small
        }
      }
      profileImageContentValue {
        image {
          small
        }
      }
    }
  }
}

Get Lens Profile Details By Lens Profile Name

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

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: { dappName: { _eq: lens }, identity: { _eq: "lens/@vitalik" } }
      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
      handleTokenAddress
      handleTokenId
      metadataURI
      profileMetadata
      coverImageURI
      twitterUserName
      website
      location
      profileHandle
      profileHandleNft {
        address
      }
      coverImageContentValue {
        image {
          small
        }
      }
      profileImageContentValue {
        image {
          small
        }
      }
    }
  }
}