Midgard Public API (2.8.0)

Download OpenAPI specification:Download

The Midgard Public API queries THORChain and any chains linked via the Bifröst and prepares information about the network to be readily available for public users. The API parses transaction event data from THORChain and stores them in a time-series database to make time-dependent queries easy. Midgard does not hold critical information. To interact with BEPSwap and Asgardex, users should query THORChain directly.

Specification

Documentation

Swagger/OpenAPI 3.0 specification generated documents.

Responses

Swagger File

Returns human and machine readable swagger/openapi specification

Responses

Health Info

Returns an object containing the health response of the API. Meaning of heights:

lastThorNode - Latest block as reported by ThorNode.

lastFetched - Latest block fetched from ThorNode.

lastCommitted - Latest block commited to the DB but not fully processed yet.

lastAggregated - Latest block fully processed and aggregated.

Responses

Response samples

Content type
application/json
{
  • "database": true,
  • "scannerHeight": "string",
  • "inSync": true,
  • "lastThorNode": {
    },
  • "lastFetched": {
    },
  • "lastCommitted": {
    },
  • "lastAggregated": {
    }
}

Pools List

Returns an array containing details for a set of pools

query Parameters
status
string
Enum: "available" "staged" "suspended"

Filter for only pools with this status

period
string
Enum: "1h" "24h" "7d" "30d" "90d" "100d" "180d" "365d" "all"
Example: period=100d

Specifies the base interval from which APY is extrapolated. Default is 30d.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Details of a Pool

Returns details of the pool: depths, price, 24h volume, APY.

path Parameters
asset
required
string
Example: BNB.TOMOB-1E1

pool name

query Parameters
period
string
Enum: "1h" "24h" "7d" "30d" "90d" "100d" "180d" "365d" "all"
Example: period=100d

Specifies the base interval from which APY is extrapolated. Default is 30d.

Responses

Response samples

Content type
application/json
{
  • "asset": "string",
  • "volume24h": "string",
  • "assetDepth": "string",
  • "runeDepth": "string",
  • "assetPrice": "string",
  • "assetPriceUSD": "string",
  • "annualPercentageRate": "string",
  • "poolAPY": "string",
  • "status": "string",
  • "liquidityUnits": "string",
  • "synthUnits": "string",
  • "synthSupply": "string",
  • "units": "string"
}

Pool Statistics

Statistics about the pool. The description of the fields have pointers about the corresponding v2/history location. Visit the history endpoint for drilldowns.

path Parameters
asset
required
string
Example: BNB.TOMOB-1E1

pool name

query Parameters
period
string
Enum: "1h" "24h" "7d" "30d" "90d" "100d" "180d" "365d" "all"
Example: period=24h

Restricts aggregation type fields to the last period only. Default is 30d.

Responses

Response samples

Content type
application/json
{
  • "asset": "string",
  • "status": "string",
  • "assetPrice": "string",
  • "assetPriceUSD": "string",
  • "assetDepth": "string",
  • "runeDepth": "string",
  • "synthUnits": "string",
  • "synthSupply": "string",
  • "liquidityUnits": "string",
  • "units": "string",
  • "toAssetVolume": "string",
  • "toRuneVolume": "string",
  • "swapVolume": "string",
  • "toAssetCount": "string",
  • "toRuneCount": "string",
  • "swapCount": "string",
  • "uniqueSwapperCount": "string",
  • "toAssetAverageSlip": "string",
  • "toRuneAverageSlip": "string",
  • "averageSlip": "string",
  • "toAssetFees": "string",
  • "toRuneFees": "string",
  • "totalFees": "string",
  • "annualPercentageRate": "string",
  • "poolAPY": "string",
  • "addAssetLiquidityVolume": "string",
  • "addRuneLiquidityVolume": "string",
  • "addLiquidityVolume": "string",
  • "addLiquidityCount": "string",
  • "withdrawAssetVolume": "string",
  • "withdrawRuneVolume": "string",
  • "impermanentLossProtectionPaid": "string",
  • "withdrawVolume": "string",
  • "withdrawCount": "string",
  • "uniqueMemberCount": "string"
}

Depth and Price History

Returns the asset and rune depths and price. The values report the state at the end of each interval.

History endpoint has two modes:

  • With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries.

  • Without Interval parameter a single From..To search is performed with exact timestamps.

  • Interval: possible values: 5min, hour, day, week, month, quarter, year.

  • count: [1..400]. Defines number of intervals. Don't provide if Interval is missing.

  • from/to: optional int, unix second.

Possible usages with interval.

  • last 10 days: ?interval=day&count=10
  • last 10 days before to: ?interval=day&count=10&to=1608825600
  • next 10 days after from: ?interval=day&count=10&from=1606780800
  • Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600

Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query.

Possible configurations without interval:

  • exact search for one time frame: ?from=1606780899&to=1608825600
  • one time frame until now: ?from=1606780899
  • from chain start until now: no query parameters
path Parameters
pool
required
string

Return stats for this single pool.

query Parameters
interval
string
Enum: "5min" "hour" "day" "week" "month" "quarter" "year"
Example: interval=day

Interval of calculations

count
integer
Example: count=30

Number of intervals to return. Should be between [1..400].

to
integer <int64>
Example: to=1608825600

End time of the query as unix timestamp. If only count is given, defaults to now.

from
integer <int64>
Example: from=1606780800

Start time of the query as unix timestamp

Responses

Response samples

Content type
application/json
{
  • "meta": {
    },
  • "intervals": [
    ]
}

Earnings History

Returns earnings data for the specified interval.

History endpoint has two modes:

  • With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries.

  • Without Interval parameter a single From..To search is performed with exact timestamps.

  • Interval: possible values: 5min, hour, day, week, month, quarter, year.

  • count: [1..400]. Defines number of intervals. Don't provide if Interval is missing.

  • from/to: optional int, unix second.

Possible usages with interval.

  • last 10 days: ?interval=day&count=10
  • last 10 days before to: ?interval=day&count=10&to=1608825600
  • next 10 days after from: ?interval=day&count=10&from=1606780800
  • Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600

Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query.

Possible configurations without interval:

  • exact search for one time frame: ?from=1606780899&to=1608825600
  • one time frame until now: ?from=1606780899
  • from chain start until now: no query parameters
query Parameters
interval
string
Enum: "5min" "hour" "day" "week" "month" "quarter" "year"
Example: interval=day

Interval of calculations

count
integer
Example: count=30

Number of intervals to return. Should be between [1..400].

to
integer <int64>
Example: to=1608825600

End time of the query as unix timestamp. If only count is given, defaults to now.

from
integer <int64>
Example: from=1606780800

Start time of the query as unix timestamp

Responses

Response samples

Content type
application/json
{
  • "meta": {
    },
  • "intervals": [
    ]
}

Swaps History

Returns swap count, volume, fees, slip in specified interval. If pool is not specified returns for all pools

History endpoint has two modes:

  • With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries.

  • Without Interval parameter a single From..To search is performed with exact timestamps.

  • Interval: possible values: 5min, hour, day, week, month, quarter, year.

  • count: [1..400]. Defines number of intervals. Don't provide if Interval is missing.

  • from/to: optional int, unix second.

Possible usages with interval.

  • last 10 days: ?interval=day&count=10
  • last 10 days before to: ?interval=day&count=10&to=1608825600
  • next 10 days after from: ?interval=day&count=10&from=1606780800
  • Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600

Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query.

Possible configurations without interval:

  • exact search for one time frame: ?from=1606780899&to=1608825600
  • one time frame until now: ?from=1606780899
  • from chain start until now: no query parameters
query Parameters
pool
string

Return history given pool. Returns sum of all pools if missing.

interval
string
Enum: "5min" "hour" "day" "week" "month" "quarter" "year"
Example: interval=day

Interval of calculations

count
integer
Example: count=30

Number of intervals to return. Should be between [1..400].

to
integer <int64>
Example: to=1608825600

End time of the query as unix timestamp. If only count is given, defaults to now.

from
integer <int64>
Example: from=1606780800

Start time of the query as unix timestamp

Responses

Response samples

Content type
application/json
{
  • "meta": {
    },
  • "intervals": [
    ]
}

Total Value Locked History

Returns total pool depths, total bonds, and total value locked in specified interval.

Total Value Locked = Total Bonds + 2 * Total Pool Depths

History endpoint has two modes:

  • With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries.

  • Without Interval parameter a single From..To search is performed with exact timestamps.

  • Interval: possible values: 5min, hour, day, week, month, quarter, year.

  • count: [1..400]. Defines number of intervals. Don't provide if Interval is missing.

  • from/to: optional int, unix second.

Possible usages with interval.

  • last 10 days: ?interval=day&count=10
  • last 10 days before to: ?interval=day&count=10&to=1608825600
  • next 10 days after from: ?interval=day&count=10&from=1606780800
  • Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600

Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query.

Possible configurations without interval:

  • exact search for one time frame: ?from=1606780899&to=1608825600
  • one time frame until now: ?from=1606780899
  • from chain start until now: no query parameters
query Parameters
interval
string
Enum: "5min" "hour" "day" "week" "month" "quarter" "year"
Example: interval=day

Interval of calculations

count
integer
Example: count=30

Number of intervals to return. Should be between [1..400].

to
integer <int64>
Example: to=1608825600

End time of the query as unix timestamp. If only count is given, defaults to now.

from
integer <int64>
Example: from=1606780800

Start time of the query as unix timestamp

Responses

Response samples

Content type
application/json
{
  • "meta": {
    },
  • "intervals": [
    ]
}

Liquidity Changes History

Returns withdrawals and deposits for given time interval. If pool is not specified returns for all pools

History endpoint has two modes:

  • With Interval parameter it returns a series of time buckets. From and To dates will be rounded to the Interval boundaries.

  • Without Interval parameter a single From..To search is performed with exact timestamps.

  • Interval: possible values: 5min, hour, day, week, month, quarter, year.

  • count: [1..400]. Defines number of intervals. Don't provide if Interval is missing.

  • from/to: optional int, unix second.

Possible usages with interval.

  • last 10 days: ?interval=day&count=10
  • last 10 days before to: ?interval=day&count=10&to=1608825600
  • next 10 days after from: ?interval=day&count=10&from=1606780800
  • Days between from and to. From defaults to start of chain, to defaults to now. Only the first 400 intervals are returned: interval=day&from=1606780800&to=1608825600

Pagination is possible with from&count and then using the returned meta.endTime as the From parameter of the next query.

Possible configurations without interval:

  • exact search for one time frame: ?from=1606780899&to=1608825600
  • one time frame until now: ?from=1606780899
  • from chain start until now: no query parameters
query Parameters
pool
string

Return stats for given pool. Returns sum of all pools if missing

interval
string
Enum: "5min" "hour" "day" "week" "month" "quarter" "year"
Example: interval=day

Interval of calculations

count
integer
Example: count=30

Number of intervals to return. Should be between [1..400]

to
integer <int64>
Example: to=1608825600

End time of the query as unix timestamp. If only count is given, defaults to now

from
integer <int64>
Example: from=1606780800

Start time of the query as unix timestamp

Responses

Response samples

Content type
application/json
{
  • "meta": {
    },
  • "intervals": [
    ]
}

Nodes List

Returns a list of Node public keys and adresses.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Network Data

Returns an object containing Network data

Responses

Response samples

Content type
application/json
{
  • "bondMetrics": {
    },
  • "blockRewards": {
    },
  • "activeBonds": [
    ],
  • "standbyBonds": [
    ],
  • "activeNodeCount": "string",
  • "standbyNodeCount": "string",
  • "totalPooledRune": "string",
  • "totalReserve": "string",
  • "nextChurnHeight": "string",
  • "poolActivationCountdown": "string",
  • "poolShareFactor": "string",
  • "bondingAPY": "string",
  • "liquidityAPY": "string"
}

Actions List

List actions along with their related transactions. An action is generated by one or more inbound transactions with the intended action set in the transaction memo. The action may result in one or more outbound transactions. Results are paginated by sets of 50. Filters may be applied to query actions.

query Parameters
address
string
Example: address=tbnb1fj2lqj8dvr5pumfchc7ntlfqd2v6zdxqwjewf5

Comma separated list. Address of sender or recipient of any in/out transaction related to the action.

txid
string
Example: txid=2F624637DE179665BA3322B864DB9F30001FD37B4E0D22A0B6ECE6A5B078DAB4

ID of any in/out tx related to the action