Profile Interests

Learn how to add and remove Profile interests.

Lens API allows Profile owners to set their interests, enabling the experience layer to filter and deliver content that is more engaging and relevant to their audience.

The Lens API supports a variety of interest categories and subcategories. These are hardcoded at the API level and can be found here. They are also provided by the SDKs.

Please note that profile interests are stored off-chain.

The API remains neutral regarding internationalization (i18n) and how you choose to display interests to your users. Therefore, all interests are returned in English, in capitalized format. Words are separated with an underscore (_), and subcategories are separated with a double underscore (__).

Add and Remove Interests

You can add and remove interests from a Profile using the SDKs or the API.

You must be authenticated with a Profile to manage Profile interests. See Profile Login for more information.

Use the useAddProfileInterests hook to add interests to a Profile.

Use the useRemoveProfileInterests hook to remove interests from a Profile.

Available in @lens-protocol/react-web and @lens-protocol/react-native

import {  useAddProfileInterests,  useRemoveProfileInterests,  Profile,  ProfileInterestTypes,} from '@lens-protocol/react-web';
function ProfileInterests({ profile }: { profile: Profile }) {  const { execute: addInterests } = useAddProfileInterests();  const { execute: removeInterests } = useRemoveProfileInterests();
  const handleClick = async (interest: ProfileInterestTypes) => {    const request = {      interests: [interest],    };
    if (profile.interests.includes(interest)) {      await removeInterests(request);    } else {      await addInterests(request);    }  };
  return <button onClick={() => handleClick(ProfileInterestTypes.Business)}>Business</button>;}

For a comprehensive understanding, you can find a full working example here.

That's it—you've learned how to add and remove Profile interests.