Score a wallet (cURL)
curl -sS "https://api.moontask.io/score/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU" \
-H "X-Api-Key: $MOONTASK_API_KEY"
MOONTASK_API_KEY with your key from the partner portal.
Node.js
const BASE = 'https://api.moontask.io';
const KEY = process.env.MOONTASK_API_KEY;
export async function getWalletScore(walletAddress) {
const res = await fetch(`${BASE}/score/${encodeURIComponent(walletAddress)}`, {
headers: { 'X-Api-Key': KEY },
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.message || `Request failed: ${res.status}`);
}
return res.json();
}
Python
import os
import requests
BASE = "https://api.moontask.io"
HEADERS = {"X-Api-Key": os.environ["MOONTASK_API_KEY"]}
def get_wallet_score(wallet: str) -> dict:
# A wallet queried for the first time is scored on the spot, which can
# take up to ~60s - use a generous timeout, not a short one.
r = requests.get(f"{BASE}/score/{wallet}", headers=HEADERS, timeout=60)
r.raise_for_status()
return r.json()
Gating example
const data = await getWalletScore(wallet);
const tier = data?.classification?.tier_numeric;
if (tier == null) {
// Upstream may return partial data; treat missing classification as not eligible
return { status: 'not_eligible' };
}
if (tier > 2) {
return { status: 'rejected', tier: data.classification.tier };
}
return { status: 'allowed', tier: data.classification.tier };