## Table of Contents

- [Caching and performance](#caching-and-performance)
- [Skip what you do not need](#skip-what-you-do-not-need)
  - [CLI Microlink API example](#cli-microlink-api-example)
  - [cURL Microlink API example](#curl-microlink-api-example)
  - [JavaScript Microlink API example](#javascript-microlink-api-example)
  - [Python Microlink API example](#python-microlink-api-example)
  - [Ruby Microlink API example](#ruby-microlink-api-example)
  - [PHP Microlink API example](#php-microlink-api-example)
  - [Golang Microlink API example](#golang-microlink-api-example)
- [Cache expensive runs PRO](#cache-expensive-runs-pro)
  - [CLI Microlink API example](#cli-microlink-api-example-1)
  - [cURL Microlink API example](#curl-microlink-api-example-1)
  - [JavaScript Microlink API example](#javascript-microlink-api-example-1)
  - [Python Microlink API example](#python-microlink-api-example-1)
  - [Ruby Microlink API example](#ruby-microlink-api-example-1)
  - [PHP Microlink API example](#php-microlink-api-example-1)
  - [Golang Microlink API example](#golang-microlink-api-example-1)
- [Bypass cache when needed](#bypass-cache-when-needed)
  - [CLI Microlink API example](#cli-microlink-api-example-2)
  - [cURL Microlink API example](#curl-microlink-api-example-2)
  - [JavaScript Microlink API example](#javascript-microlink-api-example-2)
  - [Python Microlink API example](#python-microlink-api-example-2)
  - [Ruby Microlink API example](#ruby-microlink-api-example-2)
  - [PHP Microlink API example](#php-microlink-api-example-2)
  - [Golang Microlink API example](#golang-microlink-api-example-2)
- [Verify what happened](#verify-what-happened)

---

[](https://microlink.io/docs/api/getting-started/overview)

[API](https://microlink.io/docs/api/getting-started/overview)

[](https://microlink.io/docs/guides)

GUIDES

[](https://microlink.io/docs/mql/getting-started/overview)

MQL

[](https://microlink.io/docs/sdk/getting-started/overview)

SDK

[](https://microlink.io/docs/cards/getting-started/overview)

CARDS

## 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

``` bash
microlink https://vercel.com&insights.technologies
```

### cURL Microlink API example

``` bash
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

``` javascript
import mql from '@microlink/mql'

const { data } = await mql('https://vercel.com', {
  insights: {
    technologies: true,
    lighthouse: false
  },
  meta: false
})
```

### Python Microlink API example

``` python
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

``` ruby
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.body
```

### PHP Microlink API example

``` php
<?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

``` bash
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))
}
```

``` javascript
import mql from '@microlink/mql'

const { data } = await mql('https://vercel.com', {

  insights: {

    technologies: true,

    lighthouse: false

  },

  meta: false

})
```

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' API parameters:

### CLI Microlink API example

``` bash
microlink https://vercel.com&insights.lighthouse&ttl=1d&staleTtl=0
```

### cURL Microlink API example

``` bash
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

``` javascript
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

``` python
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

``` ruby
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.body
```

### PHP Microlink API example

``` php
<?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

``` bash
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))
}
```

``` javascript
import mql from '@microlink/mql'

const { data } = await mql('https://vercel.com', {

  insights: {

    technologies: false,

    lighthouse: true

  },

  meta: false,

  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                    |

See the [ttl](https://microlink.io/docs/api/parameters/ttl) and [staleTtl](https://microlink.io/docs/api/parameters/staleTtl) references for all supported formats.

## 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

``` bash
microlink https://vercel.com&insights.technologies&force
```

### cURL Microlink API example

``` bash
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

``` javascript
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

``` python
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

``` ruby
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.body
```

### PHP Microlink API example

``` php
<?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

``` bash
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))
}
```

``` javascript
import mql from '@microlink/mql'

const { data } = await mql('https://vercel.com', {

  insights: {

    technologies: true,

    lighthouse: false

  },

  meta: false,

  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                                     |

If Insights results are missing, slow, or wrong, continue with [troubleshooting](https://microlink.io/docs/guides/insights/troubleshooting).