What is Microlink
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://github.com/microlinkhq' URL:
CLI Microlink API example
microlink https://github.com/microlinkhqcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://github.com/microlinkhq"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq')Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://github.com/microlinkhq"
}
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://github.com/microlinkhq"
}
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.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://github.com/microlinkhq"
];
$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://github.com/microlinkhq")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq')The core idea
https://api.microlink.io?url=https://example.com&screenshot=true&pdf=trueWhat you can do
| Workflow | What it does | Key parameter |
|---|---|---|
| Metadata | Extract normalized title, description, image, author, date, logo from any URL | Default behavior |
| Screenshot | Capture a full-page or element-level image of any website | screenshot |
| Generate a printable document from any page | pdf | |
| Data extraction | Scrape specific fields using CSS selectors and extraction rules | data |
| Markdown | Convert page content to clean Markdown | data + attr: 'markdown' |
| Function | Run arbitrary JavaScript with full Puppeteer access | function |
| Insights | Detect technologies behind a site or run Lighthouse audits | insights |
See it in action
Extract metadata from any link
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://vercel.com' URL:
CLI Microlink API example
microlink https://vercel.comcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://vercel.com"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://vercel.com')Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://vercel.com"
}
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://vercel.com"
}
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.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://vercel.com"
];
$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://vercel.com")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://vercel.com')Take a screenshot
screenshot: true to capture a visual snapshot of the page:The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://github.com/microlinkhq' URL with 'screenshot' & 'meta' API parameters:
CLI Microlink API example
microlink https://github.com/microlinkhq&screenshotcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://github.com/microlinkhq" \
-d "screenshot=true" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq', {
screenshot: true,
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://github.com/microlinkhq",
"screenshot": "true",
"meta": "false"
}
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://github.com/microlinkhq",
screenshot: "true",
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)
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://github.com/microlinkhq",
"screenshot" => "true",
"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"
]);
$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://github.com/microlinkhq")
q.Set("screenshot", "true")
q.Set("meta", "false")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq', {
screenshot: true,
meta: false
})data.screenshot.url, hosted on a CDN and ready to use.Extract specific data
data rules to pull exactly the fields you need from any page:The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://news.ycombinator.com' URL with 'data' API parameter:
CLI Microlink API example
microlink https://news.ycombinator.com&data.stories.selectorAll=.athing&data.stories.attr.title.selector='.titleline > a'&data.stories.attr.title.attr=text&data.stories.attr.href.selector='.titleline > a'&data.stories.attr.href.attr=hrefcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://news.ycombinator.com" \
-d "data.stories.selectorAll=.athing" \
-d "data.stories.attr.title.selector=.titleline%20%3E%20a" \
-d "data.stories.attr.title.attr=text" \
-d "data.stories.attr.href.selector=.titleline%20%3E%20a" \
-d "data.stories.attr.href.attr=href"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
data: {
stories: {
selectorAll: ".athing",
attr: {
title: {
selector: ".titleline > a",
attr: "text"
},
href: {
selector: ".titleline > a",
attr: "href"
}
}
}
}
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://news.ycombinator.com",
"data.stories.selectorAll": ".athing",
"data.stories.attr.title.selector": ".titleline > a",
"data.stories.attr.title.attr": "text",
"data.stories.attr.href.selector": ".titleline > a",
"data.stories.attr.href.attr": "href"
}
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://news.ycombinator.com",
data.stories.selectorAll: ".athing",
data.stories.attr.title.selector: ".titleline > a",
data.stories.attr.title.attr: "text",
data.stories.attr.href.selector: ".titleline > a",
data.stories.attr.href.attr: "href"
}
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.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://news.ycombinator.com",
"data.stories.selectorAll" => ".athing",
"data.stories.attr.title.selector" => ".titleline > a",
"data.stories.attr.title.attr" => "text",
"data.stories.attr.href.selector" => ".titleline > a",
"data.stories.attr.href.attr" => "href"
];
$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://news.ycombinator.com")
q.Set("data.stories.selectorAll", ".athing")
q.Set("data.stories.attr.title.selector", ".titleline > a")
q.Set("data.stories.attr.title.attr", "text")
q.Set("data.stories.attr.href.selector", ".titleline > a")
q.Set("data.stories.attr.href.attr", "href")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
data: {
stories: {
selectorAll: ".athing",
attr: {
title: {
selector: ".titleline > a",
attr: "text"
},
href: {
selector: ".titleline > a",
attr: "href"
}
}
}
}
})Generate a PDF
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://example.com' URL with 'pdf' & 'meta' API parameters:
CLI Microlink API example
microlink https://example.com&pdfcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://example.com" \
-d "pdf=true" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://example.com', {
pdf: true,
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://example.com",
"pdf": "true",
"meta": "false"
}
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://example.com",
pdf: "true",
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)
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://example.com",
"pdf" => "true",
"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"
]);
$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://example.com")
q.Set("pdf", "true")
q.Set("meta", "false")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://example.com', {
pdf: true,
meta: false
})Run custom code
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://news.ycombinator.com' URL with 'function' & 'meta' API parameters:
CLI Microlink API example
microlink https://news.ycombinator.com&function='({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)'cURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://news.ycombinator.com" \
-d "function=(%7B%20page%20%7D)%20%3D%3E%20page.evaluate(()%20%3D%3E%20%60There%20are%20%24%7Bdocument.querySelectorAll(%22a%5Bhref%5D%22).length%7D%20links%60)" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
function: '({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)',
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://news.ycombinator.com",
"function": '''({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)''',
"meta": "false"
}
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://news.ycombinator.com",
function: '({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)',
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)
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://news.ycombinator.com",
"function" => '({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)',
"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"
]);
$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)
}
fn := `({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)`
q := u.Query()
q.Set("url", "https://news.ycombinator.com")
q.Set("function", fn)
q.Set("meta", "false")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
function: '({ page }) => page.evaluate(() => `There are ${document.querySelectorAll("a[href]").length} links`)',
meta: false
})When to use Microlink
- Link previews — show a rich card (title, image, description) for any URL your users share.
- Social cards and OG images — generate dynamic
og:imagescreenshots for blog posts, profiles, or dashboards. - Web scraping — extract structured data from pages that require JavaScript rendering.
- PDF generation — convert invoices, reports, or articles into downloadable documents.
- Content pipelines — convert web pages to Markdown for CMS imports or LLM training data.
- Competitive intelligence — detect the tech stack behind any website.
- Performance monitoring — run Lighthouse audits programmatically without a local Chrome installation.
- Automated testing — capture visual snapshots for regression testing across devices and viewports.
- Hard-to-reach sites — scrape or screenshot pages protected by CAPTCHAs, IP blocking, cookie banners, or bot detection.
- AI agents and LLMs — give your agent eyes and hands on the web: browse behind proxy shields, convert pages to Markdown to save tokens, and take screenshots so the model can see what's on screen.
Automatic proxy resolution PRO
When something else is better
| Scenario | Better alternative |
|---|---|
| You need to crawl thousands of pages following links | A dedicated crawler (Scrapy, Crawlee) |
| You need real-time, bidirectional browser interaction (debugging, live preview) | A local Puppeteer or Playwright instance |
| You only need static HTML — no JavaScript rendering required | A simple HTTP client (fetch, curl) |
| You need to store large volumes of scraped data | A scraping platform with built-in storage |
How requests work
- You send a URL plus optional parameters via HTTP GET.
- Microlink opens the page in a headless browser (Chromium), handling JavaScript, redirects, and rendering.
- The API executes your request — metadata extraction, screenshot capture, data rules, functions, or any combination.
- Assets are stored on a CDN and cached according to the TTL you configure.
- You get a JSON response with the results, or a direct asset response if you use
embed.
status field (success or fail) and a data object with the requested fields:{
"status": "success",
"data": {
"title": "microlink.io",
"description": "Turn websites into data.",
"image": {
"url": "https://avatars0.githubusercontent.com/u/29799436?s=280&v=4",
"type": "png",
"size": 4118,
"width": 280,
"height": 280,
"size_pretty": "4.12 kB"
}
}
}Combine workflows in one call
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://github.com/microlinkhq' URL with 'screenshot' API parameter:
CLI Microlink API example
microlink https://github.com/microlinkhq&screenshotcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://github.com/microlinkhq" \
-d "screenshot=true"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq', {
screenshot: true
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://github.com/microlinkhq",
"screenshot": "true"
}
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://github.com/microlinkhq",
screenshot: "true"
}
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.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://github.com/microlinkhq",
"screenshot" => "true"
];
$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://github.com/microlinkhq")
q.Set("screenshot", "true")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq', {
screenshot: true
})data.screenshot and the normalized metadata fields. Disable metadata with meta: false when you only need the screenshot.Embed assets directly
embed to reference the field you want:<img src="https://api.microlink.io/?url=https://github.com/microlinkhq&screenshot&meta=false&embed=screenshot.url" /><img> tags, CSS background-image, Markdown, or Open Graph meta tags — no JavaScript required.Microlink as a tool for AI agents
Browse behind anti-bot shields
Save tokens with markdown
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://example.com' URL with 'data' & 'meta' API parameters:
CLI Microlink API example
microlink https://example.com&data.content.selector=body&data.content.attr=markdowncURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://example.com" \
-d "data.content.selector=body" \
-d "data.content.attr=markdown" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://example.com', {
data: {
content: {
selector: "body",
attr: "markdown"
}
},
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://example.com",
"data.content.selector": "body",
"data.content.attr": "markdown",
"meta": "false"
}
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://example.com",
data.content.selector: "body",
data.content.attr: "markdown",
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)
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://example.com",
"data.content.selector" => "body",
"data.content.attr" => "markdown",
"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"
]);
$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://example.com")
q.Set("data.content.selector", "body")
q.Set("data.content.attr", "markdown")
q.Set("meta", "false")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://example.com', {
data: {
content: {
selector: "body",
attr: "markdown"
}
},
meta: false
})Give the model eyes
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://github.com/microlinkhq' URL with 'screenshot' & 'meta' API parameters:
CLI Microlink API example
microlink https://github.com/microlinkhq&screenshotcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://github.com/microlinkhq" \
-d "screenshot=true" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq', {
screenshot: true,
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://github.com/microlinkhq",
"screenshot": "true",
"meta": "false"
}
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://github.com/microlinkhq",
screenshot: "true",
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)
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://github.com/microlinkhq",
"screenshot" => "true",
"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"
]);
$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://github.com/microlinkhq")
q.Set("screenshot", "true")
q.Set("meta", "false")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://github.com/microlinkhq', {
screenshot: true,
meta: false
})Extract structured data for tool use
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://news.ycombinator.com' URL with 'data' & 'meta' API parameters:
CLI Microlink API example
microlink https://news.ycombinator.com&data.stories.selectorAll=.athing&data.stories.attr.title.selector='.titleline > a'&data.stories.attr.title.attr=text&data.stories.attr.href.selector='.titleline > a'&data.stories.attr.href.attr=hrefcURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://news.ycombinator.com" \
-d "data.stories.selectorAll=.athing" \
-d "data.stories.attr.title.selector=.titleline%20%3E%20a" \
-d "data.stories.attr.title.attr=text" \
-d "data.stories.attr.href.selector=.titleline%20%3E%20a" \
-d "data.stories.attr.href.attr=href" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
data: {
stories: {
selectorAll: ".athing",
attr: {
title: {
selector: ".titleline > a",
attr: "text"
},
href: {
selector: ".titleline > a",
attr: "href"
}
}
}
},
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://news.ycombinator.com",
"data.stories.selectorAll": ".athing",
"data.stories.attr.title.selector": ".titleline > a",
"data.stories.attr.title.attr": "text",
"data.stories.attr.href.selector": ".titleline > a",
"data.stories.attr.href.attr": "href",
"meta": "false"
}
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://news.ycombinator.com",
data.stories.selectorAll: ".athing",
data.stories.attr.title.selector: ".titleline > a",
data.stories.attr.title.attr: "text",
data.stories.attr.href.selector: ".titleline > a",
data.stories.attr.href.attr: "href",
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)
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://api.microlink.io/";
$params = [
"url" => "https://news.ycombinator.com",
"data.stories.selectorAll" => ".athing",
"data.stories.attr.title.selector" => ".titleline > a",
"data.stories.attr.title.attr" => "text",
"data.stories.attr.href.selector" => ".titleline > a",
"data.stories.attr.href.attr" => "href",
"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"
]);
$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://news.ycombinator.com")
q.Set("data.stories.selectorAll", ".athing")
q.Set("data.stories.attr.title.selector", ".titleline > a")
q.Set("data.stories.attr.title.attr", "text")
q.Set("data.stories.attr.href.selector", ".titleline > a")
q.Set("data.stories.attr.href.attr", "href")
q.Set("meta", "false")
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))
}import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
data: {
stories: {
selectorAll: ".athing",
attr: {
title: {
selector: ".titleline > a",
attr: "text"
},
href: {
selector: ".titleline > a",
attr: "href"
}
}
}
},
meta: false
})Why this matters
| Without Microlink | With Microlink |
|---|---|
| Agent fetches HTML, gets blocked by CAPTCHA | Automatic proxy resolution bypasses anti-bot shields |
| Raw HTML eats 10,000+ tokens per page | Markdown conversion cuts token usage by 80%+ |
| Agent cannot see visual content | Screenshot gives the model a visual snapshot |
| LLM parses messy HTML, hallucinates structure | Structured JSON extraction returns exact fields |
| You manage headless browsers, proxies, and retries | One HTTP GET call, zero infrastructure |
Built-in caching
| Parameter | What it does | Default |
|---|---|---|
ttl PRO | How long the cached response is considered fresh | 24 hours |
staleTtl PRO | How long a stale response can be served while Microlink refreshes it in the background | 0 |
force PRO | Bypass the cache entirely and generate a fresh response | false |
ttl: '1d' with staleTtl: 0 — the user always gets an instant response, and Microlink refreshes the cache in the background.Free to start, scales with you
Client libraries
| Library | Use case |
|---|---|
| MQL | JavaScript/TypeScript client for Node.js, Edge runtimes, and the browser |
| SDK | Drop-in React, Vue, and vanilla JS components for rendering link previews |
| CLI | Explore the API from your terminal during local development |
What's next
- Screenshot — capture high-quality images of any website.
- Data extraction — scrape structured data with CSS selectors.
- Metadata — get normalized link preview data.
- PDF — generate printable documents from any page.
- Markdown — convert pages to clean Markdown.
- Function — run JavaScript with full Puppeteer access.
- Insights — detect technologies or run Lighthouse audits.