When someone pastes a link into a chat, a comment box, a CMS or a social feed, people expect a card: the page's title, a line of description, an image and the site's icon. Building that yourself means fetching arbitrary URLs from your own servers, parsing tags that are often missing or wrong, and handling pages that only exist once JavaScript runs.
What Readmint does for you
- One call per link:
POST /v1/previewreturnstitle,description,site_name,imagewithwidthandheight,favicon,theme_colorand, for oEmbed sites such as YouTube, the provider's embed answer. - Fallbacks: Open Graph, then Twitter's tags, then the page itself. A page with no title in its HTML is loaded in a real browser.
- Image sizes without downloading the image in the client: when a page doesn't state its image's size, Readmint reads it from the image file, so the card's layout doesn't jump.
- No server-side request forgery: links to
localhost, private networks or cloud metadata addresses are refused, after every redirect. That's the classic hole in home-made preview services. - Caching: a preview is kept for a day by default (
max_age).
How it fits
- Your client sends the pasted URL to your server.
- Your server calls Readmint with your key (never put the key in the client) and stores the answer with the message.
- The client draws the card from the stored fields.
// Your server: preview a link once, when the message is posted.
async function preview(url) {
const res = await fetch('https://api-readmint.plxi.us/v1/preview', {
method: 'POST',
headers: { 'X-API-Key': process.env.READMINT_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ url }),
});
if (!res.ok) return null; // refused links (4xx) aren't charged: show the plain link
const p = await res.json();
return { title: p.title, description: p.description, image: p.image, icon: p.favicon, site: p.site_name };
}
Cost
Each preview is one page from your plan: 1,000 a month free, 20,000 on Starter, 200,000 on Pro. Refused links are free.