Quickstart
Create your first short link in under a minute. You'll need an API key with the
links:write scope — see Authentication.
1. Set your API key
export LEONAI_API_KEY="lk_live_your_key_here"
2. Create a link with curl
curl -X POST https://api.short.leonai.io/api/v1/links \
-H "X-API-Key: $LEONAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"longUrl": "https://example.com/spring-sale",
"shortCode": "spring-sale",
"tags": ["marketing", "q2"]
}'
Response (201 Created):
{
"success": true,
"data": {
"id": "link_...",
"shortCode": "spring-sale",
"shortUrl": "https://short.leonai.io/spring-sale",
"longUrl": "https://example.com/spring-sale",
"tags": ["marketing", "q2"],
"clicks": 0,
"createdAt": "2026-07-10T12:00:00.000Z"
}
}
Visit https://short.leonai.io/spring-sale and it redirects to your destination.
3. Read the click count
curl https://api.short.leonai.io/api/v1/links/spring-sale \
-H "X-API-Key: $LEONAI_API_KEY"
The count is in data.clicks.
Next steps
- Links guide — listing, updating, bulk import, and export
- Analytics guide — timelines and conversion tracking
- Webhooks guide — react to clicks in real time
- API Reference — every endpoint, request, and response