API Documentation

Simple JSON endpoints for IP detection, ASN information, and latency testing. Free for personal and educational use with rate limiting.

Authentication

No authentication is required for basic usage. All endpoints are publicly accessible but subject to rate limiting to ensure fair usage.

Rate Limits
Current limit: 100 requests per minute per IP address. Higher limits available for commercial use - contact us for details.

Endpoints

GET/api/ip

Get IP Address Information

Returns the client's IP address along with available geolocation and ASN information.

Example Request

curl https://latencylens.app/api/ip

Example Response

{ "ip": "203.0.113.45", "ipv4": "203.0.113.45", "country": "US", "city": "San Francisco", "region": "California", "timezone": "America/Los_Angeles", "asn": "13335", "asnOrg": "Cloudflare, Inc.", "timestamp": 1704067200000 }

Response Fields

FieldTypeDescription
ipstringClient IP address (IPv4 or IPv6)
ipv4/ipv6stringSpecific IP version (if determinable)
countrystringCountry code (if available)
citystringCity name (if available)
asnstringAutonomous System Number
timestampnumberUnix timestamp of the response
GET/api/latency

Get Region Information for Latency Testing

Returns information about cloud regions for client-side latency testing.

Parameters

ParameterTypeDescription
regionstringRegion ID (e.g., us-east-1)
cloudstringCloud provider (aws, gcp, azure) - optional

Example Request

curl "https://latencylens.app/api/latency?region=us-east-1&cloud=aws"

Example Response

{ "region": "us-east-1", "cloud": "aws", "name": "US East (N. Virginia)", "endpoint": "https://dynamodb.us-east-1.amazonaws.com", "latitude": 39.0458, "longitude": -77.5081, "timestamp": 1704067200000 }
GET/api/vpn-check

VPN/Proxy Detection

Performs heuristic analysis to detect if the client is using a VPN, proxy, or similar service.

Example Response

{ "ip": "203.0.113.45", "isVPN": false, "isProxy": false, "isTor": false, "confidence": 15, "reasons": [ "Organization appears to be residential ISP", "No strong indicators detected" ], "disclaimer": "This is a heuristic analysis...", "timestamp": 1704067200000 }

Error Handling

All endpoints return standard HTTP status codes. Error responses include a JSON object with an error message.

Rate Limit Exceeded (429)

{ "error": "Rate limit exceeded", "message": "Too many requests. Please try again later.", "retryAfter": 60 }

Invalid Parameters (400)

{ "error": "Invalid request", "message": "Region parameter is required" }

Usage Guidelines

Fair Use Policy

  • Personal use: Individual projects, learning, and experimentation
  • Educational use: Schools, universities, and training programs
  • Open source projects: Non-commercial software development
  • Commercial use: Requires prior arrangement and may incur costs
  • Abuse: High-volume automated requests, reselling data

Best Practices

  • Cache responses when possible to reduce API calls
  • Implement exponential backoff for retries
  • Handle rate limiting gracefully in your applications
  • Don't hardcode API endpoints - they may change
  • Include a User-Agent header identifying your application

Support & Contact

For API support, commercial licensing, or higher rate limits: