API Documentation
This documentation provides the necessary information to integrate with our API and start building
By visiting the API endpoint in your browser, you can explore all available queries, mutations, and types directly.
We will focus here on the core concepts and integration basics.
Endpoints
The API provides two environments: Mainnet for production use and Preview for testing.
Mainnet
https://v2.api.liqwid.finance/graphql
Preview
https://v2.api.preview.liqwid.dev/graphql
Request Headers
When making requests to the API, please include the following header to help us identify your application:
X-App-Source: <app-name>
Get Basic Markets
query GetBasicMarket($input: MarketsInput) {
liqwid {
data {
markets(input: $input) {
page
pagesCount
perPage
totalCount
results {
id
displayName
supplyAPY
borrowAPY
lqSupplyAPY
batching
private
delisting
exchangeRate
receiptAsset {
currencySymbol
}
asset {
price
logo
decimals
currencySymbol
hexName
}
}
}
}
}
}
Input
{
"input": {
"perPage": 20,
"page": 0
}
}
perPage
defaults to 20. If you need more items per request, set a higher perPage
, or iterate pages .
id
String
Unique market identifier
displayName
String
Prettified market name as displayed in Liqwid. E.g: USDC → wanUSDC.
supplyAPY / borrowAPY / lqSupplyAPY
Number
Annual percentage yield values in decimal form. Multiply by 100
to get the percentage.
batching
Boolean
Indicates whether batching is currently happening. If true
, you cannot interact with the market.
private
Boolean
If true
, the market is private and you cannot interact with it.
delisting
Boolean
If true
, the market is being removed. You cannot supply, only repay or withdraw.
exchangeRate
Number
Used to convert qTokens to the underlying asset. Multiply this value by the number of qTokens a user holds to get the equivalent in the base asset.
receiptAsset.currencySymbol
String
PolicyId of the qToken associated with this market.
asset.price
Number
Price of the asset in USD.
asset.logo
String (URL)
URL to the asset’s logo image.
asset.decimals
Number
Number of decimal places for the asset
asset.currencySymbol
String
PolicyId of the asset
asset.hexName
String
Asset name in hexadecimal format
Build a Supply Transaction
query GetSupplyTransactionCBOR($input: SupplyTransactionInput!) {
liqwid {
transactions {
supply(input: $input) {
cbor
}
}
}
}
Input
{
"input": {
"marketId": "",
"amount": 0,
"address": "",
"changeAddress": "",
"otherAddresses": [""],
"utxos": [""]
}
}
marketId
String
The market identifier. Equals markets.results[X].id
.
amount
Number
Amount in base units (no decimals). If you’re pretty-printing amounts, convert back with amountBase = amount * 10 ** markets.results.asset.decimals
.
address
String
Your main payment address (the first from walletApi.getUsedAddresses()
), prettified as a Bech32 addr1…
.
changeAddress
String
Address that will receive the change for this tx (usually the same main address). Bech32 addr1…
.
otherAddresses
String[]
All your addresses (Bech32 addr1…, getUsedAddresses,
getUnusedAddresses
).
utxos
String[]
Returns the UTXOs of your wallet as returned by walletApi.getUtxos()
.
What you receive & how to submit
The resolver returns a CBOR transaction body (cbor
) ready to be signed and submitted.
Option A — Submit via your wallet (CIP-30)
Option B — Submit via our API
mutation SubmitTransaction($input: SubmitTransactionInput!) {
submitTransaction(input: $input)
}
Input
{
"input": {
"signature": "",
"transaction": ""
}
}
signature — the result of
signTx()
transaction — the unsigned transaction CBOR you received from our
supply
query
Build a Withdraw Transaction
query GetWithdrawTransactionCBOR($input: WithdrawTransactionInput!) {
liqwid {
transactions {
withdraw(input: $input) {
cbor
}
}
}
}
Input
{
"input": {
"marketId": "",
"amount": 0,
"address": "",
"changeAddress": "",
"otherAddresses": [],
"utxos": []
}
}
Input fields (same as supply, except amount
)
amount
)All other input fields follow exactly the same rules as for supply:
marketId
, address
, changeAddress
, otherAddresses
, and utxos
.
amount
for withdraw
amount
for withdrawThe user holds qTokens, but
withdraw.amount
expects the asset amount in base units (no decimals).If your UI works in qTokens, convert to asset units with the market’s
exchangeRate
, then to base units usingdecimals
.
Custom Fees
If you need to add a specific fee for a transaction or integration, please create a support ticket in our Discord.
Issues & Complex Integrations
If you encounter any issues or require help with a more complex integration, please create a support ticket in our Discord.
Last updated
Was this helpful?