API Migration

This guide will walk you through the necessary steps to upgrade to the latest versions of the API.


This guide assumes familiarity with Lens Protocol v2 and the Lens API v2.

Changed API Calls

This guide below will list old Lens v2 GraphQL queries and mutations mapped to the new Lens v3 ones. As GraphQL is a type system we will not describe if the request object has changed as you can easily see this on the GraphQL playground. Note we have not integrated actions and rules yet in the API and indexer so they are missing from here for now.

Queries

Restructured

Only listing changes from v2 to v3 and not any new queries.

  • challenge > now a mutation

  • verify > use RSA keys to verify

  • approvedAuthentications > accountAuthentications

  • currentSession > accountCurrentAuthentication

  • ownedHandles > accountUsernames

  • handleToAddress > account

  • feed > timeline

  • feedHighlights > timelineHighlights

  • mutualFollowers > followersYouKnow

  • followStatusBulk > followStatus

  • profiles > accounts

  • profile > account

  • profileInterestsOptions > moved to metadata

  • whoHaveBlocked > accountsBlocked

  • lastLoggedInProfile > lastLoggedInAccount

  • profileManagers > accountManagers

  • profilesManaged > accountsAvailable

  • profileRecommendations > mlAccountRecommendations

  • searchProfiles > searchAccounts

  • publications > posts and postReferences

  • publication > post

  • publicationsTags > postTags

  • publicationBookmarks > postBookmarks

  • whoReactedPublication > postReactions

  • didReactOnPublication > postReactionsStatus

  • explorePublications > mlPostsExplore

  • validatePublicationMetadata > debugPostMetadata

  • forYou > mlPostsForYou

  • searchPublications > searchPosts

  • userRateLimit > accountSponsorLimit

  • lensTransactionStatus > transactionStatus

  • generateModuleCurrencyApprovalData > Not complete yet

  • approvedModuleAllowanceAmount > Not complete yet

  • whoActedOnPublication > Not complete yet

  • supportedOpenActionModules > Not complete yet

  • supportedFollowModules > Not complete yet

  • latestPaidActions > Not complete yet

  • moduleMetadata > Not complete yet

Deprecated

  • profileActionHistory

  • momokaSubmitters

  • momokaSummary

  • momokaTransactions

  • momokaTransaction

  • nfts

  • nftCollections

  • mutualNftCollections

  • nftCollectionOwners

  • popularNftCollections

  • nftGalleries

  • poaps

  • mutualPoaps

  • poapHolders

  • poapEvent

  • defaultProfile

  • claimableProfiles

  • claimableStatus

  • canClaim

  • exploreProfiles

  • invitedProfiles

  • profileAlreadyInvited

  • followRevenues

  • userSigNonces

  • lensProtocolVersion

  • revenueFromPublications

  • revenueFromPublication

  • relayQueues

  • `lensAPIOwnedEOAs

  • generateLensAPIRelayAddress

  • claimTokens

  • claimableTokens

  • txIdToTxHash

Mutations

Restructured

Only listing changes from v2 to v3 and not any new mutations.

  • walletAuthenticationToProfileAuthentication > switchAccount

  • linkHandleToProfile > assignUsernameToAccount

  • unlinkHandleFromProfile > unassignUsernameFromAccount

  • createLinkHandleToProfileTypedData > assignUsernameToAccount

  • createUnlinkHandleFromProfileTypedData > unassignUsernameFromAccount

  • createFollowTypedData > follow

  • createUnfollowTypedData > unfollow

  • setFollowModule > setAccountFollowRule

  • createSetFollowModuleTypedData > setAccountFollowRule

  • postOnMomoka > post

  • commentOnMomoka > post

  • quoteOnMomoka > post

  • mirrorOnMomoka > post

  • createMomokaQuoteTypedData > post

  • createMomokaPostTypedData > post

  • createMomokaCommentTypedData > post

  • createMomokaMirrorTypedData > post

  • addProfileInterests > setAccountMetadata

  • removeProfileInterests > setAccountMetadata

  • dismissRecommendedProfiles > mlDismissRecommendedAccounts

  • setDefaultProfile > lastLoggedInAccount

  • reportProfile > reportAccount

  • peerToPeerRecommend > recommendAccount

  • peerToPeerUnrecommend > undoRecommendedAccount

  • hideManagedProfile > hideManagedAccount

  • unhideManagedProfile > unhideManagedAccount

  • setProfileMetadata > setAccountMetadata

  • createOnchainSetProfileMetadataTypedData > setAccountMetadata

  • createChangeProfileManagersTypedData > addAccountManager, removeAccountManager and updateAccountManager

  • createBlockProfilesTypedData > block

  • createUnblockProfilesTypedData > unblock

  • hidePublication > deletePost

  • hideComment > hideReply

  • unhideComment > unhideReply

  • addPublicationNotInterested > mlAddPostNotInterested

  • undoPublicationNotInterested > mlUndoPostNotInterested

  • addPublicationBookmark > bookmarkPost

  • removePublicationBookmark > undoBookmarkPost

  • removeReaction > undoReaction

  • reportPublication > reportPost

  • postOnchain > post

  • commentOnchain > post

  • quoteOnchain > post

  • mirrorOnchain > post

  • refreshPublicationMetadata > editPost

  • createOnchainPostTypedData > post

  • createOnchainCommentTypedData > post

  • createOnchainQuoteTypedData > post

  • createOnchainMirrorTypedData > post

  • actOnOpenAction > Not complete yet

  • createActOnOpenActionTypedData > Not complete yet

Deprecated

  • broadcastOnMomoka > use post for everything

  • broadcastOnchain

  • legacyCollect

  • createLegacyCollectTypedData

  • createNftGallery

  • updateNftGalleryInfo

  • updateNftGalleryOrder

  • updateNftGalleryItems

  • deleteNftGallery

  • nftOwnershipChallenge

  • claimProfileWithHandle

  • invite

  • idKitPhoneVerifyWebhook

Processes

  • Typed data does not exist anymore its handled all in the mutation response union

  • Momoka does not exist anymore

  • Tx Id does not exist anymore

Seamless Authentication Rollover

In order to provide a seamless transition for users, we have implemented a new authentication mechanism that allows you to refresh tokens from Refresh Token issued by the Lens API v2.

You can call the legacyRolloverRefresh mutation to acquire new authentication tokens.

mutation {  legacyRolloverRefresh(request: { refreshToken: "<legacy-refresh-token>" }) {    ... on AuthenticationTokens {      accessToken      refreshToken      idToken    }
    ... on ForbiddenError {      reason    }  }}

The provided Refresh Token must still be valid. Since they last for 7 days from the time they are issued, this rollover mechanism is a short-term solution to allow for a seamless transition. If you think that most of your app's users will have their Refresh Token expired by the time they try to log-in into your Lens v3 app, you probably can omit this integration and just force users to re-authenticate.

New Features

Explore the Lens v3 documentation for all the new features.