Querying the Public API
Build read-only interfaces using the unauthenticated public indexer for token discovery and verification.
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:
curl https://gateway-48587430648.europe-west6.run.app/public/templatesOnly templates marked as "public": true appear here.
Step 2 — Look Up an Object
Retrieve public details for any object by ID:
curl https://gateway-48587430648.europe-west6.run.app/public/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:
# Get recent sequencer checkpoints
curl https://gateway-48587430648.europe-west6.run.app/public/sequencer/checkpoints
# Verify a specific batch
curl https://gateway-48587430648.europe-west6.run.app/public/sequencer/batches/{batchId}Step 4 — Build a Token Explorer
Here's a complete JavaScript snippet that fetches and displays public tokens:
const API = 'https://gateway-48587430648.europe-west6.run.app/public';
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.items.map(obj => ({
id: obj.id,
owner: obj.owner,
properties: obj.properties,
face: obj.faces?.[0]?.meta?.image || null
}))
};
}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.