Docs / Getting started
Error Codes
Every error Gurdx can return, with its code, type and meaning, and how to handle them in your code.
The error envelope#
Errors are delivered with HTTP status 200 and a body in this shape:
{
"status": "error",
"code": 101,
"type": "invalid_key",
"description": "The API Key is missing or invalid."
}
| Field | Meaning |
|---|---|
status |
Always error. |
code |
Numeric code, stable across releases. Branch on this. |
type |
Short machine-readable name. |
description |
Human-readable explanation. May be reworded; do not parse it. |
Codes 101 to 127 are the core set. Codes 128 to 132 are later additions.
All codes#
| Code | Type | Description |
|---|---|---|
101 | invalid_key | The API Key is missing or invalid. |
102 | inactive_user | The API Key owner (the account) is inactive right now. Please contact the support team for more information. |
103 | limit_reached | You reached the usage limit of your account. Please upgrade your subscription or pay any unpaid invoices. |
104 | invalid_params | Please check out the params parameter's value. |
105 | plan_expired | Your plan has expired. Renew the subscription to enable using the API. |
106 | flood_detected | Our system has detected too many requests at the same time. Kindly please try to slow down. |
107 | invalid_callback_name | The value of the callback parameter cannot be a function name. |
108 | invalid_format | The value of the format parameter is not a valid format. Use JSON, XML, CSV or Newline. |
109 | callback_not_allowed | You can use the callback feature only with the JSON format. |
110 | invalid_language | The value of the lang parameter is not a valid format. Use EN, AR, FR, DE, ES, JA, ZH or RU. |
111 | invalid_mode | The value of the mode parameter is not a valid format. Use test or live. |
112 | invalid_ip | The IP Address is not valid or empty. |
113 | domain_not_whitelisted | You are sending the request from a host that is not in the authorized hosts of your account. |
114 | security_module_not_allowed | You cannot use the security module in your plan. Please upgrade your API plan to unlock this feature. |
115 | generic_error | An error occurred while processing your request. Please try again later. |
116 | invalid_country_code | The Country Code is invalid or not found. |
117 | feature_not_available | This feature is not available for your plan, please upgrade your plan first. |
118 | invalid_phone_number | The Phone Number is invalid or missing. |
119 | invalid_email_address | The Email Address is invalid or missing. |
120 | invalid_bin_number | The BIN number is invalid or missing. |
121 | invalid_asn | The AS Number you provided is empty or invalid. |
122 | invalid_iban | The IBAN is invalid or missing. |
123 | invalid_userid | The user identifier is invalid or too long. |
124 | invalid_user_type | The user type is invalid or missing. Use email, phone or user_id. |
125 | invalid_user_value | The user value is invalid or missing (value parameter). |
126 | too_many_deletions | You have reached the limit of deletions for this day. Please wait until the next day to delete more user data. |
127 | subscription_required | A paid subscription or an active trial is required to use this API. Subscribe from your dashboard. |
128 | invalid_domain | The domain name is invalid or missing. |
129 | invalid_text | The text is missing or too long (max 10,000 characters). |
130 | invalid_payment_data | The data object is missing or invalid. |
131 | invalid_feedback | The feedback is missing or invalid. |
132 | too_many_feedback_items | Send at most 1,000 feedback items per request. |
Handling errors#
Because the HTTP status is 200 for errors too, check status in the body.
PHP#
$res = Http::withToken(env('GURDX_KEY'))->get('https://gurdx.cretip.com/api/lookup/ip', ['ip' => $ip])->json();
if (($res['status'] ?? null) === 'error') {
match ($res['code']) {
106 => usleep(500_000), // slow down, retry later
103, 105, 127 => notifyBilling(), // quota or subscription
101, 113 => alertOps($res), // key or host problem
default => logger()->warning('Gurdx error', $res),
};
return fallbackDecision();
}
$data = $res['data'];
JavaScript#
const res = await fetch("https://gurdx.cretip.com/api/lookup/ip?ip=1.1.1.1", {
headers: { Authorization: "Bearer " + process.env.GURDX_KEY },
}).then((r) => r.json());
if (res.status === "error") {
if (res.code === 106) await new Promise((r) => setTimeout(r, 500));
throw new Error(`Gurdx ${res.code} ${res.type}: ${res.description}`);
}
console.log(res.data);
Python#
import requests
res = requests.get(
"https://gurdx.cretip.com/api/lookup/ip",
params={"ip": "1.1.1.1"},
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=5,
).json()
if res.get("status") == "error":
raise RuntimeError(f"Gurdx {res['code']} {res['type']}: {res['description']}")
data = res["data"]
Which errors to retry#
| Group | Codes | What to do |
|---|---|---|
| Temporary | 106, 115 | Retry with back-off. |
| Input problem | 104, 107 to 112, 116, 118 to 125, 128 to 132 | Fix the request; retrying will not help. |
| Account or plan | 101 to 103, 105, 113, 114, 117, 127 | Fix the key, host rules, plan or billing. |
Tip: Log
codeandtypetogether with the endpoint you called. It makes incidents far easier to diagnose.
Format and errors#
Errors respect the format option when it is valid, so an XML client receives an XML error. If the format itself is invalid (108) or conflicts with callback (109), the error is returned as JSON.
Found a mistake? Tell us on the contact page. Contact