Skip to content

proxy › location
PRO

Type: <string>
Default: 'us'
Values: ISO 3166-1 alpha-2 country code
It routes the request through a proxy IP in the given country over the target url.

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://geolocation.microlink.io' URL with 'proxy' API parameter:

CLI Microlink API example

microlink https://geolocation.microlink.io&proxy.location=us

cURL Microlink API example

curl -G "https://api.microlink.io" \
  -d "url=https://geolocation.microlink.io" \
  -d "proxy.location=us"

JavaScript Microlink API example

import mql from '@microlink/mql'

const { data } = await mql('https://geolocation.microlink.io', {
  proxy: {
    location: "us"
  }
})

Python Microlink API example

import requests

url = "https://api.microlink.io/"

querystring = {
    "url": "https://geolocation.microlink.io",
    "proxy.location": "us"
}

response = requests.get(url, params=querystring)

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

base_url = "https://api.microlink.io/"

params = {
  url: "https://geolocation.microlink.io",
  proxy.location: "us"
}

uri = URI(base_url)
uri.query = URI.encode_www_form(params)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

$baseUrl = "https://api.microlink.io/";

$params = [
    "url" => "https://geolocation.microlink.io",
    "proxy.location" => "us"
];

$query = http_build_query($params);
$url = $baseUrl . '?' . $query;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET"
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #: " . $err;
} else {
    echo $response;
}

Golang Microlink API example

package main

import (
    "fmt"
    "net/http"
    "net/url"
    "io"
)

func main() {
    baseURL := "https://api.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://geolocation.microlink.io")
    q.Set("proxy.location", "us")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest("GET", u.String(), nil)
    if err != nil {
        panic(err)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
The value is case-insensitive. Unknown codes are rejected with EINVALQUERY. location and url are exclusive.
The following country codes are supported:
  • 🇦🇩 Andorra 'ad'
  • 🇦🇪 United Arab Emirates 'ae'
  • 🇦🇫 Afghanistan 'af'
  • 🇦🇬 Antigua & Barbuda 'ag'
  • 🇦🇱 Albania 'al'
  • 🇦🇲 Armenia 'am'
  • 🇦🇴 Angola 'ao'
  • 🇦🇷 Argentina 'ar'
  • 🇦🇸 American Samoa 'as'
  • 🇦🇹 Austria 'at'
  • 🇦🇺 Australia 'au'
  • 🇦🇼 Aruba 'aw'
  • 🇦🇿 Azerbaijan 'az'
  • 🇧🇦 Bosnia & Herzegovina 'ba'
  • 🇧🇧 Barbados 'bb'
  • 🇧🇩 Bangladesh 'bd'
  • 🇧🇪 Belgium 'be'
  • 🇧🇫 Burkina Faso 'bf'
  • 🇧🇬 Bulgaria 'bg'
  • 🇧🇭 Bahrain 'bh'
  • 🇧🇮 Burundi 'bi'
  • 🇧🇯 Benin 'bj'
  • 🇧🇲 Bermuda 'bm'
  • 🇧🇴 Bolivia 'bo'
  • 🇧🇷 Brazil 'br'
  • 🇧🇸 Bahamas 'bs'
  • 🇧🇹 Bhutan 'bt'
  • 🇧🇼 Botswana 'bw'
  • 🇧🇾 Belarus 'by'
  • 🇧🇿 Belize 'bz'
  • 🇨🇦 Canada 'ca'
  • 🇨🇫 Central African Republic 'cf'
  • 🇨🇬 Congo - Brazzaville 'cg'
  • 🇨🇭 Switzerland 'ch'
  • 🇨🇮 Côte d’Ivoire 'ci'
  • 🇨🇱 Chile 'cl'
  • 🇨🇲 Cameroon 'cm'
  • 🇨🇳 China 'cn'
  • 🇨🇴 Colombia 'co'
  • 🇨🇷 Costa Rica 'cr'
  • 🇨🇻 Cape Verde 'cv'
  • 🇨🇾 Cyprus 'cy'
  • 🇨🇿 Czechia 'cz'
  • 🇩🇪 Germany 'de'
  • 🇩🇯 Djibouti 'dj'
  • 🇩🇰 Denmark 'dk'
  • 🇩🇲 Dominica 'dm'
  • 🇩🇴 Dominican Republic 'do'
  • 🇩🇿 Algeria 'dz'
  • 🇪🇨 Ecuador 'ec'
  • 🇪🇪 Estonia 'ee'
  • 🇪🇬 Egypt 'eg'
  • 🇪🇷 Eritrea 'er'
  • 🇪🇸 Spain 'es'
  • 🇪🇹 Ethiopia 'et'
  • 🇫🇮 Finland 'fi'
  • 🇫🇯 Fiji 'fj'
  • 🇫🇷 France 'fr'
  • 🇬🇦 Gabon 'ga'
  • 🇬🇧 United Kingdom 'gb'
  • 🇬🇩 Grenada 'gd'
  • 🇬🇪 Georgia 'ge'
  • 🇬🇬 Guernsey 'gg'
  • 🇬🇭 Ghana 'gh'
  • 🇬🇮 Gibraltar 'gi'
  • 🇬🇲 Gambia 'gm'
  • 🇬🇳 Guinea 'gn'
  • 🇬🇶 Equatorial Guinea 'gq'
  • 🇬🇷 Greece 'gr'
  • 🇬🇹 Guatemala 'gt'
  • 🇬🇼 Guinea-Bissau 'gw'
  • 🇭🇰 Hong Kong SAR China 'hk'
  • 🇭🇳 Honduras 'hn'
  • 🇭🇷 Croatia 'hr'
  • 🇭🇹 Haiti 'ht'
  • 🇭🇺 Hungary 'hu'
  • 🇮🇩 Indonesia 'id'
  • 🇮🇪 Ireland 'ie'
  • 🇮🇱 Israel 'il'
  • 🇮🇳 India 'in'
  • 🇮🇸 Iceland 'is'
  • 🇮🇹 Italy 'it'
  • 🇯🇲 Jamaica 'jm'
  • 🇯🇴 Jordan 'jo'
  • 🇯🇵 Japan 'jp'
  • 🇰🇪 Kenya 'ke'
  • 🇰🇬 Kyrgyzstan 'kg'
  • 🇰🇭 Cambodia 'kh'
  • 🇰🇲 Comoros 'km'
  • 🇰🇷 South Korea 'kr'
  • 🇰🇼 Kuwait 'kw'
  • 🇰🇿 Kazakhstan 'kz'
  • 🇱🇧 Lebanon 'lb'
  • 🇱🇨 St. Lucia 'lc'
  • 🇱🇮 Liechtenstein 'li'
  • 🇱🇰 Sri Lanka 'lk'
  • 🇱🇸 Lesotho 'ls'
  • 🇱🇹 Lithuania 'lt'
  • 🇱🇺 Luxembourg 'lu'
  • 🇱🇻 Latvia 'lv'
  • 🇲🇦 Morocco 'ma'
  • 🇲🇨 Monaco 'mc'
  • 🇲🇩 Moldova 'md'
  • 🇲🇪 Montenegro 'me'
  • 🇲🇬 Madagascar 'mg'
  • 🇲🇰 North Macedonia 'mk'
  • 🇲🇱 Mali 'ml'
  • 🇲🇲 Myanmar (Burma) 'mm'
  • 🇲🇳 Mongolia 'mn'
  • 🇲🇴 Macao SAR China 'mo'
  • 🇲🇶 Martinique 'mq'
  • 🇲🇷 Mauritania 'mr'
  • 🇲🇹 Malta 'mt'
  • 🇲🇺 Mauritius 'mu'
  • 🇲🇻 Maldives 'mv'
  • 🇲🇼 Malawi 'mw'
  • 🇲🇽 Mexico 'mx'
  • 🇲🇾 Malaysia 'my'
  • 🇲🇿 Mozambique 'mz'
  • 🇳🇦 Namibia 'na'
  • 🇳🇪 Niger 'ne'
  • 🇳🇬 Nigeria 'ng'
  • 🇳🇮 Nicaragua 'ni'
  • 🇳🇱 Netherlands 'nl'
  • 🇳🇴 Norway 'no'
  • 🇳🇵 Nepal 'np'
  • 🇳🇷 Nauru 'nr'
  • 🇳🇿 New Zealand 'nz'
  • 🇴🇲 Oman 'om'
  • 🇵🇦 Panama 'pa'
  • 🇵🇪 Peru 'pe'
  • 🇵🇬 Papua New Guinea 'pg'
  • 🇵🇭 Philippines 'ph'
  • 🇵🇰 Pakistan 'pk'
  • 🇵🇱 Poland 'pl'
  • 🇵🇷 Puerto Rico 'pr'
  • 🇵🇹 Portugal 'pt'
  • 🇵🇼 Palau 'pw'
  • 🇵🇾 Paraguay 'py'
  • 🇶🇦 Qatar 'qa'
  • 🇷🇴 Romania 'ro'
  • 🇷🇸 Serbia 'rs'
  • 🇷🇺 Russia 'ru'
  • 🇷🇼 Rwanda 'rw'
  • 🇸🇦 Saudi Arabia 'sa'
  • 🇸🇨 Seychelles 'sc'
  • 🇸🇪 Sweden 'se'
  • 🇸🇬 Singapore 'sg'
  • 🇸🇮 Slovenia 'si'
  • 🇸🇰 Slovakia 'sk'
  • 🇸🇱 Sierra Leone 'sl'
  • 🇸🇳 Senegal 'sn'
  • 🇸🇴 Somalia 'so'
  • 🇸🇷 Suriname 'sr'
  • 🇸🇸 South Sudan 'ss'
  • 🇸🇹 São Tomé & Príncipe 'st'
  • 🇸🇻 El Salvador 'sv'
  • 🇹🇩 Chad 'td'
  • 🇹🇬 Togo 'tg'
  • 🇹🇭 Thailand 'th'
  • 🇹🇯 Tajikistan 'tj'
  • 🇹🇲 Turkmenistan 'tm'
  • 🇹🇳 Tunisia 'tn'
  • 🇹🇴 Tonga 'to'
  • 🇹🇷 Türkiye 'tr'
  • 🇹🇹 Trinidad & Tobago 'tt'
  • 🇹🇻 Tuvalu 'tv'
  • 🇹🇼 Taiwan 'tw'
  • 🇹🇿 Tanzania 'tz'
  • 🇺🇦 Ukraine 'ua'
  • 🇺🇬 Uganda 'ug'
  • 🇺🇸 United States 'us'
  • 🇺🇾 Uruguay 'uy'
  • 🇺🇿 Uzbekistan 'uz'
  • 🇻🇪 Venezuela 've'
  • 🇻🇬 British Virgin Islands 'vg'
  • 🇻🇳 Vietnam 'vn'
  • 🇻🇺 Vanuatu 'vu'
  • 🇾🇪 Yemen 'ye'
  • 🇿🇦 South Africa 'za'
  • 🇿🇲 Zambia 'zm'