Insights: Caching and performance
Insights requests — especially Lighthouse — are among the most expensive Microlink API calls. The fastest workflows are the ones that skip unnecessary analysis, cache aggressively, and avoid redundant metadata extraction.
Skip what you do not need
The single biggest speedup is running only the analysis you actually 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 createClient from 'microlink.io'
const microlink = createClient()
const technologies = await microlink.technologies('https://vercel.com')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 createClient from 'microlink.io'
const microlink = createClient()
const technologies = await microlink.technologies('https://vercel.com')Technology detection alone is much faster than a full Insights run with Lighthouse.
Three flags that reduce work immediately:
| 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 |
Combining all three gives you the leanest possible Insights request.
Cache expensive runs PRO
Lighthouse reports rarely change minute-to-minute. Use
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' & 'apiKey' API parameters:
CLI Microlink API example
microlink https://vercel.com&insights.lighthouse&ttl=1d&staleTtl=0 --api-key YOUR_API_TOKENcURL Microlink API example
curl -G "https://pro.microlink.io" \
-H "x-api-key: YOUR_API_TOKEN" \
-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 createClient from 'microlink.io'
const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })
const report = await microlink.lighthouse('https://vercel.com', {
ttl: "1d",
staleTtl: 0
})Python Microlink API example
import requests
url = "https://pro.microlink.io/"
querystring = {
"url": "https://vercel.com",
"insights.technologies": "false",
"insights.lighthouse": "true",
"meta": "false",
"ttl": "1d",
"staleTtl": "0"
}
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://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)
request['x-api-key'] = "YOUR_API_TOKEN"
response = http.request(request)
puts response.bodyPHP Microlink API example
<?php
$baseUrl = "https://pro.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",
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://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)
}
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))
}import createClient from 'microlink.io'
const microlink = createClient({ apiKey: "YOUR_API_TOKEN" })
const report = await microlink.lighthouse('https://vercel.com', {
ttl: "1d",
staleTtl: 0
})Cache the Lighthouse report for a day.
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
Use
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 createClient from 'microlink.io'
const microlink = createClient()
const technologies = await microlink.technologies('https://vercel.com', {
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 createClient from 'microlink.io'
const microlink = createClient()
const technologies = await microlink.technologies('https://vercel.com', {
force: true
})Use
force after a deployment or site change when you need a guaranteed fresh result.Verify what happened
Check these response headers to confirm the request behaved as expected:
| 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 |
Next step
If Insights results are missing, slow, or wrong, continue with troubleshooting.