Skip to content

CLI

Installing microlink.io also ships a microlink binary where every product is a subcommand. Flags map one-to-one to the options each method accepts:
npm install -g microlink.io
microlink https://example.com
microlink markdown https://example.com
microlink screenshot https://example.com --fullPage
microlink logo https://github.com --square
microlink links https://example.com
microlink search "best coffee" --limit 10 --location es
Passing a URL with no product returns metadata. Strings print raw; objects pretty-print as JSON, so the output is pipe-friendly. Every subcommand except search runs on the free tier without credentials.
Print the markdown reference for any product with docs:
microlink extract docs
microlink screenshot docs
Run microlink --help for the list of products, or microlink <product> --help for the flags a product accepts. You can also try it without installing anything:
npx microlink.io screenshot https://example.com --fullPage

Authentication

The search product needs an API key, and any other product uses it to unlock the pro plan. The CLI resolves it, in this order, from the --api-key flag, the MICROLINK_API_KEY environment variable, or the key saved by microlink login:
microlink search "web performance" --api-key YOUR_KEY
export MICROLINK_API_KEY=YOUR_KEY
microlink screenshot https://example.com
microlink login
login opens your dashboard in the browser, lets you pick one of your API keys, and saves it under ~/.config/microlink/config.json with owner-only permissions. microlink logout removes it.

Headers

Forward headers to the target page with --header (or -H), repeatable:
microlink markdown https://example.com --header 'Cookie: auth_token=…'
Headers meant for the API request itself, rather than the target page, take the --http.header.<name> form:
microlink pdf https://example.com --http.header.authorization 'Bearer …'

Structured input

Commands that take structured arguments accept inline JSON. extract reads its rules from --data, and function reads its code from a file:
microlink extract https://microlink.io --data '{"image":{"selector":"meta[property=og:image]","attr":"content","type":"image"}}'
microlink function https://example.com --file ./fn.js
Any extra flag passed to function is forwarded to the function as a named argument, the same way custom parameters work in the SDK.
Object-shaped options such as --viewport, --overlay, or --margin take JSON too:
microlink screenshot https://example.com --viewport '{"width":1280,"height":800}'

Tracing

Add --trace to print the exact API request and response instead of the result, with the API key masked. --trace-full prints the key in clear:
microlink screenshot https://example.com --fullPage --trace
Every successful call also prints a footer to stderr with the response size, timing, cache status, and x-request-id, so stdout stays clean for piping.
--trace is not available for search and function, which use their own transports.

Endpoint

Point the CLI at a different API deployment with --endpoint, mirroring the client-level option of the same name:
microlink metadata https://example.com --endpoint https://microlink.internal.example.com
See the CLI page for a walkthrough.