microlink-api
Microlink API
Microlink turns a URL into structured output over HTTP. It can return metadata, media assets, scraped content, and browser-rendered results.
Quick Start
1) Pick endpoint
- Free endpoint:
https://api.microlink.io(no auth, 50 requests/day) - Pro endpoint:
https://pro.microlink.io(requiresx-api-keyheader)
2) Build a minimal request
const mql = require('@microlink/mql')
const { status, data, response } = await mql('https://example.com')
3) Add only needed options
- Metadata only: default
meta: true - Faster screenshot/PDF requests: set
meta: false - Reduce payload: use
filter(example:'url,title,image.url')
When To Use What
- Need parsed page metadata -> use default request.
- Need image capture ->
screenshot: true. - Need downloadable PDF ->
pdf: true. - Need specific DOM values ->
datarules with CSS selectors. - Need direct asset URL response (no JSON) ->
embed. - Need JS-dependent pages ->
prerender: trueor keepauto.
Response Shape
Microlink uses JSend-style responses:
{
"status": "success",
"data": {},
"message": "optional",
"more": "optional docs url"
}
status:success(2xx),fail(4xx),error(5xx)data: extracted output (title,description,image,video, and more)
Common Workflows
For copy-paste recipes, see common-workflows/README.md.
MQL Usage Notes
Install
npm install @microlink/mql
Runtime imports
- Node.js:
const mql = require('@microlink/mql') - Edge/WinterCG:
import mql from '@microlink/mql/lightweight' - Browser:
import mql from 'https://esm.sh/@microlink/mql'
Signature
mql(url, [options], [httpOptions])
url: required target URLoptions: Microlink parameters plusapiKey,cache,retryhttpOptions: forwarded to the underlying HTTP client
Extra methods: mql.stream(), mql.buffer().
Parameters At A Glance
Core
url(required): target URL with protocolmeta(defaulttrue): metadata extractiondata: custom scraping rulesfilter: comma-separated output fieldsembed: return one field directly as response body
Asset generation
screenshot/screenshot.*: create page imagepdf/pdf.*: create PDFvideo,audio: detect playable sources
Browser behavior
prerender:auto,true, orfalsewaitUntil,waitForSelector,waitForTimeout,timeoutdevice,viewport,javascript,animations,mediaTypeclick,scroll,scripts,modules,styles
Caching and performance
force: bypass cachettl(Pro): cache lifetimestaleTtl(Pro): stale-while-revalidate strategy
Pro-only
headers,proxy,filename,ttl,staleTtl
Scraping Patterns
Single value
data: {
avatar: { selector: '#avatar', attr: 'src', type: 'image' }
}
Collection
data: {
stories: { selectorAll: '.titleline > a', attr: 'text' }
}
Fallback list
data: {
title: [
{ selector: 'meta[property="og:title"]', attr: 'content' },
{ selector: 'title', attr: 'text' },
{ selector: 'h1', attr: 'text' }
]
}
Nested object
data: {
stats: {
selector: '.profile',
attr: {
followers: { selector: '.followers', type: 'number' },
stars: { selector: '.stars', type: 'number' }
}
}
}
Evaluate JS in browser context
data: {
version: { evaluate: 'window.next.version', type: 'string' }
}
Error Handling
const { MicrolinkError } = mql
try {
const { data } = await mql('https://example.com', { screenshot: true })
} catch (error) {
// error.status, error.code, error.message, error.statusCode
}
Common error codes: EAUTH, ERATE, EINVALURL, EBRWSRTIMEOUT, EPRO, ETIMEOUT.
Security And Reliability Rules
- Never expose
x-api-keyin client-side code. - Use
pro.microlink.iofor authenticated requests. - For frontend usage, use a server proxy (
microlinkhq/proxyormicrolinkhq/edge-proxy). - If a request is heavy and metadata is not needed, set
meta: false.
CLI
npm install -g @microlink/cli
microlink <url> [flags]
Common flags: --api-key, --pretty, --copy, --colors.
Deep Reference
For complete parameter-by-parameter docs, full error matrix, and response headers, see api-reference.md.
More from kikobeats/skills
k8s-hpa-cost-tuning
Tune Kubernetes HPA scale-up/down behavior, topology spread, and resource requests to reduce idle cluster capacity. Use when users need to audit cluster costs on a schedule, analyze post-incident scaling behavior, investigate why replicas or nodes do not scale down, or reduce over-reservation and wasted compute resources.
14optimo
Optimize and convert images and videos using format-specific compression pipelines on top of ImageMagick and FFmpeg. Use when users need to reduce image or video file sizes, batch-optimize a media directory, convert between formats (JPEG, PNG, WebP, AVIF, HEIC, JXL, MP4, WebM, MOV), resize media by percentage/dimensions/target file size, strip audio tracks from videos, or output optimized images as data URLs.
1html-get
Retrieve normalized, render-ready HTML from any URL using fetch or headless prerender. Use when users need to get rendered HTML from JavaScript-heavy pages, normalize relative URLs to absolute for downstream parsing, prepare HTML for metadata extraction pipelines, or choose between fast fetch and full browser rendering per URL.
1keyvhq
Build and operate key-value caching with @keyvhq/core and official storage adapters. Use when users need to add a cache layer to a Node.js module, store data with TTL expiration, choose between storage backends (in-memory, Redis, Mongo, MySQL, PostgreSQL, SQLite), implement cache-aside patterns with namespace isolation, or memoize function results.
1use-pnpm
Always use pnpm as the package manager. Use when installing, adding, or removing dependencies, running scripts, or any npm/yarn/pnpm command. Replaces npm and yarn with pnpm equivalents.
1browserless
Automate headless Chrome with a high-level Puppeteer wrapper for screenshots, PDFs, and content extraction. Use when users need to capture web page screenshots or PDFs programmatically, extract rendered HTML or text from JavaScript-heavy pages, check URL status codes, run Lighthouse audits, or build reliable headless browser automation pipelines.
1