Retrieve Runes Listings with the Runes API

·

The Runes API provides a powerful and efficient way to retrieve detailed listing information for specific Runes tokens on the OKX marketplace. By utilizing this API, developers and traders can programmatically access real-time data on asset listings, including pricing, status, and ownership details. This guide will walk you through the essential components of the API, from the request structure to the response parameters, ensuring you can integrate it seamlessly into your applications.

Understanding the Runes API Endpoint

The core functionality of this API revolves around the GET request method. The designated endpoint for retrieving Runes listings is:

https://web3.okx.com/api/v5/mktplace/nft/runes/get-runes-order-list

This endpoint is specifically designed to fetch order list data for a given Runes token identified by its unique runesId.

Required and Optional Request Parameters

To successfully query the API, you must include specific parameters in your request. The following table outlines all available parameters:

ParameterTypeRequiredDescription
runesIdStringYesThe unique identifier for the Runes token.
cursorStringNoA cursor for pagination, pointing to the specific sorting sequence to retrieve data from (maximum of 1,000 records).
limitIntegerNoThe number of orders to return per page. The default value is 10, and the maximum allowed value is 100.
sortByStringNoThe rule for sorting the orders. The default is unitPriceAsc. Other options include unitPriceDesc, totalPriceAsc, totalPriceDesc, listedTimeAsc, and listedTimeDesc.

The runesId is the only mandatory parameter. The others allow you to control the volume and order of the data returned, which is essential for managing large datasets and user experience.

Interpreting the API Response

A successful API call returns a wealth of information about the listed Runes tokens. The response is formatted in JSON and contains the following parameters:

ParameterTypeDescription
assetIdIntegerA database primary key identifier.
tickerTypeStringIndicates the token type (e.g., "4" for Runes).
tickerIntegerThe name of the token.
tickerIdStringThe unique token ID.
ownerAddressStringThe wallet address of the current owner.
amountStringThe XRC20 amount present in the UTXO.
chainIntegerThe blockchain on which the token resides.
inscriptionNumStringThe inscription number associated with the token.
utxoTxHashStringThe transaction hash of the UTXO.
utxoVoutIntegerThe output index of the UTXO.
utxoValueStringThe value of the UTXO.
txHashStringThe transaction hash.
nameStringThe name of the token.
tickerIconStringA URL link to the token's icon image.
statusIntegerThe current listing status (0: unlisted, 1: listed, 2: pending).
listTimeLongThe timestamp of when the token was listed.
orderIdLongThe unique identifier for the listing order.
confirmationsLongThe number of block confirmations.
currencyStringThe currency used for the total price.
currencyUrlStringA URL associated with the currency.
satPriceBigDecimalThe total price denominated in satoshis.
priceBigDecimalThe total price denominated in BTC.
usdPriceBigDecimalThe total price denominated in US Dollars.
currencyStringThe currency used for the unit price.
currencyUrlStringA URL associated with the unit price currency.
satPriceBigDecimalThe unit price denominated in satoshis.
priceBigDecimalThe unit price denominated in BTC.
usdPriceBigDecimalThe unit price denominated in US Dollars.
unavailableIntegerIndicates if the UTXO contains multiple assets (1 for multiple Atomicals, 2 for multiple protocol assets).
symbolStringThe symbol representing the token.

This detailed response allows for comprehensive analysis of each listed asset, enabling informed trading and portfolio management decisions. 👉 Explore more strategies for analyzing market data

Practical Implementation and Use Cases

Integrating the Runes API into your workflow can significantly enhance your interaction with the Runes marketplace. Here are some common use cases:

To get started, you simply need to construct a HTTP GET request with your desired parameters. Most programming languages have built-in libraries or popular packages (like requests in Python or axios in JavaScript) to handle this task efficiently.

Frequently Asked Questions

What is the primary use of the Runes API?
The primary use is to programmatically retrieve a list of current marketplace listings for a specific Runes token. It provides detailed information on each listing, including owner address, pricing in multiple denominations, and listing status, which is essential for developers building applications on top of the OKX marketplace.

How do I handle pagination for large datasets?
The API supports pagination through the cursor and limit parameters. The cursor points to a specific position in the sorted list of results, allowing you to retrieve the next batch of records in subsequent API calls. The limit parameter controls how many records are returned in a single response, with a maximum of 100.

What does the 'unavailable' status mean in the response?
An unavailable status with a value of 1 indicates that the underlying UTXO contains multiple Atomicals assets. A value of 2 means it contains multiple protocol assets. This is important information as it can affect the fungibility and transferability of the asset.

Can I sort the results by the most recently listed items?
Yes, you can use the sortBy parameter with the value listedTimeDesc to sort the results so that the most recently listed items appear first. Conversely, listedTimeAsc will show the oldest listings first.

Is the USD price provided by the API a real-time value?
The usdPrice field provides the total and unit price converted to US Dollars based on prevailing market rates. While the API aims for accuracy, the precise timing of the rate used should be considered for highly time-sensitive applications.

Do I need an API key to access this endpoint?
The documentation provided does not specify authentication requirements. It is crucial to refer to the official OKX Web3 API documentation for the most current information on authentication, rate limits, and access credentials. 👉 Get advanced methods for API integration