This article is supposed to be a primer on designing a bridge API that integration partners can work with. This article doesn’t aim to educate on how to build RESTful APIs, but we recommend to take a deep look into all the different parts that improve the quality of an API from compression, caching, versioning, following best practices.

As a bridge aggregation protocol we’ve seen and assed many bridge APIs and feel to be in a good position to suggest the following endpoints.

Context

LI.FI integrates all bridges in a backend, requests quotes for the user and parses them in the same way. The user gets a transaction to execute and checks a status endpoint in the LI.FI API which again will forward information of the bridge.

On-Chain the user sends a transaction to the LI.FI Diamond contract, which forwards tokens and parameters to the bridge. The contract needs to be able to verify that the receiver, receiving chain and be update the amount of tokens that will be bridged.

Refunds have to be made to the users wallet, never to the LI.FI contract.

Route discovery

Our system periodically checks which assets, chains, routes are available. This information is used in our routing to decide which tools to query for pricing information. Response times for those endpoints are not that important as they are used in worker jobs.

Quoting

Live price of a

Transfer Status

After an executed a transfer on-chain we will index it and check your API for the bridging status. We periodically call this endpoint to check if the funds were received on the destination chain.

Other optional endpoints