📚 API Documentation
Complete guide to XGUARDIA APIs for IP protection, URL shortening, and analytics
Shortener API
Check if an IP should be blocked for shortener access.
Endpoint
GET /api/v1/shortener
Example Request
curl "https://x-guardia.com/api/v1/shortener?apikey=YOUR_API_KEY&keyname=YOUR_SHORTENER_KEY&ip=1.2.3.4&ua=Mozilla/5.0"
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
apikey | string | Yes | Your API key for authentication |
keyname | string | Yes | Your shortener key name |
ip | string | Yes | IP address to check |
ua | string | Yes | User agent string |
Example Response
{ "result": { "status": "allowed", "is_bot": false, "block_access": false, "reason": "", "action": "allow", "confidence": 100 }, "shortener": { "name": "YOUR_SHORTENER_KEY", "redirect": "https://example.com", "usage_count": 1, "device_filter": null, "allowed_countries": null } }
📊 Shortener Statistics API
Get comprehensive statistics and analytics for your shortener keys.
Get All Statistics
GET /api/v1/shortener/stats
Example Request
curl "https://x-guardia.com/api/v1/shortener/stats?apikey=YOUR_API_KEY"
Response
{ "success": true, "user": { "id": 1, "name": "User Name", "email": "user@example.com" }, "statistics": { "total_shortener_keys": 5, "active_keys": 4, "inactive_keys": 1, "total_usage": 1250, "usage_stats": { "today": 45, "this_week": 320, "this_month": 890 } }, "shortener_keys": [ { "id": 1, "keyname": "abc123", "redirect_url": "https://example.com", "device_filter": "all", "allowed_countries": ["ID", "US"], "is_active": true, "total_usage": 500, "today_usage": 25, "last_used_at": "2025-01-10 12:30:00", "created_at": "2025-01-01 10:00:00" } ], "top_performing_keys": [ { "keyname": "abc123", "usage_count": 500 } ], "recent_activity": [...], "generated_at": "2025-01-10 15:45:30" }
Get Specific Key Details
GET /api/v1/shortener/key/{keyname}
Example Request
curl "https://x-guardia.com/api/v1/shortener/key/abc123?apikey=YOUR_API_KEY"
Get Usage Analytics
GET /api/v1/shortener/analytics
Example Request
curl "https://x-guardia.com/api/v1/shortener/analytics?apikey=YOUR_API_KEY&days=30"
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
apikey | string | Yes | Your API key for authentication |
days | integer | No | Number of days for analytics (1-365, default: 30) |
🛡️ IP Blocker API
Check if an IP should be blocked based on threat intelligence.
Endpoint
GET /api/v1/blocker
Example Request
curl "https://x-guardia.com/api/v1/blocker?ip=1.2.3.4&apikey=YOUR_API_KEY&ua=Mozilla/5.0"
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ip | string | Yes | IP address to check |
apikey | string | Yes | Your API key |
ua | string | Yes | User agent string |
🔑 Authentication & API Keys
How to Get API Key
- Register an account
- Login to dashboard
- Go to API Keys section
- Click "Generate New API Key"
- Copy and save your API key securely
API Key Usage
- Include as
apikey
parameter - One API key per user account
- Keep your API key private and secure
- Monitor usage in dashboard
- Regenerate if compromised
Important Security Notes
- Never share your API key publicly
- Do not include API keys in client-side code
- Use HTTPS for all API requests
- Monitor API usage regularly
🚀 Quick Start Examples
JavaScript (Fetch)
// Get shortener statistics fetch('https://x-guardia.com/api/v1/shortener/stats?apikey=YOUR_API_KEY') .then(response => response.json()) .then(data => { console.log('Total keys:', data.statistics.total_shortener_keys); console.log('Usage today:', data.statistics.usage_stats.today); });
PHP (cURL)
// Check IP with blocker API $url = 'https://x-guardia.com/api/v1/blocker'; $params = [ 'ip' => '1.2.3.4', 'apikey' => 'YOUR_API_KEY', 'ua' => 'Mozilla/5.0...' ]; $ch = curl_init($url . '?' . http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true);