Skip to content

Common patterns: Proxy

These proxy patterns apply to every Microlink workflow: screenshots, PDFs, data extraction, metadata, and insights. Use them whenever a target site blocks headless browsers, enforces rate limits on a specific IP, or geofences content by region.

When you need a proxy

Not every site needs one. Use a proxy when you encounter:
SignalWhat is happening
EPROXYNEEDED error codeThe API detected blocking and the request cannot succeed without a proxy
Empty or partial results on a known-good URLThe target is returning a CAPTCHA or an antibot challenge page
Works locally but not via the APIYour origin IP is blocked or throttled by the target
Content differs by regionThe target serves different content based on geographic IP

Automatic proxy
PRO

Every API key, the free one included, comes with automatic proxy resolution. You do not need to supply a proxy URL. When Microlink detects an antibot block on a page's HTML, it can retry the request through proxy tiers automatically. This covers metadata, Markdown, text, HTML and data extraction. Screenshots and PDFs only use a proxy when you set proxy.location or proxy.url.
Microlink chooses proxy tiers based on the domain or the type of block. Read more about antibot detection. Some sites may still block it. We test against the Top 500 most popular websites worldwide.
Check the x-fetch-mode response header to see how the HTML was fetched. A value ending in -proxy means the HTML fetch used a proxy. The header doesn't show how a screenshot or PDF was routed:
x-fetch-mode: prerender-proxy

Bring your own proxy
PRO

If you have a dedicated proxy service (for example a residential proxy with a specific country IP), pass it as proxy.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' & 'apiKey' API parameters:

CLI Microlink API example

microlink https://geolocation.microlink.io --proxy.url https://myproxy:603f60f5@superproxy.cool:8001 --api-key YOUR_API_TOKEN

cURL Microlink API example

curl -G "https://pro.microlink.io" \
  -H "x-api-key: YOUR_API_TOKEN" \
  -d "url=https://geolocation.microlink.io" \
  -d "proxy.url=https://myproxy:603f60f5@superproxy.cool:8001"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })

const data = await microlink.metadata('https://geolocation.microlink.io', {
  proxy: {
    url: "https://myproxy:603f60f5@superproxy.cool:8001"
  }
})

Python Microlink API example

import requests

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

querystring = {
    "url": "https://geolocation.microlink.io",
    "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001"
}

headers = {
    "x-api-key": "YOUR_API_TOKEN"
}

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

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

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

params = {
  url: "https://geolocation.microlink.io",
  "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001"
}

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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

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

$params = [
    "url" => "https://geolocation.microlink.io",
    "proxy.url" => "https://myproxy:603f60f5@superproxy.cool:8001"
];

$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",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_TOKEN"
    ]
]);

$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://pro.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.url", "https://myproxy:603f60f5@superproxy.cool:8001")
    u.RawQuery = q.Encode()

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

    req.Header.Set("x-api-key", "YOUR_API_TOKEN")

    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))
}
An x-fetch-mode value ending in -proxy means the HTML fetch used a proxy.
The proxy URL must be a valid WHATWG URL. A bare proxy string is still accepted and treated as proxy.url. The supported format is:
https://username:password@hostname:port
All sub-requests made while resolving the target URL (redirects, assets, dynamic fetches) go through the same proxy server.

Verify proxy is active

Check these response headers to confirm a proxy was used:
HeaderExpected value
x-fetch-modeA value ending in -proxy (e.g. prerender-proxy, fetch-proxy) means the HTML fetch used a proxy
x-pricing-planpro, which any request with an API key returns, the free one included
x-cache-statusMISS on a fresh uncached request
A full response using a proxy looks like:
HTTP/2 200
content-type: application/json; charset=utf-8
x-response-time: 1.7s
x-pricing-plan: pro
x-fetch-mode: prerender-proxy
x-cache-ttl: 86400000
x-request-id: iad:2eb66538-0a16-4c56-b613-511d99507c9f
x-cache-status: MISS
cache-control: public, must-revalidate, max-age=0

Combine proxy with other parameters

Proxy works with every workflow parameter. Some useful combinations:

Screenshot through a proxy

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

CLI Microlink API example

microlink screenshot https://microlink.io --proxy.url https://myproxy:603f60f5@superproxy.cool:8001 --api-key YOUR_API_TOKEN

cURL Microlink API example

curl -G "https://pro.microlink.io" \
  -H "x-api-key: YOUR_API_TOKEN" \
  -d "url=https://microlink.io" \
  -d "screenshot=true" \
  -d "meta=false" \
  -d "proxy.url=https://myproxy:603f60f5@superproxy.cool:8001"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })

const data = await microlink.screenshot('https://microlink.io', {
  proxy: {
    url: "https://myproxy:603f60f5@superproxy.cool:8001"
  }
})

Python Microlink API example

import requests

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

querystring = {
    "url": "https://microlink.io",
    "screenshot": "true",
    "meta": "false",
    "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001"
}

headers = {
    "x-api-key": "YOUR_API_TOKEN"
}

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

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

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

params = {
  url: "https://microlink.io",
  screenshot: "true",
  meta: "false",
  "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001"
}

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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

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

$params = [
    "url" => "https://microlink.io",
    "screenshot" => "true",
    "meta" => "false",
    "proxy.url" => "https://myproxy:603f60f5@superproxy.cool:8001"
];

$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",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_TOKEN"
    ]
]);

$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://pro.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://microlink.io")
    q.Set("screenshot", "true")
    q.Set("meta", "false")
    q.Set("proxy.url", "https://myproxy:603f60f5@superproxy.cool:8001")
    u.RawQuery = q.Encode()

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

    req.Header.Set("x-api-key", "YOUR_API_TOKEN")

    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))
}
Adding meta: false skips metadata extraction and focuses the request on the screenshot alone.

Data extraction through a proxy

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

CLI Microlink API example

microlink extract https://microlink.io --data '{"title":{"selector":"h1","attr":"text"}}' --proxy.url https://myproxy:603f60f5@superproxy.cool:8001 --api-key YOUR_API_TOKEN

cURL Microlink API example

curl -G "https://pro.microlink.io" \
  -H "x-api-key: YOUR_API_TOKEN" \
  -d "url=https://microlink.io" \
  -d "data.title.selector=h1" \
  -d "data.title.attr=text" \
  -d "proxy.url=https://myproxy:603f60f5@superproxy.cool:8001" \
  -d "meta=false"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })

const { title } = await microlink.extract('https://microlink.io', {
  title: {
    selector: "h1",
    attr: "text"
  }
}, {
  proxy: {
    url: "https://myproxy:603f60f5@superproxy.cool:8001"
  }
})

Python Microlink API example

import requests

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

querystring = {
    "url": "https://microlink.io",
    "data.title.selector": "h1",
    "data.title.attr": "text",
    "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001",
    "meta": "false"
}

headers = {
    "x-api-key": "YOUR_API_TOKEN"
}

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

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

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

params = {
  url: "https://microlink.io",
  "data.title.selector": "h1",
  "data.title.attr": "text",
  "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001",
  meta: "false"
}

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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

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

$params = [
    "url" => "https://microlink.io",
    "data.title.selector" => "h1",
    "data.title.attr" => "text",
    "proxy.url" => "https://myproxy:603f60f5@superproxy.cool:8001",
    "meta" => "false"
];

$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",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_TOKEN"
    ]
]);

$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://pro.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://microlink.io")
    q.Set("data.title.selector", "h1")
    q.Set("data.title.attr", "text")
    q.Set("proxy.url", "https://myproxy:603f60f5@superproxy.cool:8001")
    q.Set("meta", "false")
    u.RawQuery = q.Encode()

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

    req.Header.Set("x-api-key", "YOUR_API_TOKEN")

    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))
}
Pass custom extraction rules alongside a proxy when the target requires one to deliver content.

Proxy with retry for flaky targets

Some proxy endpoints are temporarily unreachable or the target site intermittently challenges requests. Combine proxy with retry to handle transient failures automatically:

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

CLI Microlink API example

microlink https://microlink.io --proxy.url https://myproxy:603f60f5@superproxy.cool:8001 --retry 3 --meta false --api-key YOUR_API_TOKEN

cURL Microlink API example

curl -G "https://pro.microlink.io" \
  -H "x-api-key: YOUR_API_TOKEN" \
  -d "url=https://microlink.io" \
  -d "proxy.url=https://myproxy:603f60f5@superproxy.cool:8001" \
  -d "retry=3" \
  -d "meta=false"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })

const data = await microlink.metadata('https://microlink.io', {
  proxy: {
    url: "https://myproxy:603f60f5@superproxy.cool:8001"
  },
  retry: 3
})

Python Microlink API example

import requests

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

querystring = {
    "url": "https://microlink.io",
    "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001",
    "retry": "3",
    "meta": "false"
}

headers = {
    "x-api-key": "YOUR_API_TOKEN"
}

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

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

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

params = {
  url: "https://microlink.io",
  "proxy.url": "https://myproxy:603f60f5@superproxy.cool:8001",
  retry: "3",
  meta: "false"
}

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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

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

$params = [
    "url" => "https://microlink.io",
    "proxy.url" => "https://myproxy:603f60f5@superproxy.cool:8001",
    "retry" => "3",
    "meta" => "false"
];

$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",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_TOKEN"
    ]
]);

$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://pro.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://microlink.io")
    q.Set("proxy.url", "https://myproxy:603f60f5@superproxy.cool:8001")
    q.Set("retry", "3")
    q.Set("meta", "false")
    u.RawQuery = q.Encode()

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

    req.Header.Set("x-api-key", "YOUR_API_TOKEN")

    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))
}
Server-side retries with exponential backoff reduce failures from temporarily blocked or slow proxy connections.

Geolocation: Target region-specific content

A common use case is scraping a site that serves different content depending on the visitor's country. Pin Microlink's proxy to that country with proxy.location
PRO
:

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://example.com/pricing' URL with 'proxy', 'meta' & 'apiKey' API parameters:

CLI Microlink API example

microlink https://example.com/pricing --proxy.location fr --meta false --api-key YOUR_API_TOKEN

cURL Microlink API example

curl -G "https://pro.microlink.io" \
  -H "x-api-key: YOUR_API_TOKEN" \
  -d "url=https://example.com/pricing" \
  -d "proxy.location=fr" \
  -d "meta=false"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })

const data = await microlink.metadata('https://example.com/pricing', {
  proxy: {
    location: "fr"
  }
})

Python Microlink API example

import requests

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

querystring = {
    "url": "https://example.com/pricing",
    "proxy.location": "fr",
    "meta": "false"
}

headers = {
    "x-api-key": "YOUR_API_TOKEN"
}

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

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

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

params = {
  url: "https://example.com/pricing",
  "proxy.location": "fr",
  meta: "false"
}

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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

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

$params = [
    "url" => "https://example.com/pricing",
    "proxy.location" => "fr",
    "meta" => "false"
];

$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",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_TOKEN"
    ]
]);

$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://pro.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://example.com/pricing")
    q.Set("proxy.location", "fr")
    q.Set("meta", "false")
    u.RawQuery = q.Encode()

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

    req.Header.Set("x-api-key", "YOUR_API_TOKEN")

    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 request is resolved through a French IP. The default is us. See the location reference for every supported country code.
Confirm the exit country before sending production requests:

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', 'meta' & 'apiKey' API parameters:

CLI Microlink API example

microlink https://geolocation.microlink.io --proxy.location fr --meta false --api-key YOUR_API_TOKEN

cURL Microlink API example

curl -G "https://pro.microlink.io" \
  -H "x-api-key: YOUR_API_TOKEN" \
  -d "url=https://geolocation.microlink.io" \
  -d "proxy.location=fr" \
  -d "meta=false"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })

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

Python Microlink API example

import requests

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

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

headers = {
    "x-api-key": "YOUR_API_TOKEN"
}

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

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

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

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

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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

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

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

$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",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_TOKEN"
    ]
]);

$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://pro.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", "fr")
    q.Set("meta", "false")
    u.RawQuery = q.Encode()

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

    req.Header.Set("x-api-key", "YOUR_API_TOKEN")

    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))
}
geolocation.microlink.io returns the origin IP and country seen by the server, useful to confirm the request is routing through the right region.
If you already pay for a country-specific proxy, you can still pass that URL as proxy.url instead.

Keep proxy credentials secure

Proxy URLs contain credentials. Treat them the same as API keys:
  • Never embed them in client-side code, public HTML, or embed URLs.
  • Pass them from environment variables in server-side code:
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { title, description } = await microlink.metadata('https://example.com', {
  proxy: { url: process.env.PROXY_URL }
})

Error codes

ErrorCauseFix
EPROXYNEEDEDAn antibot block on a page's HTML, on a request without an API keySend an API key, the free one included, so Microlink can retry through the proxy
EPROXYproxy parameter used without an API keySend an API key, the free one included
EAUTHAPI key missing or invalidCheck your x-api-key header
EPROSent x-api-key to api.microlink.ioUse pro.microlink.io instead
See the full error codes reference and the proxy parameter reference for all supported values.

See also