TrustLayer API
REST API to verify decentralized identities, look up public trust profiles, and embed live trust badges. All responses are JSON.
Authentication
Pass your API key as a Bearer token. Get one from the API tab in the dashboard.
Authorization: Bearer htl_live_xxxxxxxxxxxxxxxxxxxx
POST /v1/verify — Verify identity
Returns whether a public identity key is human-verified, plus a trust score and risk level.
curl -X POST 'https://klzwvxcxjzhtgqpfyglc.supabase.co/functions/v1/v1-verify' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"identity_id":"BASE64_PUBLIC_KEY"}'
# 200 OK
{
"is_human": true,
"trust_score": 78,
"risk": "low"
}GET /v1/profile — Public profile lookup
Read-only public trust data. No auth required. Cached 60s.
curl 'https://klzwvxcxjzhtgqpfyglc.supabase.co/functions/v1/public-profile?handle=ahmad'
# or by social handle:
curl 'https://klzwvxcxjzhtgqpfyglc.supabase.co/functions/v1/public-profile?platform=x&social=ahmad'
# 200 OK
{
"handle": "ahmad",
"trust_score": 84,
"verifiers": 21,
"proofs": 47,
"badges": ["Trusted","Well-Connected"]
}GET /v1/badge — Embeddable SVG
Returns a dynamic SVG badge. Cache 5 min. Style: flat | dark.
<a href="https://trustlayer.web.id/u/ahmad"> <img src="https://klzwvxcxjzhtgqpfyglc.supabase.co/functions/v1/badge-svg?handle=ahmad" alt="Trust Score" /> </a>
Rate limits
- Starter — 60 req/min, 1,000 req/month
- Pro — 300 req/min, 50,000 req/month
- Enterprise — 1,000 req/min, 500,000 req/month
Headers returned: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After (on 429).
Errors
401 { "error": "Invalid API key" }
402 { "error": "Monthly usage limit exceeded" }
429 { "error": "Rate limit exceeded", "retry_after": 12 }
500 { "error": "Internal server error" }JavaScript SDK
TypeScript SDK — identity verification plus on-chain wallet intelligence:
import { TrustLayer } from 'trustlayer-sdk';
const tl = new TrustLayer('htl_live_xxx');
// 1. Verify a TrustLayer identity
const r = await tl.verify('public_key_base64');
if (r.is_human && r.trust_score >= 60) { /* allow */ }
// 2. Scan ANY wallet — no TrustLayer account required
const scan = await tl.scanWallet('0xB25583Dfae9f70e5b234c4472c93B05Cb4B77aAc');
console.log(scan.trust_score, scan.intelligence.sybil_risk, scan.intelligence.entropy_status);
// 3. One-line sybil / bot gate
const ok = await tl.isTrustworthyWallet('0xabc...', { minScore: 50, maxSybilRisk: 'low' });Browser / Deno — zero-dependency ESM, no build step, no key:
import { scanWallet, isTrustworthyWallet, getProfile }
from 'https://trustlayer.web.id/sdk/trustlayer.js';
const scan = await scanWallet('0xB25583Dfae9f70e5b234c4472c93B05Cb4B77aAc');
// scan.scan_type -> 'cache_hit' | 'live_deep_scan'
// scan.intelligence -> wallet_age_days, chains_active, behavioral_entropy, sybil_cluster_size...
if (await isTrustworthyWallet('0xabc...', { minScore: 50 })) { /* mint / airdrop / vote */ }Wallet intelligence is heuristic on-chain analysis, not KYC. Addresses with fewer than 10 transactions return insufficient_data rather than a guessed verdict. SDK source: src/sdk/trustlayer.ts and /sdk/trustlayer.js. NPM package coming soon.