apyhub
DATA EXTRACTION · SECURITY & PRIVACY

Generate Link Preview API

What it does

Link Preview Generator fetches a URL and returns the metadata you need to build link cards, unfurls, and rich previews. Send a URL, optionally add a custom user agent, Accept-Language header, redirect behavior, image meta-tag preference, and secure mode, and get structured preview data back.

The normal response includes the canonical URL, title, images, videos, favicons, siteName, mediaType, contentType, and description. When secure mode is enabled, the response can also include reported_malicious so you can block or flag suspicious links before you fetch or display them.

Use Link Preview Generator when you need to show social-style previews in a chat app, CMS, newsletter editor, or bookmarking product. It is also useful for link safety checks, where you want to screen a URL before rendering open-graph data to users.

If the URL is flagged, the response returns the threat and reported_malicious fields instead of preview metadata. That makes it straightforward to separate safe preview rendering from basic malicious-link detection.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.