The account linking flow follows few simple steps.

  1. Register a callback URL using a Account Linking button.
  2. Messenger Platform invokes the registered URL when a user starts the account linking flow. The redirect_uri and account_linking_token parameters are appened to the URL callback.
  3. Once linking is complete, redirect users to the location provided by redirect_uri and append a authorization_code parameter to confirm linking.
  4. Optionally retrieve the user's page-scoped ID (PSID) using the account linking endpoint. This step should only be used in special cases when you need the user's PSID as part of the linking process.


URL invoked by Messenger Platform when a user triggers account linking

If account linking is successful, redirect the browser to the redirect_uri specified in your callback to complete the linking flow, and append the authorization_code parameter

If account linking failed, redirect the browser to the redirect_uri specified in your callback but do not append the authorization_code


Parameter Name Description


Redirect URI which will be added by Messenger, you must redirect the browser to this location at the end of the authentication flow.


Short-lived token passed by Messenger which you need to pass back as part of the redirect scheme. This token is only valid for 5 minutes, it is encrypted and unique per user.
You can call the Account Linking endpoint with this token to fetch the corresponding PSID.


Code provided by you to confirm a successful linking. Messenger Platform will pass back this code along with the user's PSID to the account linking callback.
Failing to pass this parameter will cause the linking process to abort.


A successful linking flow triggers the account linking callback to deliver the user's page-scoped ID (PSID).

You must register to the account linking callback event. Not acknowledging this webhook event will cause the linking process to abort.

Account Linking endpoint

In certain cases you need to retrieve the user page-scoped ID (PSID) during the linking flow. To help with this situation we are providing a PSID retrieval endpoint allowing you to fetch the user's PSID given a valid and unexpired account_linking_token.


curl -X GET " \
      &fields=recipient \


  "id": "PAGE_ID",
  "recipient": "PSID"