API Documentation

Introduction

Welcome to the IPAdress API documentation. Our API allows you to retrieve detailed information about IP addresses, including geolocation data, ISP details, and more.

Authentication

To use the IPAdress API, you need to include your API key in the request header. You can obtain an API key by signing up for an account on our website.

Include the following header in your API requests:

X-API-Key: YOUR_API_KEY_HERE

Endpoints

Get IP Information

GET https://api.ipaddress.to/v1/ip-info

Parameters

Parameter Type Description
ip string The IP address to look up (optional, defaults to requester's IP)

Example Response

{ "ip": "8.8.8.8", "country": "United States", "country_code": "US", "region": "California", "city": "Mountain View", "latitude": 37.4056, "longitude": -122.0775, "isp": "Google LLC", "organization": "Google Public DNS", "timezone": "America/Los_Angeles" }

Rate Limiting

Our API is rate-limited to ensure fair usage. The current limits are:

  • 100 requests per minute
  • 5,000 requests per day

If you exceed these limits, you'll receive a 429 Too Many Requests response.

Error Handling

The API uses standard HTTP response codes to indicate the success or failure of requests. Here are some common codes you might encounter:

  • 200 OK: The request was successful
  • 400 Bad Request: The request was invalid or cannot be served
  • 401 Unauthorized: Authentication failed or user doesn't have permissions for the requested operation
  • 404 Not Found: The requested resource could not be found
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request

Examples

Here are some examples of how to use our API with different programming languages:

Python Example

import requests api_key = 'YOUR_API_KEY' ip_address = '8.8.8.8' url = f'https://api.ipaddress.to/v1/ip-info?ip={ip_address}' headers = {'X-API-Key': api_key} response = requests.get(url, headers=headers) if response.status_code == 200: data = response.json() print(f"IP: {data['ip']}") print(f"Country: {data['country']}") print(f"City: {data['city']}") else: print(f"Error: {response.status_code}")

JavaScript Example

const apiKey = 'YOUR_API_KEY'; const ipAddress = '8.8.8.8'; fetch(`https://api.ipaddress.to/v1/ip-info?ip=${ipAddress}`, { headers: { 'X-API-Key': apiKey } }) .then(response => response.json()) .then(data => { console.log(`IP: ${data.ip}`); console.log(`Country: ${data.country}`); console.log(`City: ${data.city}`); }) .catch(error => console.error('Error:', error));