Skip to content

Options

Every method accepts an options object as its last argument. Its keys are routed automatically so you never have to remember how the underlying API call is shaped:
  • Product-specific keys — such as fullPage for screenshot, format for pdf, or selector for markdown — are nested under the right product parameter.
  • headers — sent as HTTP request headers, never serialized into the URL.
  • Everything else — passed through as top-level API query parameters.
const { url } = await microlink.screenshot('https://example.com', {
  fullPage: true,
  device: 'iPhone 11'
})
Here fullPage nests under screenshot while device stays a top-level query parameter.

Headers

Use headers to authenticate against the target page. Any header prefixed with x-api-header- is forwarded to the target site with the prefix stripped:
const markdown = await microlink.markdown('https://x.com/some/article', {
  headers: {
    'x-api-header-cookie': 'auth_token=…'
  }
})
See headers for the full behavior.

Client-level defaults

Options passed to createClient apply to every call, and per-call options win over them:
const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY,
  ttl: '1d'
})

await microlink.pdf('https://example.com', { ttl: '12h' })