Link Utilization and Use cases
Overview
Mesh Link SDK allow client applications to connect users to their accounts across brokerages, centralized exchanges, and self-custody wallets. Mesh Link UI handles credential validation, multi-factor authentication, and error handling when connecting to each account.
After an end user authenticates with their account credentials, clients will be passed authentication tokens to provide access to the account which allows client applications to read account information such as holdings, transactions, and balances, and initiate trades and transfers on behalf of the end user.
Getting Your API Keys
You can generate two different API keys (one for Sandbox and another for Production) on the Mesh Dashboard, you should store the API keys immediately after generating them as they will no longer be viewable after leaving the page.
❗️ These API keys should never be stored on your client-side application, always store them securely on your applications backend, following security best practices.
LinkToken Endpoint
This endpoint provides a short-lived, one-time-use token for initializing a Link session, when passed to one of the client side SDKs. Depending on the payload of the API call, the Link UI will load into different workflows, such as user authentication, or asset transfer.
The LinkToken endpoint should always be called from your backend, since it requires an API secret.
Link UI Use Cases
In the next section we will go trough the different ways Link UI can be initialized:
Account Authentication
Basic Account Authentication
The most basic way to initialize Link is to simply pass the UserId
body param. The UserId
is a unique ID representing the end user. This identifier is a map to reference which customers you are logging in through Mesh Link.
POST /api/v1/linktoken body
Direct to Exchange or Brokerage Integration
Many of our customers and UI/UX designers want to launch link directly to a specific integration (eg. Binance or Coinbase) and skip our Full Catalogue. This is easily achieved by including the IntegrationId
param.
The IntegrationId
of the integration you wish to connect can be obtained by calling the Retrieve the list of all available integrations. endpoint and referencing the id
field.
POST /api/v1/linktoken body
Direct to Self Custody Wallet
Many of our customers and UI/UX designers want to load up Link directly to a specific wallet (eg. Metamask) and skip our Full Catalogue. This is easily achieved by including the IntegrationId
param.
The IntegrationId
of the integration you wish to connect can be obtained by calling the Retrieve the list of all available integrations. endpoint and referencing the id
field.
POST /api/v1/linktoken body
Restricting User to Connect only One Account
By default, Link UI lets users authenticate with more than one provider in one session. This is great for portfolio management use cases or when a user wants to transfer from one provider to another within your application. To limit the authentication to one provider, set the RestrictMultipleAccounts param to true.
POST /api/v1/linktoken body
Deposits
Sending Assets to a Single Crypto Address
You can include as many toAddresses
object items, but the most streamlined way for users to transfer assets is to include a single token/network/address combo. Please remember that for each item in the ‘toAddresses’ array, you must provide the Mesh UID for the network to which you are sending the supported token. The comprehensive list of tokens, networks and integrations that can Mesh supports can be found here: Tokens | Networks | Integrations
👍 If only one destination address is provided, the Link UI skips the ‘Select asset’ and ‘Select network’ screens to streamline the user experience.
POST /api/v1/linktoken body - single network and token
Configuring for Multiple Crypto Tokens or Networks
You can include as many toAddresses
object items as needed to enable your users to perform transfers. Each item, represents the symbol they can transfer and the network it could be sent over. Please remember that for each item in the ‘toAddresses’ array, you must provide the Mesh UID for the network to which you are sending the supported token. The comprehensive list of tokens, networks and integrations that can Mesh supports can be found here: Tokens | Networks | Integrations
POST /api/v1/linktoken body - multiple networks/tokens
Sending Assets to a Previously Connected User Account
In the case if the end user has an already connected integration, and you want to move some funds between the users accounts, you can pass the auth_token
when initializing the SDK.
accessTokens
Code Example
transferDestinationTokens
The transferDestinationTokens
are used for crypto transfers flow. It is an alternative way of providing target addresses for crypto transfers by using previously obtained integration auth_tokens
.
The type of the transferDestinationTokens
parameter is an array of IntegrationAccessToken
.
See the type definition on our GitHub.
In this case you need to provide an empty toAddresses
array to the LinkToken endpoint, to indicate that you wish to use the transfers workflow.
POST /api/v1/linktoken body
Payments
Transferring for a Specific Amount
If you’d like to initialize Mesh Link with the transfer amount pre-populated with a supplied destination address, include the assets you want to let the user pay with, plus the destination addresses of those tokens. In the example below, the user can pay with Solana or USDC over Ethereum networks (notice how the network IDs are different).
You can achieve this by providing the AmountInFiat
parameter when calling the LinkToken endpoint
By providing a unique TransactionID
, you’ll be to map a payments to a specific identifier, similar to an order number.
POST /api/v1/linktoken body - multiple networks/tokens
👍 If
AmountInFiat
is included and only a single network/token/address combo is included, Link will skip directly to the preview page, making even more streamlined for a user to complete their transfer.
POST /api/v1/linktoken body - single network and token
Adding a Fee for a Payment
If you’d like to charge a client fee for processing a transfer, you can append the ClientFee
field to the above JSON object examples. This fee should only be used for Payments (when the transfer destination is an address owned by your company), and not for Deposits (when the transfer destination is an address owned by the end-user).
A percentage fee (input as a ratio, eg. 0.02500 = 2.500%) added onto your users’ gross transfer to your company.
This will override any default fee entered in your Mesh dashboard for an individual transaction.
POST /api/v1/linktoken body - multiple networks/tokens
POST /api/v1/linktoken body - single network and token