Integration Guide

Step-by-step guide to integrate TAGBASE verification into your application.

Overview

This guide covers:

  1. Fetching claims for a URL

  2. Displaying verification badges

  3. Implementing ownership verification flow

  4. Handling verification states


Prerequisites

  • Basic knowledge of JavaScript/TypeScript

  • A web application to integrate with

  • No API keys required — the API is public


Step 1: Fetch Claims for a URL

Query the TAGBASE API to check if a URL has any associated claims.

JavaScript Example:

async function fetchClaims(resourceUrl) {
  const response = await fetch(
    `https://api.extension.tagbase.io/claims?resource_url=${encodeURIComponent(resourceUrl)}`
  );
  
  if (!response.ok) {
    throw new Error('Failed to fetch claims');
  }
  
  const data = await response.json();
  return data.claims;
}

// Usage
const claims = await fetchClaims('https://example.com/product/123');
console.log(`Found ${claims.length} claims`);

Step 2: Display Verification Status

Render verification badges based on claim data.

React Example:


Step 3: Implement Ownership Verification

Allow users to prove they own the blockchain token associated with a product.

3.1 Request a Challenge

3.2 Sign with Cardano Wallet (CIP-30)

3.3 Sign with Ethereum Wallet

3.4 Submit Proof


Step 4: Complete Flow Example


Handling Verification States

State
Description
UI Recommendation

No claims

URL has no TAGBASE claims

Show nothing or "Not registered"

Claim exists

Product registered, no ownership proof

Show product info + "Verify Ownership" button

Ownership verified

Valid signature on file

Show verified badge with wallet address

Challenge expired

5-minute window passed

Prompt user to try again

Token not held

Wallet doesn't hold the token

Show error: "Token not in wallet"


Error Handling


Best Practices

  1. Cache claims — Don't fetch on every page load; cache for 5-10 minutes

  2. Handle wallet errors — Users may reject signing or have locked wallets

  3. Show loading states — Blockchain operations can take a few seconds

  4. Validate before submission — Check challenge hasn't expired before signing

  5. Graceful degradation — If API is unavailable, don't break your UI

Last updated