first API request
Make your first API request
Updated 23 November 2026
Your first API request takes about five minutes from signup to a real answer. This guide walks you through each step, with examples in cURL, PHP and Python.
Before your first API request
You need three things:
- An IPzentra account, created at app.ipzentra.com with your company email address.
- A confirmed email address. Your free trial starts the moment you click the verification link.
- An API key, created in your dashboard under API keys.
When you create a key, copy it straight away. For security it is shown only once. If you lose it, revoke it and create a new one.
Step 1: send your first API request with cURL
cURL is the quickest way to check that everything works:
curl -H "X-Api-Key: YOUR_API_KEY" https://api.ipzentra.com/v1/8.8.8.8Replace YOUR_API_KEY with your key. The response is JSON with the country, region and city, network and risk signals for that address, for example "country_code": "US".
Step 2: read the response
The fields you will use most are:
country_codeandcountry_name: where the address is registered.regionandcity: the approximate state and city.location_confidence(high, medium or low) tells you how far to trust the city.asnandorg: the network that owns the address.is_vpn,is_proxy,is_torandis_hosting: anonymity and datacenter flags.risk: a simple low, medium or high summary.
The API documentation lists every field and what it means.
Step 3: call the API from your code
Once your first API request works in cURL, move it into your application. In PHP:
$ch = curl_init('https://api.ipzentra.com/v1/' . urlencode($ip));
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 3,
CURLOPT_HTTPHEADER => ['X-Api-Key: ' . getenv('IPZENTRA_KEY')]]);
$data = json_decode((string)curl_exec($ch), true);In Python:
import os, requests
r = requests.get("https://api.ipzentra.com/v1/" + ip,
headers={"X-Api-Key": os.environ["IPZENTRA_KEY"]}, timeout=3)
data = r.json()Keep the key in an environment variable rather than in your source code, and call the API from your server, never from code that runs in a visitor's browser.
Check a country in one call
If you only need to know whether a visitor is in the right country, use the check endpoint:
curl -H "X-Api-Key: YOUR_API_KEY" "https://api.ipzentra.com/v1/check?ip=49.207.48.1&country=IN"The response adds country_match, which is true or false.
Test with your own address
Call https://api.ipzentra.com/v1/ without an address and the API looks up the address your request came from. It is a handy way to see what your server looks like to the outside world.
If your first API request fails
- 401 invalid_key: the key is missing, mistyped or revoked. Check the header name is exactly
X-Api-Key. - 402 subscription_required: the account has no plan with API access. This is rare, because ended trials move to the Free plan. See why the API returns a 402 error.
- 403 ip_not_allowed: the key is restricted to other server IPs. See restrict an API key.
- 429 rate_limited: you sent too many requests too quickly. See rate limits and the 429 error.
After your first API request
Add a short timeout, around three seconds, so a slow network never holds up your signup or checkout page. Cache each result for about an hour so repeat visitors do not use extra lookups. Then decide what your application should do with low, medium and high risk traffic.
If something in your first API request does not behave as described here, open a support ticket and include the request you sent and the response you received.
Common questions about your first API request
Do I need a credit card? No. The free trial needs only a confirmed company email address, and you can make your first API request straight away.
Which IP address should I send? Send the address of the visitor you want to check, usually taken from the incoming request on your server. Behind a load balancer or CDN, read it from the header that service adds, such as X-Forwarded-For, rather than using the address of the load balancer itself.
Can I test without writing code? Yes. Paste the cURL command above into a terminal, or try any address in the live lookup on our home page.
How many lookups does testing use? Each request counts as one lookup against your daily allowance, so a few test calls make no real difference.