Get started
Errors
Errors come back as JSON with a stable code you can match on.
Error format
- errorstring
Stable error code to match on.
- messagestring
Readable explanation.
- detailsobject
Only on bulk 400s: the inputs that were invalid.
{
"error": "invalid_ip",
"message": "Invalid IP address format"
}Status codes
- 400bad_request, invalid_ip, reserved_ip, invalid_domain, invalid_target, unresolved_host, unknown_jurisdiction, invalid_asn
The request or an input is not valid.
- 401missing_api_key, invalid_api_key, unauthorized
The API key is missing or unknown.
- 403account_suspended
The account is suspended.
- 404not_found
Nothing exists at that path or id.
- 413too_many_lines
The body or list is too large.
- 429rate_limit_exceeded
A rate limit ran out.
- 500server_error
Something failed on our side; retry later.
Errors in the SDKs
- APIError
Any error response, with status, code and message.
- AuthenticationError
401 or 403.
- NotFoundError
404.
- RateLimitError
429, with reason, retryAfter and an upgrade link.
- ConnectionError
No response arrived, including timeouts.
import IPScanner, { APIError, RateLimitError } from '@ipscanner.io/sdk';
const client = new IPScanner({ apiKey: 'YOUR_API_KEY' });
try {
await client.ip.lookup('8.8.8.8');
} catch (err) {
if (err instanceof RateLimitError) {
console.log(err.reason, err.retryAfter, err.upgradeUrl);
} else if (err instanceof APIError) {
console.log(err.status, err.code, err.message);
} else {
throw err;
}
}