Get name zone file

Retrieves the zone file for a specific name.

GET
/v1/names/{name}/zonefile

Path Parameters

namestring

fully-qualified name

Query Parameters

unanchored?boolean

Include data from unanchored (i.e. unconfirmed) microblocks

Defaultfalse

Response Body

Fetch a user's raw zone file. This only works for RFC-compliant zone files. This method returns an error for names that have non-standard zone files.

TypeScript Definitions

Use the response body type in TypeScript.

zonefilestring

Error

TypeScript Definitions

Use the response body type in TypeScript.

errorstring
curl -X GET "https://api.hiro.so//v1/names/bar.test/zonefile?unanchored=true"
fetch("https://api.hiro.so//v1/names/bar.test/zonefile?unanchored=true")
package main

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

func main() {
  url := "https://api.hiro.so//v1/names/bar.test/zonefile?unanchored=true"

  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//v1/names/bar.test/zonefile?unanchored=true"

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

print(response.text)
{
  "zonefile": "$ORIGIN bar.test\n$TTL 3600\n_https._tcp URI 10 1 \"https://gaia.blockstack.org/hub/17Zijx61Sp7SbVfRTdETo7PhizJHYEUxbY/profile.json\"\n"
}
{
  "error": "Invalid name or subdomain"
}