PRIVATEBYTE
Deploy

Free IP API

Your public IP,
as text or JSON.

PrivateByte IP API

Two free endpoints that return the address your request came from. One gives plain text for scripts. The other gives JSON with location, network, blocklist status and a reputation estimate. No key, no sign-up.

No API key · HTTPS · CORS enabled · IPv4 and IPv6

Endpoints

Two GET requests.

Both answer for the address that made the request. There are no parameters.

RequestReturnsContent type
GET https://privatebyte.com/ipYour IP address and a newlinetext/plain
GET https://privatebyte.com/ip.jsonIP, location, network, blocklist status and scoreapplication/json

Try it

One line each.

Use the plain-text endpoint in shell scripts and the JSON endpoint when you need the details.

CURLno key needed
curl https://privatebyte.com/ip

curl https://privatebyte.com/ip.json

# what a proxy exits from:
curl -x http://user:[email protected]:3128 https://privatebyte.com/ip

# in a browser:
fetch('https://privatebyte.com/ip.json').then(r => r.json()).then(console.log)
Works from a browser too: CORS is openWeb tool

Response

What /ip.json returns.

An example. Your request returns the values for your own address.

JSONillustrative
{
  "ok": true,
  "ip": "203.0.113.42",
  "version": 4,
  "location": {
    "country": "United Kingdom",
    "countryCode": "GB",
    "region": "England",
    "city": "London",
    "latitude": 51.5074,
    "longitude": -0.1278
  },
  "network": {
    "asn": 64500,
    "org": "Example Broadband Ltd",
    "hosting": false
  },
  "blacklists": {
    "checked": 7,
    "listed": [],
    "unavailable": 0
  },
  "score": {
    "version": 1,
    "pb": {
      "value": 92,
      "label": "Excellent",
      "confidence": "high"
    },
    "health": {
      "value": 95,
      "label": "Excellent",
      "confidence": "high"
    },
    "risk": {
      "value": 10,
      "label": "Low",
      "confidence": "high"
    },
    "factors": [
      {
        "id": "blocklists",
        "label": "Blocklists",
        "effect": "good",
        "detail": "Not listed on 7 public blocklists"
      }
    ],
    "note": "An estimate from public signals, not a verdict."
  },
  "attribution": "IP data by DB-IP (db-ip.com), CC BY 4.0",
  "docs": "https://privatebyte.com/ip-api"
}
203.0.113.42 is a reserved documentation addressHTTP 200

Fields

Field by field.

FieldTypeMeaning
okbooleantrue on success. On failure, false with a reason.
ip, versionstring, numberThe address the request came from, and 4 or 6.
locationobjectCountry, ISO country code, region, city, latitude and longitude. City level is approximate.
networkobjectASN, the network's registered name, and hosting: a guess at whether it is a hosting range.
blacklistsobject or nullHow many public blocklists were checked, which ones listed the address, and how many were unavailable. null for IPv6.
scoreobjectpb, health and risk, each with a 0 to 100 value, a label and a confidence, plus the factors behind them. An estimate, not a verdict.
attributionstringCredit for the location data. Keep it if you display that data.

Limits

Free, with fair-use limits.

Built for scripts, status pages and debugging. Not for bulk lookups.

Rate limited per address

Each address has an hourly allowance. Past it, the JSON endpoint answers HTTP 429 with {"ok":false,"reason":"RATE_LIMITED"}. Wait and retry.

Your own address only

The endpoints report on the caller. You cannot pass another address to look up. Use the web tool for one-off checks.

Not cached

Location and network are read on every request. Blocklist answers may be reused for a few minutes for the same address.

Answers

A few things worth knowing.

Do I need an API key?+

No. Both endpoints are open. There is nothing to sign up for.

Can I call it from a web page?+

Yes. Responses carry Access-Control-Allow-Origin: *, so browser JavaScript can read them.

How accurate is the location?+

Country is usually right. City is often wrong by tens of miles, and mobile and VPN addresses can show another region entirely.

What does the score mean?+

It combines public signals, such as blocklist status and network type, into a 0 to 100 estimate. Treat it as a hint about how an address may be viewed, not as a verdict.

Does it work over IPv6?+

Yes. You get the address your connection used. Blocklist status is IPv4 only, so blacklists is null for IPv6.

May I use it in my own project?+

Yes, within the fair-use limits and our acceptable use policy. If you show location data, keep the attribution string.

Check an address in the browser.
Or script it.

The web tool shows the same data with explanations.

Open the web toolAll free tools