Skip to content
Core feature · free tier

Data extraction: turn any page into structured JSON

Describe the fields you want with CSS selectors and the data parameter does the rest — no headless browser to run, no HTML to parse. Works on the free tier; Pro adds automatic proxy resolution when targets fight back.

Selectors in, JSON out
data · every plan
Your code
data extraction rules
Microlink API
headless Chrome, prerender
Rules applied
selector · attr · type · evaluate
Structured JSON
data payload in the response

Each key inside data becomes a field in the response — validated by type on the way out.

Your output schema

The data object you send is the shape of the JSON you get back. Point a selector at an element, pick what to read with attr — text, an attribute, HTML, even markdown — and validate the result with type: url, number, date, image, and more.

Pages change and selectors break — so a rule can also be an array of fallbacks, tried in priority order until one succeeds. When CSS alone is not enough, evaluate runs a JavaScript function against the page to compute the value.

Microlink runs the headless browser, waits for the content, applies your rules, and returns clean JSON — the same request can also capture the screenshot, render the PDF, or read the metadata of the page.

Three rule shapes → one parameter

From a single field to a full collection

Every extraction rule is built from the same five properties — selector, selectorAll, attr, type, and evaluate. Combine them to match the shape of the data you are after.

01 · selector
Single values
Point a CSS selector at one element and read what you need: visible text, an attribute like href or src, inner HTML, or a markdown rendition. Add type to validate and normalize the value before it reaches your code.
attr: 'text'attr: 'href'type: 'url'type: 'number'
02 · selectorAll
Collections
Match every element on the page and get an array back. Nest attr rules inside and each match becomes a structured object — title, link, price — instead of a flat string. One request, the whole listing.
headlinespricesreviewsjob listings
03 · evaluate
Computed values
When CSS alone cannot express it, run a JavaScript function against the page and return the result as the field value. Combine with type validation and fallback arrays so extraction keeps working when pages change.
evaluatetype: 'date'fallback arrays
Code

Your first extraction, two rules

Each key inside data is a field in the response. Here headline reads the text and link reads the href, validated as a URL — no parsing on your side.

index.js
import mql from '@microlink/mql'

const { data } = await mql('https://news.ycombinator.com', {
  data: {
    headline: { selector: '.titleline > a', attr: 'text' },
    link: { selector: '.titleline > a', attr: 'href', type: 'url' }
  }
})

console.log(data.headline, data.link)
Collections

Every match, as structured objects

selectorAll turns the rule into an array; nested attr rules run against each match. Add meta: false to skip metadata and get just your fields back.

index.js
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', type: 'url' }
      }
    }
  },
  meta: false
})
When targets fight back

Pro adds the unblocking layer

Extraction rules are half the job — the other half is getting the page to render at all. Every Pro plan bundles the pieces that keep scraping working in production: automatic proxy resolution against antibots, custom headers for login walls, and configurable cache TTL so repeated extractions cost nothing.

01 · proxy
Antibot resolution, zero configuration
When a target blocks the request, Microlink identifies the antibot provider and routes through a dedicated resolution path — no proxy pool to manage, no CAPTCHA solver to integrate. The resolution layer is well-tested across the Top 500 most popular sites worldwide.
CloudflareDataDomeAkamaiPerimeterX
EPROXYNEEDED is the signal a target requires it; a response served through the proxy layer carries x-fetch-mode: fetch-proxy. You can also bring your own exit IP with the proxy parameter.
02 · x-api-header-*
Extraction behind login walls
Scrape the logged-in version of a page by forwarding the session: send x-api-header-cookie as a request header and Microlink forwards the original cookie to the target — the credential rides inside HTTPS and never touches the URL.
cookieauthorizationx-csrf-token

Selectors in, JSON out.

Prototype on the free tier — 25 requests a day, no API key. When you go to production, Pro plans start at 14,000 requests per month and bundle proxy resolution, custom headers, and configurable TTL.

Do I need to run a headless browser?

No. Microlink runs headless Chrome on its infrastructure and applies your CSS selectors server-side — you send a data object and receive JSON back.
For client-rendered content, control the rendering with prerender and wait for dynamic elements with waitForSelector before the rules are applied — see the page preparation guide.

Is data extraction available on the free plan?

Yes. Every rule type — selector, selectorAll, attr, type, evaluate, fallbacks — works on the free tier, which includes 25 requests per day without an API key.
Pro plans start at 14,000 requests per month and add automatic proxy resolution, custom headers, and configurable TTL on top.

What happens when a selector doesn't match?

Define a rule as an array of fallbacks and Microlink tries each one in priority order until a value passes the type validation — for example og:title, then title, then the first h1.
If nothing matches, the field comes back empty rather than failing the request — the troubleshooting guide covers how to diagnose selector, timing, and prerender issues.

Can I scrape sites behind Cloudflare or DataDome?

Yes, on Pro plans. Microlink detects the antibot provider protecting the target — Cloudflare, DataDome, Akamai, PerimeterX, and more — and automatically routes the request through a dedicated resolution path, tested across the Top 500 most popular sites worldwide.
If a target requires it, the API returns EPROXYNEEDED; proxied responses carry x-fetch-mode ending in -proxy. See how the proxy works.

Can I extract data behind a login?

Yes — forward the session as a request header on your Microlink call using x-api-header-cookie (a Pro feature). The credential travels inside HTTPS request headers, never in the URL, so it does not end up in logs or embeds.
The private pages guide walks through cookies, basic auth, and bearer tokens.

How does caching affect what I pay?

Responses are cached at the edge and any response served from cache does not count against your plan quota — only the request that warms the cache is billed.
Tune the lifetime per request with ttl (from 1 minute to 31 days) and serve stale content while revalidating with staleTtl — the caching guide shows the patterns for recurring extraction jobs.

Can I transform values during extraction?

Yes. The evaluate property runs a JavaScript function against the page and uses its return value as the field — useful for computed values, JSON embedded in scripts, or anything CSS selectors cannot reach.
Combine it with type so the output is validated before it reaches your code — see the data reference. When a single rule is not enough, browser functions run your code with full Puppeteer access.