📚 API Documentation

IP Schema RESTful API Endpoints

API Overview

IP Schema provides simple RESTful APIs for retrieving IP information, HTTP Headers, and URL response analysis.

Base URL

http://ipschema.com/api/

Response Format

All API responses are in JSON format and include the following fields:

{ "success": true, "data": {...}, "timestamp": "2024-01-01T00:00:00Z", "version": "1.0" }

IP Info API

GET /api/ip

Retrieve the current requester’s IP address information including geolocation, ISP, and more.

Query Parameters

Name Type Required Description
format string No Response format: json (default)

Response Example

{ "success": true, "message": "IP information retrieved successfully", "data": { "ip": "203.208.60.1", "type": "IPv4", "country": "China", "country_code": "CN", "region": "Beijing", "city": "Beijing", "latitude": 39.9042, "longitude": 116.4074, "timezone": "Asia/Shanghai", "isp": "China Telecom", "asn": "AS4134", "is_private": false }, "timestamp": "2024-01-01T12:00:00Z", "version": "1.0" }
Try this API
GET /api/ip/{ip}

Retrieve detailed information about a specific IP address.

Path Parameters

Name Type Required Description
ip string Yes IP address to query (IPv4 or IPv6)

Request Example

GET http://ipschema.com/api/ip/8.8.8.8
Try this API

Headers API

GET /api/headers

Retrieve all HTTP headers from the current request, including User-Agent parsing.

Response Example

{ "success": true, "data": { "headers": { "Accept": "text/html,application/xhtml+xml", "Accept-Language": "en-US,en;q=0.9", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/91.0", "Host": "ipschema.com", "Connection": "keep-alive" }, "user_agent_info": { "browser": "Chrome", "version": "91.0", "os": "Windows", "device": "Desktop" }, "ip": "203.208.60.1" } }
Try this API

URL Analysis API

POST /api/analyze-url

Analyze the HTTP response headers and basic info of a given URL.

Request Body Parameters

Name Type Required Description
url string Yes URL to analyze
follow_redirects boolean No Follow redirects (default: true)
timeout integer No Timeout in seconds (default: 10)

Request Example

POST http://ipschema.com/api/analyze-url Content-Type: application/json { "url": "https://example.com", "follow_redirects": true, "timeout": 10 }

Response Example

{ "success": true, "data": { "url": "https://example.com", "status_code": 200, "response_time_ms": 245, "headers": { "Server": "nginx/1.18.0", "Content-Type": "text/html; charset=UTF-8", "Content-Length": "1256", "Cache-Control": "public, max-age=3600" }, "ssl_info": { "valid": true, "issuer": "Let's Encrypt", "expires": "2024-06-01" } } }

Examples

cURL

# Get IP Info curl http://ipschema.com/api/ip # Get Headers curl http://ipschema.com/api/headers # Analyze URL curl -X POST http://ipschema.com/api/analyze-url \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com"}'

JavaScript

// Get IP Info fetch('http://ipschema.com/api/ip') .then(response => response.json()) .then(data => console.log(data)); // Analyze URL fetch('http://ipschema.com/api/analyze-url', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ url: 'https://example.com' }) }) .then(response => response.json()) .then(data => console.log(data));

Python

import requests # Get IP Info response = requests.get('http://ipschema.com/api/ip') data = response.json() print(data) # Analyze URL response = requests.post('http://ipschema.com/api/analyze-url', json={'url': 'https://example.com'}) data = response.json() print(data)