Skip to main content

Quick Start Guide

Get up and running with IAIndex in under 5 minutes. This guide will walk you through setting up your first IAIndex integration.

Prerequisites

Before you begin, ensure you have:

  • A domain you control
  • Node.js 18+ or Python 3.8+ installed
  • Basic understanding of REST APIs
  • A text editor or IDE

Step 1: Domain Verification

First, verify you own your domain by adding a TXT record to your DNS:

# Install the IAIndex CLI
npm install -g @iaindex/cli

# Generate verification token
iaindex verify init yourdomain.com

This will output a DNS TXT record like:

iaindex-verification=abc123def456...

Add this to your domain's DNS records, then verify:

iaindex verify check yourdomain.com

Step 2: Install the SDK

Choose your preferred language:

npm install @iaindex/sdk

Step 3: Initialize Your Publisher Profile

Create a publisher configuration:

const { IAIndexPublisher } = require('@iaindex/sdk');

const publisher = new IAIndexPublisher({
domain: 'yourdomain.com',
privateKey: process.env.IAINDEX_PRIVATE_KEY,
name: 'Your Publication Name',
contact: 'contact@yourdomain.com'
});

await publisher.initialize();

Step 4: Create Your First Index Entry

Add content to the IAIndex:

const entry = await publisher.createEntry({
url: 'https://yourdomain.com/article-1',
title: 'Your Article Title',
author: 'Author Name',
publishedDate: '2025-01-15T10:00:00Z',
content: 'Article content or summary...',
license: {
type: 'CC-BY-4.0',
terms: 'https://creativecommons.org/licenses/by/4.0/'
}
});

console.log('Entry created:', entry.id);

Step 5: Publish Your Index

Publish your index file to make it discoverable:

// Generate and sign the index
await publisher.generateIndex();

// The index will be saved to ./iaindex.json
// Host this file at: https://yourdomain.com/.well-known/iaindex.json

Step 6: Host the Index File

Upload the generated iaindex.json file to your web server at:

https://yourdomain.com/.well-known/iaindex.json

Ensure it's accessible via HTTPS and returns proper CORS headers:

Access-Control-Allow-Origin: *
Content-Type: application/json

Step 7: Receive Receipts

Set up a webhook endpoint to receive usage receipts:

const express = require('express');
const app = express();

app.post('/webhooks/iaindex/receipt', async (req, res) => {
const receipt = req.body;

// Verify the receipt signature
const isValid = await publisher.verifyReceipt(receipt);

if (isValid) {
console.log('Valid receipt received:', {
contentId: receipt.contentId,
clientId: receipt.clientId,
timestamp: receipt.timestamp
});

// Store the receipt in your database
await storeReceipt(receipt);

res.status(200).json({ received: true });
} else {
res.status(400).json({ error: 'Invalid signature' });
}
});

app.listen(3000);

Next Steps

Congratulations! You've successfully set up IAIndex. Here's what to explore next:

For Publishers

For Developers

For Website Owners

Troubleshooting

DNS Verification Fails

If domain verification fails:

  1. Ensure the TXT record is properly added
  2. Wait 5-10 minutes for DNS propagation
  3. Check with dig TXT yourdomain.com

Index File Not Accessible

If your index file isn't accessible:

  1. Verify the file is at /.well-known/iaindex.json
  2. Check HTTPS is enabled
  3. Ensure proper CORS headers are set
  4. Test with: curl -i https://yourdomain.com/.well-known/iaindex.json

Receipt Verification Fails

If receipts fail verification:

  1. Check the signature algorithm matches
  2. Ensure you're using the correct public key
  3. Verify the timestamp is recent (within 5 minutes)

Support

Need help? Here are your options: