Querying the Public API

Build read-only interfaces using the unauthenticated public indexer for token discovery and verification.

10 minBeginner

Prerequisites

  • Basic REST API knowledge
  • A public template ID (or use the demo template)

What You'll Build

DUAL's Public API (indexer) provides read-only access to on-chain data without authentication. This is perfect for building token explorers, verification pages, and public-facing marketplaces. In this tutorial you'll query templates, objects, and sequencer data using only public endpoints.

Step 1 — Discover Public Templates

List all publicly available templates — no auth required:

bash
curl https://blockv-labs.io/pub/templates

Only templates marked as "public": true appear here.

Step 2 — Look Up an Object

Retrieve public details for any object by ID:

bash
curl https://blockv-labs.io/pub/objects/{objectId}

This returns ownership info, properties, and face URLs — everything a viewer needs to render the object.

Step 3 — Query the Sequencer

The sequencer provides on-chain verification data. Query recent batches to see what's been anchored:

bash
# Get recent sequencer checkpoints
curl https://blockv-labs.io/pub/sequencer/checkpoints

# Verify a specific batch
curl https://blockv-labs.io/pub/sequencer/batches/{batchId}

Step 4 — Build a Token Explorer

Here's a complete JavaScript snippet that fetches and displays public tokens:

javascript
const API = 'https://blockv-labs.io/pub';

async function loadPublicTokens(templateId) {
  const template = await fetch(
    "" + API + "/templates/" + templateId + ""
  ).then(r => r.json());

  const objects = await fetch(
    "" + API + "/objects?template_id=" + templateId + "&limit=50"
  ).then(r => r.json());

  return {
    template: template.name,
    tokens: objects.results.map(obj => ({
      id: obj.id,
      owner: obj.owner,
      properties: obj.properties,
      face: obj.faces?.[0]?.meta?.image || null
    }))
  };
}
CORS Enabled: All public API endpoints have CORS enabled, so you can call them directly from browser JavaScript without a backend proxy.

What's Next?

Want AI to build on your platform? Try Building an AI Agent with MCP to connect Claude directly to your DUAL instance.