apyhub
Back
▣ DATA EXTRACTION · SEO

Generate Link Preview API

Hosted on ApyHub

What it does

The Link Preview API fetches a URL and returns the metadata you need to build a rich preview card. Send a url in a POST body and get back JSON with title, description, siteName, images, videos, favicons, mediaType, and contentType, read from the page's Open Graph and Twitter Card tags.

secure_mode is on by default and checks the URL against a malicious-URL database before fetching. Clean URLs return the preview with reported_malicious: false, and flagged URLs return the detected threat instead of metadata. Set images_property_type to og or twitter to choose which tags supply the image, and pass user_agent, accept_language, or allow_redirects to control how the page is fetched. URLs without a protocol get http:// added automatically.

Use the link preview API to unfurl links in chat apps, comment threads, and social feeds, build bookmark and read-later collections, or show a URL preview before a user leaves your site. The safety check makes it a good fit for user-submitted links.

When a page has no preview image, capture one with the Webpage Screenshot API. To give your own pages better previews, create social images with the OG Image Generator API. For links to PDFs and documents, the File Preview API renders a PNG thumbnail.

▣ 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.