Skip to main content
GET
/
v1
/
nft
/
rarity
Get NFT rarity
curl --request GET \
  --url https://api.chainbase.online/v1/nft/rarity \
  --header 'x-api-key: <x-api-key>'
import requests

url = "https://api.chainbase.online/v1/nft/rarity"

headers = {"x-api-key": "<x-api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};

fetch('https://api.chainbase.online/v1/nft/rarity', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chainbase.online/v1/nft/rarity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.chainbase.online/v1/nft/rarity"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-api-key", "<x-api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.chainbase.online/v1/nft/rarity")
.header("x-api-key", "<x-api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.chainbase.online/v1/nft/rarity")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'

response = http.request(request)
puts response.read_body
{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "token_id": "<string>",
      "rank": 123,
      "rank_share": 123,
      "score": 123,
      "total_supply": 123,
      "properties": [
        {
          "trait_type": "<string>",
          "value": "<string>",
          "rate": 123,
          "total": 123
        }
      ]
    }
  ],
  "next_page": 123,
  "count": 123
}
{
"code": 123,
"message": "<string>"
}
{
"code": 123,
"message": "<string>"
}
{
"code": 123,
"message": "<string>"
}
{
"code": 123,
"message": "<string>"
}
{
"code": 123,
"message": "<string>"
}
{
"code": 123,
"message": "<string>"
}

Headers

x-api-key
string
required
Example:

"demo"

Query Parameters

chain_id
string
required

chain network id, see list of details

contract_address
string
required

The address of the NFT contract

Pattern: ^0[xX]{1}[a-fA-F0-9]{40}$
token_id
string

NFT token id in hex or num string

rank_min
integer
default:0
rank_max
integer
default:0
page
integer
default:1

The page offset

Required range: x >= 1
limit
integer
default:20
Required range: 1 <= x <= 10000

Response

Successful Response

code
integer
default:0
message
string
default:ok
data
NFTRarity · object[]
next_page
integer
count
integer