Troubleshooting
Solutions to common issues when using the Web3 Identity API.
Quick Diagnosticsโ
# Check API status
curl https://api.web3identity.com/api/health
# Check your rate limit status
curl https://api.web3identity.com/api/usage
# Test a simple endpoint
curl https://api.web3identity.com/api/ens/resolve/vitalik.eth
Common Errorsโ
402 Payment Requiredโ
Symptom: API returns 402 after some requests work.
Cause: You've exceeded the free tier (100 calls/day).
Solutions:
- Wait for reset โ Free tier resets daily at midnight UTC
- Authenticate with SIWE โ Doubles limit to 200/day
- Make a payment โ Use x402 to pay per request
// Check your remaining calls
const usage = await fetch('https://api.web3identity.com/api/usage');
const { remaining, resetsAt } = await usage.json();
console.log(`${remaining} calls left, resets at ${resetsAt}`);
429 Too Many Requestsโ
Symptom: API returns 429 with Retry-After header.
Cause: Too many requests per minute (rate limited).
Solutions:
- Respect rate limits โ 30/min anonymous, 30/min for all tiers
- Add delays โ Space out requests
- Use batch endpoints โ
/api/price/batchinstead of individual calls
// Implement exponential backoff
async function fetchWithRetry(url, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const res = await fetch(url);
if (res.status === 429) {
const retryAfter = res.headers.get('Retry-After') || 60;
await new Promise(r => setTimeout(r, retryAfter * 1000));
continue;
}
return res;
}
throw new Error('Max retries exceeded');
}
404 Not Foundโ
Symptom: API returns 404 for ENS names or addresses.
Cause: The resource doesn't exist or isn't registered.
Common cases:
| Request | Cause | Solution |
|---|---|---|
/api/ens/resolve/example.eth | Name not registered | Check on ENS App |
/api/ens/reverse/0x... | No primary name set | User hasn't set reverse record |
/api/farcaster/username | User doesn't exist | Verify on Warpcast |
// Handle 404 gracefully
const res = await fetch(`https://api.web3identity.com/api/ens/resolve/${name}`);
if (res.status === 404) {
console.log(`${name} is not registered`);
return null;
}
500 Internal Server Errorโ
Symptom: API returns 500 unexpectedly.
Cause: Upstream data source issue or server error.
Solutions:
- Retry once โ Transient errors often resolve
- Check status page โ status.web3identity.com
- Try alternative endpoint โ Use
/api/smart/*endpoints with fallbacks - Report issue โ Email support@web3identity.com
// Use smart endpoints with built-in fallbacks
// Instead of:
fetch('https://api.web3identity.com/api/price/coingecko/ETH')
// Use:
fetch('https://api.web3identity.com/api/smart/price/ETH')
// Automatically falls back to alternative sources
CORS Errorsโ
Symptom: Browser console shows CORS errors.
Cause: Browser security blocking cross-origin requests.
Solutions:
The API has CORS enabled for all origins. If you see CORS errors:
- Check URL โ Ensure you're using
https://api.web3identity.com - Check headers โ Don't set
Originheader manually - Use fetch correctly โ Don't use
mode: 'no-cors'
// Correct usage
const res = await fetch('https://api.web3identity.com/api/ens/resolve/vitalik.eth');
// Wrong - don't do this
const res = await fetch(url, { mode: 'no-cors' }); // โ Can't read response
x402 Payment Issuesโ
Symptom: Payment header rejected or payment not settling.
Common causes:
| Issue | Cause | Solution |
|---|---|---|
| "Invalid signature" | Wrong message signed | Use EIP-712 typed data signing |
| "Insufficient balance" | Not enough USDC | Fund wallet on Base network |
| "Payment expired" | Took too long | Payment valid for 5 minutes |
| "Wrong network" | Not on Base | Switch to Base (chain ID 8453) |
// Verify you're on Base network
const chainId = await provider.getNetwork().then(n => n.chainId);
if (chainId !== 8453n) {
throw new Error('Please switch to Base network');
}
// Check USDC balance
const usdc = new ethers.Contract(USDC_ADDRESS, ERC20_ABI, provider);
const balance = await usdc.balanceOf(walletAddress);
console.log(`USDC balance: ${ethers.formatUnits(balance, 6)}`);
SDK Issuesโ
"Module not found"โ
# Ensure package is installed
npm install @atv-eth/x402-sdk
# Check it's in package.json
cat package.json | grep x402-sdk
"fetch is not defined" (Node.js < 18)โ
// Add node-fetch for older Node versions
import fetch from 'node-fetch';
globalThis.fetch = fetch;
// Then import SDK
import { ATVClient } from '@atv-eth/x402-sdk';
TypeScript errorsโ
# Ensure TypeScript types are installed
npm install -D typescript @types/node
# SDK includes built-in types - no additional install needed
Debugging Tipsโ
Enable Verbose Loggingโ
// Log all requests
const originalFetch = globalThis.fetch;
globalThis.fetch = async (url, opts) => {
console.log(`[API] ${opts?.method || 'GET'} ${url}`);
const start = Date.now();
const res = await originalFetch(url, opts);
console.log(`[API] ${res.status} in ${Date.now() - start}ms`);
return res;
};
Check Response Headersโ
const res = await fetch('https://api.web3identity.com/api/ens/resolve/vitalik.eth');
// Useful headers
console.log('Rate limit remaining:', res.headers.get('X-RateLimit-Remaining'));
console.log('Cache status:', res.headers.get('X-Cache'));
console.log('Response time:', res.headers.get('X-Response-Time'));
Test with cURLโ
# Verbose output
curl -v https://api.web3identity.com/api/ens/resolve/vitalik.eth
# See headers only
curl -I https://api.web3identity.com/api/health
# Pretty print JSON
curl -s https://api.web3identity.com/api/ens/vitalik.eth | jq
Still Stuck?โ
- Check status page: status.web3identity.com
- Search docs: Use the search bar (press
/) - Review FAQ: /resources/faq
- Email support: support@web3identity.com
- Twitter: @ATV_eth
Report a Bugโ
Include this information when reporting issues:
- Endpoint: /api/...
- Request: curl command or code snippet
- Response: Full error response
- Timestamp: When the error occurred (UTC)
- Your IP: (if rate limit issue)