Caching and performance
Skip what you do not need
The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://vercel.com' URL with 'insights' & 'meta' API parameters:
CLI Microlink API example
microlink https://vercel.com&insights.technologiescURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://vercel.com" \
-d "insights.technologies=true" \
-d "insights.lighthouse=false" \
-d "meta=false"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://vercel.com', {
insights: {
technologies: true,
lighthouse: false
},
meta: false
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://vercel.com",
"insights.technologies": "true",
"insights.lighthouse": "false",
"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://vercel.com",
insights.technologies: "true",
insights.lighthouse: "false",
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://vercel.com",
"insights.technologies" => "true",
"insights.lighthouse" => "false",
"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://vercel.com")
q.Set("insights.technologies", "true")
q.Set("insights.lighthouse", "false")
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://vercel.com', {
insights: {
technologies: true,
lighthouse: false
},
meta: false
})| Flag | Effect |
|---|---|
insights: { lighthouse: false } | Skip Lighthouse entirely — technology detection is lightweight |
meta: false | Skip normalized metadata extraction |
filter: 'insights' | Return only the Insights payload, stripping unrelated fields |
Cache expensive runs PRO
ttl to cache the result and staleTtl to serve the cached copy while a background refresh runs:The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://vercel.com' URL with 'insights', 'meta', 'ttl' & 'staleTtl' API parameters:
CLI Microlink API example
microlink https://vercel.com&insights.lighthouse&ttl=1d&staleTtl=0cURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://vercel.com" \
-d "insights.technologies=false" \
-d "insights.lighthouse=true" \
-d "meta=false" \
-d "ttl=1d" \
-d "staleTtl=0"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://vercel.com', {
insights: {
technologies: false,
lighthouse: true
},
meta: false,
ttl: "1d",
staleTtl: 0
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://vercel.com",
"insights.technologies": "false",
"insights.lighthouse": "true",
"meta": "false",
"ttl": "1d",
"staleTtl": "0"
}
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",
insights.technologies: "false",
insights.lighthouse: "true",
meta: "false",
ttl: "1d",
staleTtl: "0"
}
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",
"insights.technologies" => "false",
"insights.lighthouse" => "true",
"meta" => "false",
"ttl" => "1d",
"staleTtl" => "0"
];
$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")
q.Set("insights.technologies", "false")
q.Set("insights.lighthouse", "true")
q.Set("meta", "false")
q.Set("ttl", "1d")
q.Set("staleTtl", "0")
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', {
insights: {
technologies: false,
lighthouse: true
},
meta: false,
ttl: "1d",
staleTtl: 0
})staleTtl: 0 means the next request after expiration immediately returns the stale copy while refreshing in the background.| Pattern | TTL | staleTtl | Best for |
|---|---|---|---|
| Daily monitoring dashboard | '1d' | 0 | Scheduled checks that tolerate day-old data |
| Weekly audit reports | '7d' | '1d' | Low-frequency reporting |
| On-demand one-off checks | omit | omit | Fresh results every time |
Bypass cache when needed
force: true to invalidate the cache and generate a fresh analysis:The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://vercel.com' URL with 'insights', 'meta' & 'force' API parameters:
CLI Microlink API example
microlink https://vercel.com&insights.technologies&forcecURL Microlink API example
curl -G "https://api.microlink.io" \
-d "url=https://vercel.com" \
-d "insights.technologies=true" \
-d "insights.lighthouse=false" \
-d "meta=false" \
-d "force=true"JavaScript Microlink API example
import mql from '@microlink/mql'
const { data } = await mql('https://vercel.com', {
insights: {
technologies: true,
lighthouse: false
},
meta: false,
force: true
})Python Microlink API example
import requests
url = "https://api.microlink.io/"
querystring = {
"url": "https://vercel.com",
"insights.technologies": "true",
"insights.lighthouse": "false",
"meta": "false",
"force": "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://vercel.com",
insights.technologies: "true",
insights.lighthouse: "false",
meta: "false",
force: "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://vercel.com",
"insights.technologies" => "true",
"insights.lighthouse" => "false",
"meta" => "false",
"force" => "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://vercel.com")
q.Set("insights.technologies", "true")
q.Set("insights.lighthouse", "false")
q.Set("meta", "false")
q.Set("force", "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://vercel.com', {
insights: {
technologies: true,
lighthouse: false
},
meta: false,
force: true
})force after a deployment or site change when you need a guaranteed fresh result.Verify what happened
| Header | What it tells you |
|---|---|
x-cache-status | HIT (served from cache), MISS (fresh), or BYPASS (force) |
x-cache-ttl | The effective cache lifetime in milliseconds |
x-fetch-mode | Whether the request was fetched, prerendered, or proxy-backed |
x-response-time | The total request duration |