---
title: Generate Link Preview API
slug: generate-link-preview
url: https://apyhub.com/apyhub/service/generate-link-preview
provider: ApyHub
categories: [Ingestion Kit, Retrieval Kit]
tags: [link-preview, open-graph, metadata-extraction, web-scraping, url-safety]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 1
atoms: 50
mcp: true
alias: link-preview
---

# Generate Link Preview API

Link preview API: send a URL, get the title, description, images, favicon and site name for preview cards, with malicious-URL checks. Free tier, no card.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/apyhub/generate-link-preview` | What it does Generates a preview for a URL by fetching the page metadata and returning it in a JSON… | 50 |

## Endpoint reference

### Generate a link preview

`POST https://api.eu.apyhub.com/apyhub/generate-link-preview` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string | yes | The URL to generate a preview for. Protocol is optional — http:// is prepended if absent. Example: `https://apyhub.com`. |
| `user_agent` | body | string | no | Custom User-Agent header sent when fetching the URL. Example: `Mozilla/5.0 (compatible; MyBot/1.0)`. |
| `secure_mode` | body | boolean | no | When true, the URL is checked against the malicious-URL database before fetching. Default: `true`. |
| `accept_language` | body | string | no | Custom Accept-Language header sent when fetching the URL. Example: `en-US,en;q=0.9`. |
| `allow_redirects` | body | boolean | no | Whether to follow HTTP redirects when fetching the URL. Default: `false`. |
| `images_property_type` | body | string | no | Preferred image meta-tag property to extract. Defaults to og. One of: og, twitter. |

#### Quickstart

Generate a preview for a URL by sending the required `url` field in the JSON body.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/generate-link-preview" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://apyhub.com"
  }'
```

#### What you'll get back

Returns a JSON object with a `data` field. On a normal response, `data` is an object containing preview metadata such as `url`, `title`, `images`, `videos`, `favicons`, `siteName`, `mediaType`, `contentType`, `description`, and, when `secure_mode` is true, `reported_malicious`.

```json
{
  "data": {
    "url": "https://apyhub.com",
    "title": "ApyHub",
    "images": ["https://apyhub.com/og-image.png"],
    "videos": [],
    "favicons": ["https://apyhub.com/favicon.ico"],
    "siteName": "ApyHub",
    "mediaType": "website",
    "contentType": "text/html",
    "description": "API tools for developers",
    "reported_malicious": false
  }
}
```

## About

## 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](https://apyhub.com/apyhub/service/capture-webpage-screenshot). To give your own pages better previews, create social images with the [OG Image Generator API](https://apyhub.com/apyhub/service/generate-og-image). For links to PDFs and documents, the [File Preview API](https://apyhub.com/apyhub/service/generate-png-preview) renders a PNG thumbnail.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/apyhub/service/generate-link-preview
