Querying the Public API

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

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://api-testnet.dual.network/public/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://api-testnet.dual.network/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:

bash
# Get recent sequencer checkpoints
curl https://api-testnet.dual.network/public/sequencer/checkpoints
# Verify a specific batch
curl https://api-testnet.dual.network/public/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://api-testnet.dual.network/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
}))
};
}

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.