Examples & Recipes

Copy-pasteable examples for shipped ResolveDB services and hosted records.

Try Public Services

Live DNS Query
dig TXT
Query breakdown:
operation:getparams:quebecresource:weathernamespace:publicversion:v1
dig TXT get.london.weather.public.v1.resolvedb.net +short
dig TXT get.AAPL-x-XNAS.stock.public.v1.resolvedb.net +short
dig TXT get.USD-EUR.forex.public.v1.resolvedb.net +short
dig TXT get.BTC-USD.crypto.public.v1.resolvedb.net +short
dig TXT geoip.ip-8-8-8-8.public.v1.resolvedb.net +short
dig TXT get.100-c-to-f.units.public.v1.resolvedb.net +short
dig TXT get.london.sun.public.v1.resolvedb.net +short
dig TXT get.2024-01-25.moon.public.v1.resolvedb.net +short

Query over HTTPS

curl --get https://doh.resolvedb.io/resolve \
  --data-urlencode "name=get.london.weather.public.v1.resolvedb.net" \
  --data-urlencode "type=TXT"

The JSON response's Answer[].data is DNS presentation text. TXT records can contain several quoted character strings, so concatenate them before parsing. See the DoH JSON guide for a complete decoder.

Discover a Schema

dig TXT info.weather.public.v1.resolvedb.net +short
curl 'https://doh.resolvedb.io/schema?q=weather.public.v1.resolvedb.net'

Schema discovery is available for registered public resources. Private schema lookup is not currently exposed.

Read the Hooli Demo

Hooli is an operator-managed, public-read fixture. It is useful for trying hosted-record response parsing without a token, but customers cannot create or modify the hooli, hooli-staging, or hooli-dev namespaces.

dig TXT get.dark-mode.flags.hooli.v1.resolvedb.net +short

The canonical decoded value is:

{
  "enabled": true,
  "variant": "default"
}

Hooli records use e=b64, so Base64-decode d before parsing JSON.

function parseUqrpJson(txt) {
  const marker = ';d=';
  const index = txt.indexOf(marker);
  if (index === -1) throw new Error('Missing data field');

  const fields = Object.fromEntries(
    txt.slice(0, index).split(';').map((field) => field.split('=', 2)),
  );
  let payload = txt.slice(index + marker.length);
  if (fields.e === 'b64') payload = atob(payload);
  return JSON.parse(payload);
}

Other fixture-backed examples include:

dig TXT get.deploy-v2.flags.hooli.v1.resolvedb.net +short
dig TXT get.settings.config.hooli.v1.resolvedb.net +short
dig TXT get.firmware.hooli.v1.resolvedb.net +short
dig TXT get.homepage.content.hooli.v1.resolvedb.net +short

Create a Private Hosted Record

Create a globally unique namespace first:

curl -X POST https://api.resolvedb.com/api/v1/namespaces \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"namespace":{"name":"acme-catalog"}}'

Create a record. data is strict Base64 and may decode to at most 2,586 bytes. There is no hosted blob fallback or DNS chunk-reassembly protocol.

curl -X POST https://api.resolvedb.com/api/v1/records \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "record": {
      "key": "config.acme-catalog.v1",
      "data": "eyJoZWxsbyI6IndvcmxkIn0=",
      "content_type": "application/json"
    }
  }'

Mint a namespace query token and save the one-time plaintext rdbq value:

curl -X POST https://api.resolvedb.com/api/v1/namespaces/NAMESPACE_ID/query_tokens \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"example-reader","expires_in_days":30}'

Use an encrypted DNS transport because the qname contains a bearer credential:

export RDBQ='rdbq...'
kdig +tls-ca +tls-hostname=dot.resolvedb.io @dot.resolvedb.io \
  TXT "get.auth-${RDBQ}.config.acme-catalog.v1.resolvedb.net"

Private answers always have TTL 0. Rails decodes the REST Base64 before storage; the core independently chooses e=plain or e=b64 when rendering the DNS answer, so always follow the response's e field.

Next Steps