Code examples
Copy-paste snippets for the two things every integration does first —
check a domain, then walk an authenticated list. No SDKs yet; the API
is small enough that 15 lines of fetch / requests does the job.
Domain check — curl
Section titled “Domain check — curl”curl -sG https://api.igregulator.io/v1/check \ --data-urlencode 'domain=paddypower.com' | jqDomain check — JavaScript (fetch)
Section titled “Domain check — JavaScript (fetch)”const res = await fetch( 'https://api.igregulator.io/v1/check?domain=paddypower.com');const { match, confidence } = await res.json();
if (confidence === 'high' || confidence === 'medium') { console.log( `${match.operator} (licensed by ${match.jurisdiction}, ${match.license_number}) — confidence ${confidence}`, );} else { console.log('No confident match found.');}Domain check — Python (requests)
Section titled “Domain check — Python (requests)”import requests
r = requests.get( 'https://api.igregulator.io/v1/check', params={'domain': 'paddypower.com'}, timeout=5,)r.raise_for_status()data = r.json()
match = data.get('match')if match and data['confidence'] in ('high', 'medium'): print(f"{match['operator']} — {match['jurisdiction']} {match['license_number']}" f" (confidence={data['confidence']})")else: print('No confident match.')Walk all UKGC operators — JavaScript
Section titled “Walk all UKGC operators — JavaScript”const KEY = process.env.IGREGULATOR_KEY;const BASE = 'https://api.igregulator.io';
async function* paginate(jurisdiction) { let offset = 0; const limit = 200; while (true) { const r = await fetch( `${BASE}/v1/jurisdictions/${jurisdiction}/operators?limit=${limit}&offset=${offset}`, { headers: { Authorization: `Bearer ${KEY}` } }, ); if (!r.ok) throw new Error(`HTTP ${r.status}`); const body = await r.json(); if (body.operators.length === 0) return; for (const op of body.operators) yield op; offset += body.operators.length; }}
for await (const op of paginate('UKGC')) { console.log(op.slug, op.display_name);}Walk all UKGC operators — Python
Section titled “Walk all UKGC operators — Python”import os, requests
KEY = os.environ['IGREGULATOR_KEY']BASE = 'https://api.igregulator.io'session = requests.Session()session.headers['Authorization'] = f'Bearer {KEY}'
def paginate(jurisdiction): offset, limit = 0, 200 while True: r = session.get( f'{BASE}/v1/jurisdictions/{jurisdiction}/operators', params={'limit': limit, 'offset': offset}, timeout=10, ) r.raise_for_status() rows = r.json()['operators'] if not rows: return for op in rows: yield op offset += len(rows)
for op in paginate('UKGC'): print(op['slug'], op['display_name'])Bulk domain verification — rate-limit aware
Section titled “Bulk domain verification — rate-limit aware”If you’re verifying a list of 500 domains as part of a nightly sweep, authenticate and sleep between requests to stay under the per-second burst cap. Simpler than retry-on-429.
import os, time, requests
KEY = os.environ['IGREGULATOR_KEY']DOMAINS = open('domains.txt').read().splitlines()S = requests.Session()S.headers['Authorization'] = f'Bearer {KEY}'
for d in DOMAINS: r = S.get( 'https://api.igregulator.io/v1/check', params={'domain': d}, timeout=5, ) if r.status_code == 429: reset = int(r.headers.get('X-RateLimit-Reset', 0)) wait = max(1, reset - int(time.time())) time.sleep(wait + 1) r = S.get( 'https://api.igregulator.io/v1/check', params={'domain': d}, timeout=5, ) r.raise_for_status() print(d, r.json()['confidence']) time.sleep(0.05) # 20 req/sec ceiling headroom for Pro