Get a free API key on RapidAPI →
Every modern app that accepts URLs is expected to unfurl them. A user pastes a link into your chat app, comment box or CMS, and they expect a card with a title, a description and an image to appear — because that is what Slack, Discord, iMessage and Twitter have trained everyone to expect.
The naive implementation is a fetch plus a regex for og:title and og:image. In production, that breaks constantly:
The Link Preview & Open Graph Scraper API does all of the above in a single request. Call the preview endpoint with the URL you want to unfurl:
GET /preview?url=https://www.wikipedia.org/
You get back one JSON object containing the page title, description, the best image the page offers, the favicon, the canonical URL after all redirects, plus the full sets of Open Graph and Twitter card tags. Every URL in the response is already absolute, so you can drop the image straight into an img tag without any path juggling.
Pages with no metadata. The API applies a fallback chain — Open Graph first, then Twitter card tags, then plain HTML (the title element, the meta description, the first usable image). You still get a renderable card for bare-bones pages; just treat the description as optional in your UI.
Sites that block scrapers. If a domain rejects datacenter traffic, route the request through residential proxies via the API's proxy option instead of retrying and burning quota.
Canonical URLs and deduplication. The same article often circulates under many tracking-parameter variants. Use the returned canonical URL as your cache and dedupe key so ten shares of one article produce one stored preview.
Raw metadata. If you need everything the page declares — every og:* and twitter:* property, all meta tags — use /metadata instead of /preview, or hit /og and /twitter for just those tag families.
Calling link-preview-open-graph-scraper.p.rapidapi.com — replace YOUR_RAPIDAPI_KEY with your key.
curl --request GET \
--url 'https://link-preview-open-graph-scraper.p.rapidapi.com/preview?url=https%3A%2F%2Fwww.wikipedia.org%2F' \
--header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY' \
--header 'X-RapidAPI-Host: link-preview-open-graph-scraper.p.rapidapi.com'
import requests
url = "https://link-preview-open-graph-scraper.p.rapidapi.com/preview"
querystring = {"url": "https://www.wikipedia.org/"}
headers = {
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
"X-RapidAPI-Host": "link-preview-open-graph-scraper.p.rapidapi.com",
}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
const url = 'https://link-preview-open-graph-scraper.p.rapidapi.com/preview?url=https%3A%2F%2Fwww.wikipedia.org%2F';
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
'X-RapidAPI-Host': 'link-preview-open-graph-scraper.p.rapidapi.com',
},
};
const response = await fetch(url, options);
console.log(await response.json());
import axios from 'axios';
const options = {
method: 'GET',
url: 'https://link-preview-open-graph-scraper.p.rapidapi.com/preview',
params: {url: 'https://www.wikipedia.org/'},
headers: {
'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
'X-RapidAPI-Host': 'link-preview-open-graph-scraper.p.rapidapi.com',
},
};
const { data } = await axios.request(options);
console.log(data);
Powered by the Link Preview & Open Graph Scraper API on RapidAPI.