Create a Human-Friendly Alias

3 min

Before you start

1) Create a link with a custom alias

# cURL
curl -X POST https://api.ogli.sh/link \
  -H "Authorization: Bearer $OGLI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "targetUrl": "https://yoursite.com/launch",
    "title": "Product Launch 2024",
    "description": "Join us for the biggest launch of the year",
    "alias": "launch-2024"
  }'
// Node.js
const response = 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://yoursite.com/launch",
    title: "Product Launch 2024", 
    description: "Join us for the biggest launch of the year",
    alias: "launch-2024"
  })
});

const link = await response.json();
console.log(link.url); // https://ogli.sh/launch-2024

2) Response with alias URL

{
  "url": "https://ogli.sh/launch-2024",
  "qrCodeUrl": "https://ogli.sh/qr/launch-2024",
  "id": "link-id-123",
  "slug": "AbC123",
  "alias": "launch-2024"
}

Alias rules

Pro tips


← Back to all how-tos