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 microlinkhq/skills
optimo
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.
49k8s-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.
32nodejs-performance
Identify, validate, and ship production-safe Node.js optimizations with execution time as the primary objective. Use when users ask to reduce latency (p50/p95/p99), improve throughput, and then reduce CPU/memory/event-loop lag/FD pressure or retry amplification, using one-PR-per-improvement workflows with benchmarks.
29use-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.
11browserless
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.
3unavatar-api
Resolve user avatars from 35+ platforms via a single API endpoint. Use when users need to display profile pictures from GitHub, X/Twitter, Instagram, Apple Music, or other platforms, look up avatars by email/username/domain, or add universal avatar resolution to user interfaces without integrating each provider individually.
3