How-tos
Create a Short Link with Custom Open Graph (OG) Tags
5 min
Before you start
- Sign up and grab your
OGLI_API_KEY
.
- Have your destination URL and OG image (1200×630) ready.
1) Create the short link
# cURL
curl -X POST https://api.ogli.sh/link \
-H "Authorization: Bearer $OGLI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"targetUrl": "https://example.com/product/123",
"title": "SuperWidget 2.0",
"description": "Ships today. Free returns.",
"ogImage": "https://cdn.example.com/og/superwidget-1200x630.jpg?v=1",
"ogImageAlt": "SuperWidget 2.0 product image",
"twitterCard": "summary_large_image"
}'
// Node (fetch)
await fetch("https://api.ogli.sh/link", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.OGLI_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
targetUrl: "https://example.com/product/123",
title: "SuperWidget 2.0",
description: "Ships today. Free returns.",
ogImage: "https://cdn.example.com/og/superwidget-1200x630.jpg?v=1",
ogImageAlt: "SuperWidget 2.0 product image",
twitterCard: "summary_large_image"
})
});
2) Share & verify the preview
- Share the short link in Slack/Discord to see the card instantly.
- If you change the image later, bump the querystring to
?v=2
and re-share.
Troubleshooting
- Card didn’t update? Use a new image URL version (
?v=2
), then re-share.
- Broken image? Make sure it’s publicly reachable over HTTPS and <2 MB.
← Back to all how-tos