Resource center

IP-Check API Documentation

Fast Stable No tracking Dev-friendly
HTTPS (no third-party IP intelligence calls)

The IPCheck API helps developers detect the public IP address their application uses to reach the internet. It is designed for quick diagnostics, automation tooling, and production-safe IP checks.

Base URL
https://ipcheck.codecraftinglabs.com
Best for
Proxy/VPN validation, egress IP confirmation, “works locally but not in prod” debugging, and lightweight telemetry opt-in workflows.
Endpoint reference
Endpoint Returns Format Notes
GET/v1/raw Client public IP text/plain Versioned raw endpoint.
GET/v1/json IP + country application/json Country may be null.
GET/v1/ipv4 IPv4 only text/plain 204 if client is not IPv4.
GET/v1/ipv6 IPv6 only text/plain 204 if client is not IPv6.
GET/v1/country Country code only text/plain 204 if unknown/unavailable.
GET/v1/info Diagnostics payload application/json Sanitized headers + request details for troubleshooting.
GET/healthz Service health text/plain Useful for monitoring/uptime checks.
Production guidance
Use /v1/raw or /v1/json in production. Use /v1/info when debugging proxy/CDN behavior.
Diagnostics: /v1/info
GET
Request
curl https://ipcheck.codecraftinglabs.com/v1/info
Example Response
{
  "ip": "203.0.113.10",
  "ip_version": 4,
  "country": "US",
  "method": "GET",
  "host": "ipcheck.codecraftinglabs.com",
  "path": "/v1/info",
  "query": {},
  "user_agent": "curl/8.5.0",
  "forwarded_for": "198.51.100.2",
  "timestamp": "2025-12-22T11:00:00+05:30",
  "headers": {
    "user-agent": "curl/8.5.0",
    "accept": "*/*",
    "cf-ipcountry": "US",
    "cf-ray": "..."
  }
}
We intentionally do not echo cookies. /v1/info is meant for safe debugging.
Quick start
Get public IP (raw text)
GET
Request
curl https://ipcheck.codecraftinglabs.com/v1/raw
Example Response
203.0.113.10
Tip
For structured output, use /v1/json. For network troubleshooting, use /v1/info.
Get public IP + country (JSON)
GET
Request
curl https://ipcheck.codecraftinglabs.com/v1/json
Example Response
{
  "ip": "203.0.113.10",
  "country": "US"
}
Note: country may be null if unavailable/unknown.
Formats and status codes
Plain text endpoints
/v1/raw, /v1/ipv4, /v1/ipv6, /v1/country
Response type: text/plain; charset=utf-8
JSON endpoints
/v1/json, /v1/info
Response type: application/json
Status codes you should handle
  • 200 OK — success
  • 204 No Content — requested IP family or country not available for this request
  • 429 Too Many Requests — rate limit exceeded (use Retry-After)
Rate limits (429)

To keep the service reliable for everyone, requests are rate-limited. The regular rate limit is 60 requests per minute per IP. If you exceed the limit, you will receive HTTP 429 and (when available) a Retry-After header.

Recommended client behavior
Honor Retry-After, avoid tight retry loops, and use exponential backoff with jitter for retries.
429 (raw endpoints)
Too Many Requests
Retry-After: 12s
429 (JSON endpoints)
{
  "error": "too_many_requests",
  "message": "Too Many Requests",
  "retry_after": 12
}
If you need higher-volume access (or want to use IPCheck inside a widely distributed client), contact us with your expected request volume and use case.
Country detection

We expose country using Cloudflare’s IP geolocation signal (CF-IPCountry) so we can provide country-only data without making third-party IP intelligence API calls (which often have strict rate limits).

Output format
ISO 3166-1 alpha-2 country code (e.g., US, LK).
Unknown country
If the country is unknown/unavailable, /v1/country returns 204, and JSON responses return "country": null.
Security note
Country is a convenience signal for UX and diagnostics. It should not be used as a strict security boundary or identity proof.
Examples (C#, Python, JavaScript)
C# (.NET) — raw and JSON
C#
Request (raw)
using var http = new HttpClient();
var ip = await http.GetStringAsync("https://ipcheck.codecraftinglabs.com/v1/raw");
Console.WriteLine(ip.Trim());
Request (JSON)
using System.Net.Http.Json;

public sealed class IpCheckDto
{
    public string? ip { get; set; }
    public string? country { get; set; }
}

using var http = new HttpClient();
var data = await http.GetFromJsonAsync("https://ipcheck.codecraftinglabs.com/v1/json");

Console.WriteLine($"IP: {data?.ip} | Country: {data?.country ?? "N/A"}");
429 handling tip
If you receive HTTP 429, read the Retry-After header (when present) and back off before retrying.
Python — requests
Python
Request (raw)
import requests

r = requests.get("https://ipcheck.codecraftinglabs.com/v1/raw", timeout=10)
r.raise_for_status()
print(r.text.strip())
Request (JSON)
import requests

r = requests.get("https://ipcheck.codecraftinglabs.com/v1/json", timeout=10)
r.raise_for_status()
data = r.json()

print("IP:", data.get("ip"))
print("Country:", data.get("country") or "N/A")
JavaScript — fetch (Browser / Node 18+)
JavaScript
Request (raw)
const res = await fetch("https://ipcheck.codecraftinglabs.com/v1/raw");
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const ip = (await res.text()).trim();
console.log(ip);
Request (JSON)
const res = await fetch("https://ipcheck.codecraftinglabs.com/v1/json", {
  headers: { "Accept": "application/json" }
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();

console.log("IP:", data.ip);
console.log("Country:", data.country ?? "N/A");
Best practices
  • Don’t poll aggressively. Cache results briefly when possible. Most apps only need periodic checks.
  • Handle 204 gracefully. IPv4/IPv6/country endpoints can return no content depending on network conditions.
  • Use /v1/info for debugging. It is intentionally verbose and designed to help you diagnose proxies/CDN behavior.
  • Back off on 429. Honor Retry-After and add exponential backoff.
  • Keep security expectations realistic. IP/country are network signals, not identity guarantees.
Higher-Volume Usage

You’re welcome to integrate IPCheck into automation tools, diagnostics, internal dashboards, and developer utilities. If you need higher-volume usage or custom behavior (e.g., dedicated quotas), contact us with:

  • Estimated request volume (per minute / per day)
  • Where it will run (server-side, client-side, CI pipelines, etc.)
  • Which endpoints you plan to use
Copied