Unfurl pasted links into rich cards
link preview API
When a user pastes a link, POST the URL to the screenshot API and get a card-sized thumbnail back; pair it with the page title and description to render the unfurl. Private, loopback and metadata addresses are blocked before navigation, so capturing arbitrary user-pasted URLs stays safe — no browser to host behind your message box.
No credit card · 100 free screenshots to start
curl https://api.apiscreenshot.com/v1/screenshot \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/article",
"format": "jpeg",
"quality": 75,
"viewport": { "width": 1200, "height": 628 }
}' \
-o preview.jpgBUY VS BUILD
Building this yourself means…
Doing it in-house is owning a browser fleet and every edge case around it. Here is the work you skip.
- Running a headless browser inside your app just to picture a pasted link.
- Showing a bare URL when a rich card would tell the reader what is behind it.
- Capturing arbitrary user-pasted URLs safely, without hitting internal addresses.
- Keeping preview latency low enough to render the card while the message sends.
HOW IT WORKS
One request, the asset back
Same shape every time: send the request, it renders on a managed browser engine, you get the image back to store or serve.
- 01
Send the request
POST your payload to /v1/screenshot with your API key — a URL or your own HTML, plus the options this job needs.
- 02
It renders
A managed browser engine loads the page, waits for it to settle, and captures it — no headless browser of your own to run or scale.
- 03
Get the asset
The response body is the image bytes, synchronously — write them to a file, push them to your bucket, or hand them to a diff. No queue to poll.
THE CALL
The exact request for link previews
The parameters this job needs, ready to paste. Full reference in the docs.
- Capture any pasted URL. POST the URL the user dropped in and get a thumbnail back — pair it with the page title and description to render a full unfurl card.
- Safe on user input. Arbitrary user URLs are user input. APIScreenshot blocks private, loopback, link-local and metadata addresses before it navigates, so a pasted internal URL returns a clean 400 instead of reaching your network.
- Light, card-sized JPEGs. Set format: "jpeg" with a quality value and a card-shaped viewport so the preview is small and quick to fetch as the message renders.
curl https://api.apiscreenshot.com/v1/screenshot \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/article",
"format": "jpeg",
"quality": 75,
"viewport": { "width": 1200, "height": 628 }
}' \
-o preview.jpgWHY IT HOLDS UP
What actually makes this work
The concrete parts: the formats, the edge cases it handles, the way it scales. Nothing here is a number we can't show you.
Safe on user-pasted input
A pasted URL is user input — private, loopback, link-local and cloud-metadata addresses are blocked before navigation, so an internal URL returns a clean 400 instead of an SSRF.
Light, card-sized images
JPEG with a quality value and a card-shaped viewport keep the preview small and quick to fetch, so the card can appear while the message is still sending.
Cache what you like
Nothing is stored on our side — cache the returned image keyed by URL in your own store so a popular link is captured once and served from cache after.
RELATED
Same API, more jobs
The one call behind link previews powers these too.
Turn any URL into a preview thumbnail
Turn any URL into a clean preview thumbnail in a single call.
View use caseGenerate a share card for every page
Render a per-page Open Graph image from your own HTML in one call.
View use caseKeep proof of how a page looked
Snapshot a page exactly as it appeared, for compliance and records.
View use caseFAQ
Link previews — common questions
- How do I generate a link preview with an API?
- POST { "url": "..." } to https://api.apiscreenshot.com/v1/screenshot with your API key and a card-shaped viewport. You get a thumbnail image back in one synchronous call; pair it with the page title and description to render the unfurl card in your chat, docs or social tool.
- Is it safe to capture URLs that users paste in?
- Yes. APIScreenshot validates the target and blocks private, loopback, link-local and cloud-metadata addresses before it navigates, so a user pasting an internal URL gets a clean 400 instead of turning the preview feature into an SSRF vector.
- How do I keep the preview image small?
- Set format: "jpeg" with a quality between 1 and 100 and a card-shaped viewport (for example 1200×628). The preview comes back already compressed and card-sized, so it is quick to fetch as the message renders.
- What should I do when a URL can't be captured?
- Treat any non-2xx response as "no preview". A blocked or malformed URL returns a 400 before navigation, so fall back to rendering the plain link rather than failing the user's message.
- Can I cache previews so a popular link isn't captured every time?
- Yes. Nothing is stored on our side, so you cache the returned image keyed by URL in your own store. A frequently shared link is then captured once and served from your cache thereafter.
- Are the captured pages stored on your servers?
- No. Each page is rendered to produce the preview, the bytes are streamed back in the response, and nothing of the page or image is persisted on our side.
Add link previews to my app
One endpoint, the asset back in one call. 100 free screenshots to start, no credit card to begin.
Cancel anytime · no long-term contract