Hosted Link
Integrate with Link using a Plaid-hosted frontend
Overview
Hosted Link is the easiest and fastest way to integrate with Plaid. With Hosted Link, Plaid hosts the Link experience. Customers can use this link in web browsers or open it in a secure web context within a mobile app, eliminating the need for front-end implementation work. Hosted Link is especially recommended for any mobile integration that is not using the official Plaid SDK. If your Plaid integration uses webviews, we strongly recommend switching to Hosted Link. Hosted Link can also be used to complement in-person interactions; for example, you can send a Hosted Link session to customers who are in-person at a retail location.
Hosted Link is fully compatible with all Plaid products and Link flows, including update mode.
With Link Delivery (beta), Hosted Link can also deliver the URL for the Link session to your users via text or email.
Hosted Link is the preferred frontend integration method for all platforms in which Plaid's native mobile or web SDKs can't be used, including webview-based mobile apps and integrations by embedded clients such as PSPs. For details on using Hosted Link as an embedded client, See Hosted Link for embedded clients.
Benefits of using Hosted Link
- Simplicity: Hosted Link is the easiest way to integrate with Plaid if you are unable to use Plaid's native mobile SDKs. You don't need to build or maintain a front-end component.
- Integration complexity: Since Hosted Link controls the redirections that are required to support OAuth, it removes one complex step to supporting embedded integrations.
- SDK size: Since the flow will be hosted by Plaid, there is no added SDK size to your application.
- Link Recovery: Hosted Link is required to enable Link Recovery (beta). With Link Recovery, users whose Link sessions failed due to temporary institution outages can be automatically notified when the issue has been healed, allowing you to increase Link conversion. For more details, see Link Recovery.
To request access to Hosted Link and/or Link Delivery, contact your Account Manager.
Integration process
Creating a Link token
To start with Hosted Link, call /link/token/create
.
You can provide the following Hosted Link parameters to /link/token/create
:
- Specify a
webhook
endpoint where thepublic_token
will be delivered. Webhooks are strongly recommended when using Hosted Link, as the webhook is the primary means of delivering thepublic_token
, as well as of informing you when your user has completed the Link session. - To have Plaid deliver the link to your user with Link Delivery (beta), set
hosted_link.delivery_method
to eithersms
oremail
. Plaid will contact the user via the information you provide in theuser
object of the request. For example, if you selectedemail
, theuser
object in the request must contain anemail_address
. - To customize the duration of the Hosted Link token lifetime, set
hosted_link.url_lifetime_seconds
. If you don't set this field, the default lifetime for Hosted Links sent by Plaid via SMS is 24 hours, and for links sent via email, it is 7 days. If Plaid isn't delivering the url, the default lifetime is 30 minutes. - To have Plaid redirect the user after they complete the Link flow, set
hosted_link.completion_redirect_uri
to the destination URI. - To indicate that the user will be opening the link in a mobile app in an out-of-process webview (i.e., an
AsWebAuthenticationSession
/SFSafariViewController
or Chrome Custom Tab), sethosted_link.is_mobile_app
totrue
.
Once you’ve been enabled for Hosted Link, every successful response from /link/token/create
will include a hosted_link_url
field. You can send a user to this URL to start the Hosted Link session. Alternatively, if your integration uses both Hosted Link and non-Hosted Link sessions, you can start a non-Hosted Link session using the link_token
instead.
1curl -X POST https://production.plaid.com/link/token/create \2-H 'Content-Type: application/json' \3-d '{4 "client_id": "${PLAID_CLIENT_ID}",5 "secret": "${PLAID_SECRET}",6 "client_name": "Wonderwallet",7 "country_codes": ["US"],8 "redirect_uri": "{{UNIVERSAL_OR_APP_LINK}}",9 "webhook": "https://wonderwallet.com/webhook_receiver",10 "language": "en",11 "user": {12 "client_user_id": "a57d3304",13 "phone_number": "+19162255887"14 },15 "products": ["auth"],16 "hosted_link": {17 "delivery_method": "sms",18 "completion_redirect_uri": "https://wonderwallet.com/redirect",19 "is_mobile_app": false,20 "url_lifetime_seconds": 90021 }22}
1{2 "expiration": "2023-08-18T02:08:03Z",3 "hosted_link_url": "https://secure.plaid.com/link/lp9o97618r1r6p93oon62nr025950ro4s3",4 "link_token": "link-production-4b42163e-6e1c-48bb-a17a-e570405eb9f8",5 "request_id": "kNbPMmLxzBObzpt"6}
Obtaining a public token
In most other Plaid integration methods, upon completion of the Link flow, your frontend code would receive either an onSuccess
or onExit
callback. In Hosted Link, there is no frontend integration required (or possible). You will instead receive information about the Link flow (including the public_token
) via the SESSION_FINISHED
webhook and the /link/token/get
endpoint.
Each time a user completes a Link flow, Plaid will fire a SESSION_FINISHED
webhook that contains information about what caused the session to end, as well as the public token if the session completed successfully. In flows where Link is re-initialized after an OAuth redirect, this webhook will fire exactly once, after the user completes the entire Link flow.
1{2 "webhook_type": "LINK",3 "webhook_code": "SESSION_FINISHED",4 "status": "SUCCESS",5 "link_session_id": "356dbb28-7f98-44d1-8e6d-0cec580f3171",6 "link_token": "link-sandbox-af1a0311-da53-4636-b754-dd15cc058176",7 "public_tokens": [8 "public-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce993d"9 ],10 "environment": "sandbox"11}
You can also call /link/token/get
with the relevant Link token to receive more detailed metadata on sessions started using this Link token. Each Link session includes the time it was started, and (if applicable) the time it finished. Each completed Link session also includes the metadata that would normally be passed to the onSuccess
or onExit
callbacks, including the public_token
for successful sessions.
Detailed session data, including the public token, will also be available from /link/token/get
for six hours after the session has completed. In general, it is recommended to use the webhook to obtain the public token, since it will allow you to get the public token more promptly, but you may want to use /link/token/get
if your integration does not use webhooks, or as a backup mechanism if your system missed webhooks due to an outage.
In /link/token/get
the public_token
is present in both the on_success
object and the results
object. It is recommended to use the results
object, as the older on_success
object does not support the newer Multi-Item Link option, which allows for multiple public tokens to be returned in a single Link session.
1{2 {3 "created_at": "2024-07-29T21:22:13Z",4 "expiration": "2024-07-29T21:52:13Z",5 "link_sessions": [6 {7 "events": [8 {9 "event_id": "c1ccb962-9de0-494c-b85b-e89cdf3b2478",10 "event_metadata": {11 "institution_id": "ins_10",12 "institution_name": "American Express",13 "request_id": "Z9MB4fuMB2TJqgL"14 },15 "event_name": "HANDOFF",16 "timestamp": "2024-07-29T21:23:03Z"17 },18 {19 "event_id": "ff03f1ff-313b-4c2e-997f-83791c7ec432",20 "event_metadata": {21 "institution_id": "ins_10",22 "institution_name": "American Express",23 "request_id": "vyPamzbGPPsQucO"24 },25 "event_name": "OPEN_OAUTH",26 "timestamp": "2024-07-29T21:22:34Z"27 },28 {29 "event_id": "0ea6d0df-1bb0-4e4d-bea5-b3731b7536bf",30 "event_metadata": {31 "institution_id": "ins_10",32 "institution_name": "American Express",33 "request_id": "vyPamzbGPPsQucO"34 },35 "event_name": "TRANSITION_VIEW",36 "timestamp": "2024-07-29T21:22:33Z"37 },38 {39 "event_id": "e14c7b49-82c4-4f0c-a88a-987a62241d34",40 "event_metadata": {41 "institution_id": "ins_10",42 "institution_name": "American Express",43 "request_id": "0jjsLDlMl1VaVxU"44 },45 "event_name": "SELECT_INSTITUTION",46 "timestamp": "2024-07-29T21:22:32Z"47 },48 {49 "event_id": "b9b9f7ce-52bc-470e-801b-b4fa1da98e59",50 "event_metadata": {51 "request_id": "0jjsLDlMl1VaVxU"52 },53 "event_name": "TRANSITION_VIEW",54 "timestamp": "2024-07-29T21:22:23Z"55 },56 {57 "event_id": "e057a92c-eff8-467c-92c2-620109207e87",58 "event_metadata": {59 "request_id": "aHnAMiUzk8HrsNn"60 },61 "event_name": "SKIP_SUBMIT_PHONE",62 "timestamp": "2024-07-29T21:22:22Z"63 },64 {65 "event_id": "f1feedc9-61be-4a42-885c-cb67511473d2",66 "event_metadata": {67 "request_id": "aHnAMiUzk8HrsNn"68 },69 "event_name": "TRANSITION_VIEW",70 "timestamp": "2024-07-29T21:22:21Z"71 },72 {73 "event_id": "f9b49b0b-4259-4a32-860b-653b55ff8736",74 "event_metadata": {75 "request_id": "CGTlWrGRd8WaGa2"76 },77 "event_name": "TRANSITION_VIEW",78 "timestamp": "2024-07-29T21:22:20Z"79 }80 ],81 "finished_at": "2024-07-29T21:23:03.326860787Z",82 "link_session_id": "f3c3b8fe-16c6-4670-8f2b-e8d797aa6e9f",83 "on_success": {84 "metadata": {85 "accounts": [86 {87 "class_type": null,88 "id": "d1rVJdbe1jCE9jE81wlduPlQQejKXeCJnDzyw",89 "mask": "3333",90 "name": "Plaid Credit Card",91 "subtype": "credit card",92 "type": "credit",93 "verification_status": null94 }95 ],96 "institution": {97 "institution_id": "ins_10",98 "name": "American Express"99 },100 "link_session_id": "f3c3b8fe-16c6-4670-8f2b-e8d797aa6e9f",101 "transfer_status": null102 },103 "public_token": "public-sandbox-d1e64436-f033-4302-a469-b90656edf8c7"104 },105 "results": {106 "item_add_results": [107 {108 "accounts": [109 {110 "class_type": null,111 "id": "d1rVJdbe1jCE9jE81wlduPlQQejKXeCJnDzyw",112 "mask": "3333",113 "name": "Plaid Credit Card",114 "subtype": "credit card",115 "type": "credit",116 "verification_status": null117 }118 ],119 "institution": {120 "institution_id": "ins_10",121 "name": "American Express"122 },123 "public_token": "public-sandbox-d1e64436-f033-4302-a469-b90656edf8c7"124 }125 ]126 },127 "started_at": "2024-07-29T21:22:17.0951134Z"128 }129 ],130 "link_token": "link-sandbox-9b48eb4c-7e1b-44e1-b80d-faa1d71cdf5e",131 "metadata": {132 "client_name": "Wonderwallet",133 "country_codes": [134 "US"135 ],136 "initial_products": [137 "transactions"138 ],139 "language": "en",140 "redirect_uri": null,141 "webhook": "https://webhook.site/dc9c138f-75de-4db1-883a-a4add4b7eb7e"142 },143 "request_id": "jBBxxNC842EJNqW"144}
Link session events
To obtain Link session events while using Hosted Link, listen for the EVENTS
webhook, or use /link/token/get
.
Migrating to Hosted Link from other integrations
First, review the Integration process to understand how to launch the Hosted Link flow and the configuration options available.
If you're currently capturing Link session events, migrate to using /link/token/get
to receive Link session events.
If your users will be opening Link sessions inside a native mobile application, launch Hosted Link in an out-of-process webview (i.e., an AsWebAuthenticationSession
/ SFSafariViewController
or Chrome Custom Tab) or an external browser instead of an in-process webview. The host app should manage opening the Hosted Link URL in this out-of-process webview and handle its closure. Without a provided callback, Plaid will show a page after a session ends, instructing users to return to the host app.
The hosted_link.completion_redirect_uri
parameter should be a URL that handles the redirect back to the host app. For example, on iOS using AsWebAuthenticationSession
(on Android you may be using Custom Tabs), the page that loads at the completion_redirect_uri
should redirect to a URL scheme you have pre-configured to close the the AsWebAuthenticationSession
. See the Apple Developer Documentation or Chrome Developer Documentation for more details.
(Optional) Make sure the provided redirect_uri
is a universal link that redirects users back to your app to enable Chase App-to-App authentication. As long as the link opens your application, you don't need to do any additional work to handle it.
iFrame based nested integrations
For nested integrations like iFrames in a customer web page within a merchant webview, shift from capturing events through redirects to using backend events via /link/token/get
. Your merchants should launch Hosted Link in an out-of-process webview or external browser.
Either you or the merchant must add an extra callback parameter to /link/token/create
, allowing Plaid to close the out-of-process webview as needed. You will likely make the /link/token/create
call. Merchants must either obtain a callback from the customer or ensure handling of a specified callback in their code.
Next steps
Once you have obtained a public token, you can integrate via the same process as non-Hosted Link integrations, including calling /item/public_token/exchange
to exchange the public token for an access token.
Testing Hosted Link
You can test Hosted Link in Production or Sandbox. In the Sandbox environment, Plaid will not provide email or SMS Hosted Link delivery.
Pricing
Hosted Link is free; there is no additional fee to use it. If using Link Delivery to deliver Hosted Link sessions, there is a fee for each link sent. For Link Delivery pricing details, contact Sales or your Account Manager.