Introducing the LinkPreview API

LinkPreview is a public API that allows developers to generate a preview of a webpage with a simple API call. This can be useful for creating previews of links shared on social media, or for generating a preview of a webpage in a custom application.

In this blog post, we will show you how to use the LinkPreview API with JavaScript and provide examples of the possible API code.

Getting Started

To use the LinkPreview API, you will need to sign up for a free account on their website. Once you have signed up, you will be given an API key to use in your requests.

The API endpoint for generating a preview of a webpage is You’ll have to add your API key to the url like so:[API_KEY_HERE]&q=

Example JavaScript Code

Here’s an example code that uses fetch to make a request to the LinkPreview API and then logs the response to the console:

    .then((response) => response.json())
    .then((data) => console.log(data));

The response from the API will be a JSON object with the following properties:

  • title: The title of the webpage
  • description: A short description of the webpage
  • image: The URL of the main image on the webpage
  • url: The URL of the webpage
  • favicon: The URL of the webpage’s favicon

You can access these properties like so:

    .then((response) => response.json())
    .then((data) => {
        const title = data.title;
        const description = data.description;
        const image = data.image;
        const url = data.url;
        const favicon = data.favicon;
        // Do something with the data


Using the LinkPreview API is a quick and easy way to generate a preview of a webpage in your application. With just a few lines of code, you can access a wealth of information about the page and display it in your own application. We hope that this blog post has helped you get started using the API with JavaScript. Happy coding!