GetFreeProxy For Developers
GetFreeProxy DEVELOPER
Code Samples

Ready-to-Use Code Examples

Complete code samples in popular programming languages to quickly integrate GetFreeProxy API into your applications. Copy, paste, and customize for your needs.

Choose Your Language

Select your preferred programming language to see relevant examples

Fetching Proxy Lists

Get available proxies with optional filtering by country and protocol

Python Implementation

requests
import requests
import json

API_KEY = "your-api-key-here"
BASE_URL = "https://api.getfreeproxy.com/v1"

def get_proxies(country=None, protocol=None, page=1):
    """
    Fetch proxy list from GetFreeProxy API
    
    Args:
        country (str): ISO country code (e.g., 'US', 'UK', 'DE')
        protocol (str): Protocol type ('vless', 'ss', 'vmess')
        page (int): Page number for pagination (default: 1)
    
    Returns:
        list: Array of proxy objects with current page data
    """
    headers = {
        'Authorization': f'Bearer {API_KEY}',
        'Accept': 'application/json'
    }
    
    params = {'page': page}
    if country:
        params['country'] = country
    if protocol:
        params['protocol'] = protocol
    
    try:
        response = requests.get(f"{BASE_URL}/proxies", headers=headers, params=params)
        response.raise_for_status()
        
        data = response.json()
        
        print(f"āœ“ Found {len(data)} proxies")
        
        return data
        
    except requests.exceptions.HTTPError as e:
        print(f"āœ— HTTP Error: {e}")
        if response.status_code == 401:
            print("  Check your API key")
        elif response.status_code == 429:
            print("  Rate limit exceeded")
    except requests.exceptions.RequestException as e:
        print(f"āœ— Request failed: {e}")
    
    return None

# Usage examples
if __name__ == "__main__":
    # Get first 10 proxies from any country
    proxies = get_proxies()
    
    # Get US proxies only
    us_proxies = get_proxies(country='US')
    
    # Get Shadowsocks proxies from Germany
    de_ss = get_proxies(country='DE', protocol='ss')
    
    # Get second page of results
    page2 = get_proxies(page=2)
    
    if proxies:
        print("\nšŸ”— First few proxies:")
        for proxy in proxies[:3]:
            print(f"  {proxy['ip']}:{proxy['port']} ({proxy['countryCode']}) - {proxy['protocol']}")
            print(f"    Anonymity: {proxy['anonymity']}, Uptime: {proxy['uptime']}%, Response: {proxy['responseTime']:.3f}s")
        
        # Example: Filter high-quality proxies
        print("\n⭐ High-quality proxies (>90% uptime, <0.1s response):")
        quality_proxies = [p for p in proxies if p['uptime'] > 90 and p['responseTime'] < 0.1]
        for proxy in quality_proxies[:5]:
            print(f"  {proxy['ip']}:{proxy['port']} - {proxy['anonymity']} - Uptime: {proxy['uptime']}%")

Quick Reference Guide

Essential API information and common patterns for quick integration

Authentication

Authorization: Bearer YOUR_API_KEY

Include your API key in the Authorization header for all requests

Base URL

https://api.getfreeproxy.com/v1

All API requests should be made to this base URL

Parameters

country - US, UK, DE, etc.
protocol - http, https, socks5
page - Page number (1, 2, 3...)

Common Use Cases

Real-world scenarios and implementation patterns

Web Scraping

Rotate through different proxies to avoid rate limits and blocks

# Rotate proxies for scraping
proxies = get_proxies(country='US')
for i, url in enumerate(urls_to_scrape):
    proxy = proxies['data'][i % len(proxies['data'])]
    proxy_url = f"http://{proxy['ip']}:{proxy['port']}"
    
    response = requests.get(url, proxies={
        'http': proxy_url,
        'https': proxy_url
    })

Geographic Testing

Test how your website appears from different countries

# Test from different regions
countries = ['US', 'UK', 'DE', 'JP']
for country in countries:
    proxies = get_proxies(country=country)
    if proxies['data']:
        proxy = proxies['data'][0]
        # Test your website with this proxy

Load Testing

Distribute API calls across multiple IP addresses

// Load test with distributed IPs
const proxies = await getProxies();
const requests = urls.map((url, i) => {
    const proxy = proxies.data[i % proxies.data.length];
    return fetch(url, { proxy: proxy });
});
await Promise.all(requests);

Uptime Monitoring

Monitor services from multiple global locations

# Monitor from different locations
locations = ['US', 'EU', 'ASIA']
for location in locations:
    proxies = get_proxies(country=location)
    # Check service availability via proxy
    status = check_service_via_proxy(proxies[0])

Ready to Start Building?

Choose your preferred language, copy the code examples, and start integrating our proxy API into your applications today.