Get contracts by trait

Retrieves a list of contracts based on the following traits listed in JSON format - functions, variables, maps, fungible tokens and non-fungible tokens.


GET
/extended/v1/contract/by_trait

Query Parameters

trait_abistring

JSON abi of the trait.

limit?Limit

max number of contracts fetch

Default20
Rangevalue <= 50
offset?Offset

index of first contract event to fetch

Default0

Response Body

curl -X GET "https://api.hiro.so/extended/v1/contract/by_trait?trait_abi=string&limit=20"
fetch("https://api.hiro.so/extended/v1/contract/by_trait?trait_abi=string&limit=20")
package main

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

func main() {
  url := "https://api.hiro.so/extended/v1/contract/by_trait?trait_abi=string&limit=20"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.hiro.so/extended/v1/contract/by_trait?trait_abi=string&limit=20"

response = requests.request("GET", url)

print(response.text)
{
  "limit": 20,
  "offset": 0,
  "results": [
    {
      "tx_id": "string",
      "canonical": true,
      "contract_id": "string",
      "block_height": 0,
      "clarity_version": 0,
      "source_code": "string",
      "abi": "string"
    }
  ]
}
{
  "error": "string",
  "message": "string"
}