REST API
Base URL https://linkrail.io/api/v1. Create an API key in the dashboard under API and send it as Authorization: Bearer <key>. Each key can make 120 requests per minute. The full OpenAPI 3.1 description is at /api/v1/openapi.json.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET | /links | List links |
POST | /links | Create a link |
GET | /links/{id} | Get a link |
PATCH | /links/{id} | Update a link. Only fields present are changed. Changing the destination keeps the short URL. |
DELETE | /links/{id} | Delete a link |
GET | /links/{id}/stats | Click statistics for a link |
GET | /links/{id}/tracking-template | Google Ads tracking template. Available once a tracking domain is certified by Google. |
GET | /domains | List domains available for links |
Create a link
curl -X POST https://linkrail.io/api/v1/links \
-H "Authorization: Bearer lk_..." \
-H "Content-Type: application/json" \
-d '{"destinationUrl": "https://shop.example.com/spring", "slug": "spring", "tags": ["sale"]}'Optional fields: domain (hostname, default lkrl.ink), title, folderId, redirectCode (301 or 302), password, expiresAt (ISO 8601), expiredRedirectUrl, maxClicks.
Update a link
curl -X PATCH https://linkrail.io/api/v1/links/<id> \
-H "Authorization: Bearer lk_..." -H "Content-Type: application/json" \
-d '{"destinationUrl": "https://shop.example.com/summer"}'Stats
curl "https://linkrail.io/api/v1/links/<id>/stats?from=2026-10-01T00:00:00Z&interval=day" \
-H "Authorization: Bearer lk_..."Errors
Errors return a JSON body like {"error": {"code": "invalid_input", "message": "...", "field": "slug"}}.
400 | Malformed request |
401 | Missing or invalid API key |
403 | Feature not available to this workspace |
404 | Not found |
422 | Validation failed (see field) |
429 | Rate limited; retry after the Retry-After seconds |