How to Generate Link Previews in Your App

Link previews are everywhere: social feeds, chat apps, and CMS platforms. They instantly enrich shared links with titles, images, and descriptions. But building this yourself is harder than it seems.

Why Not Just Fetch the Page?

You could simply fetch the HTML and parse Open Graph tags. But you’ll quickly run into challenges:

Using URLPreview API

Instead of reinventing the wheel, you can rely on a simple API call:

GET https://api.urlpreview.com/v1/preview?url=https://example.com&apiKey=YOUR_API_KEY

The API returns clean JSON:

{
        "title": "Example Domain",
        "description": "This domain is for use in illustrative examples in documents.",
        "image": "https://example.com/og-image.jpg",
        "url": "https://example.com"
      }

Displaying Previews

You can render this data into any UI component—cards, embeds, or chat bubbles. Example:

Try It Yourself

Sign up for a free account and get your API key instantly. No credit card required.

Start generating link previews →