Link preview
The Link Preview API fetches rich metadata for any URL in a single request: page title, description, preview image, favicon, and site name. Use it to display a visual card or summary for a URL without creating a resource.
How it works
Pass a URL to GET /v2/link. Exabase fetches the page, extracts Open Graph tags and other metadata, and returns a structured preview object. The response is synchronous.
Endpoint: GET /v2/link
import { Exabase } from "@exabase/sdk";
const api = new Exabase({
apiKey: process.env.EXABASE_API_KEY,
});
const preview = await api.linkPreview.get({ url: "https://exabase.io" });
console.log(preview.title); // "Exabase – The data layer for agents."
console.log(preview.description); // "Memory, cloud filesystem instances..."
console.log(preview.image?.url); // pre-signed CDN URL to the preview image
curl 'https://api.exabase.io/v2/link?url=https%3A%2F%2Fexabase.io' \
-H 'X-Api-Key: <EXABASE_API_KEY>'
Example response
{
"url": "https://exabase.io",
"title": "Exabase – The data layer for agents.",
"type": "link",
"description": "Memory, cloud filesystem instances, advanced search, and extraction APIs. Everything your agent needs to remember and reason.",
"siteName": "exabase.io",
"image": {
"key": "link-previews/77d66f1f-37a9-4cda-bf37-0cc41c8ecc42.jpeg",
"url": "https://cdn.exabase.io/link-previews/77d66f1f-37a9-4cda-bf37-0cc41c8ecc42.jpeg",
"width": 1200,
"height": 630,
"mime": "image/jpeg",
"contentLength": 0
},
"favicon": {
"key": "link-previews/ed4a2b3d-7d78-495a-b161-5145218888e9.png",
"url": "https://cdn.exabase.io/link-previews/ed4a2b3d-7d78-495a-b161-5145218888e9.png",
"width": 180,
"height": 180,
"mime": "image/png",
"contentLength": 0
},
"metadata": {}
}
Response fields
| Field | Type | Description |
|---|---|---|
url |
string |
The URL that was fetched |
title |
string | null |
Page title, typically from Open Graph |
description |
string | null |
Short description, typically from Open Graph |
siteName |
string | null |
Name of the website (e.g. "GitHub") |
type |
string |
Content type detected (e.g. "link", "spotify") |
image |
object | null |
Preview image with a pre-signed URL, width, and height |
favicon |
object | null |
Site favicon with a pre-signed URL |
metadata |
object |
Additional provider-specific fields (see below) |
Metadata
For most URLs metadata is an empty object. For Spotify URLs the type field is "spotify" and metadata contains playback details:
| Field | Type | Description |
|---|---|---|
metadata.track |
string | null |
Track name |
metadata.artist |
string | null |
Artist name |
metadata.audio |
string | null |
Direct audio stream URL |
metadata.embed |
string | null |
Spotify embed player URL |
Error handling
The endpoint returns 404 when no preview data can be fetched for the given URL.
try {
const preview = await api.linkPreview.get({ url: "https://example.com" });
console.log(preview.title);
} catch (err) {
if (err.status === 404) {
// No preview available for this URL
}
}
# A 404 response means no preview data could be fetched
curl -i 'https://api.exabase.io/v2/link?url=https%3A%2F%2Fexample.com' \
-H 'X-Api-Key: <EXABASE_API_KEY>'