# Quickstart

Source: https://developers.leonai.io/docs/quickstart/

Create your first short link in under a minute. You'll need an API key with the
`links:write` scope — see [Authentication](https://developers.leonai.io/docs/authentication/#creating-a-key).

## 1. Set your API key

```bash
export LEONAI_API_KEY="lk_live_your_key_here"
```

## 2. Create a link with curl

```bash
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`):

```json
{
  "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

```bash
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](https://developers.leonai.io/docs/guides/links/) — listing, updating, bulk import, and export
- [Analytics guide](https://developers.leonai.io/docs/guides/analytics/) — timelines and conversion tracking
- [Webhooks guide](https://developers.leonai.io/docs/guides/webhooks/) — react to clicks in real time
- [API Reference](https://developers.leonai.io/docs/api-reference/) — every endpoint, request, and response
