Skip to content

Overview

Microlink SDK is the official way to consume Microlink API programmatically. It's published on npm as microlink.io and organizes the API into semantic products — one method per product — so you call microlink.screenshot(url) instead of composing query strings by hand.
npm install microlink.io
Create a client once and call any product from it:
import createClient from 'microlink.io'

const microlink = createClient()

const { title, description } = await microlink.metadata('https://vercel.com')
CommonJS is supported too:
const createClient = require('microlink.io')
const microlink = createClient()
The same code runs in Node.js, browsers, and Deno, returning the same responses everywhere.

Authentication

createClient() works without an API key on the free plan out of the box. Pass an apiKey to unlock pro quotas — it travels as the x-api-key header:
const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})
search is the exception: it requires an apiKey on every request.
Any other option passed to createClient is merged into every API call, which makes it the right place for defaults such as ttl or prerender.

Methods

Every product is a method on the client:
  • Contentmetadata, markdown, html, text, screenshot, pdf, logo, embed.
  • Specializedrun, search, video, audio, extract, technologies, lighthouse.
  • Collectionslinks, images, videos, audios, emails.

How it fits together

The SDK is a thin semantic layer over @microlink/mql: HTTP, authentication, retries, errors, and binary handling are already solved there. Each method sets the right API parameters and unwraps the result for you. Installing the package also ships a microlink binary where every product is a subcommand.
Looking for the legacy Microlink Embed SDK, the drop-in link preview component for React, Vue, and vanilla JavaScript? Its documentation lives at SDK legacy. It keeps working, but it's no longer maintained.