Integrate SnapLink into your applications
Pass your API key in one of these ways:
Authorization: Bearer YOUR_API_KEY X-API-Key: YOUR_API_KEY ?api_key=YOUR_API_KEY
https://urlshorten.nanos.ro/api/auth/register
Register
{"username":"john","email":"john@example.com","password":"secret123"}
{"success":true,"message":"Account created.","api_key":"abc123..."}
https://urlshorten.nanos.ro/api/auth/login
Login
{"email":"john@example.com","password":"secret123"}
{"success":true,"api_key":"abc123...","user":{...}}
https://urlshorten.nanos.ro/api/shorten
Shorten URL
{"url":"https://example.com/very-long-url","custom_slug":"my-link","expires_days":30,"title":"My Link","password":"secret"}
{"success":true,"short_url":"http://...","short_code":"abc123","expires_at":"2025-01-01"}
https://urlshorten.nanos.ro/api/me
๐ AUTH My Profile & Usage
{"success":true,"user":{...},"usage":{"total_urls":42,"today_urls":3},"limits":{...}}
https://urlshorten.nanos.ro/api/me/regenerate-key
๐ AUTH Regenerate API Key
{"success":true,"api_key":"new_key_here"}
https://urlshorten.nanos.ro/api/urls?page=1&per_page=20
๐ AUTH List My URLs
{"success":true,"urls":[...],"total":42,"page":1}
https://urlshorten.nanos.ro/api/urls/{id}
๐ AUTH Get URL Info
{"success":true,"url":{...}}
https://urlshorten.nanos.ro/api/urls/{id}
๐ AUTH Edit URL
{"original_url":"https://example.com/new","title":"Updated","expires_days":30,"password":"optional"}
{"success":true,"message":"URL updated."}
https://urlshorten.nanos.ro/api/urls/{id}/toggle
๐ AUTH Pause / Resume URL
{"success":true,"message":"URL status updated."}
https://urlshorten.nanos.ro/api/urls/{id}
๐ AUTH Delete URL
{"success":true,"message":"URL deleted."}
https://urlshorten.nanos.ro/api/urls/{id}/stats
๐ AUTH URL Analytics (Pro+)
{"success":true,"analytics":{"total_clicks":100,"devices":[...],"browsers":[...],"daily":[...]}}
https://urlshorten.nanos.ro/api/plans
List Plans
{"success":true,"plans":[{"name":"free","daily_limit":10,...}]}
https://urlshorten.nanos.ro/api/admin/users
๐ AUTH List All Users (Admin)
{"success":true,"users":[...],"total":100}
https://urlshorten.nanos.ro/api/admin/users/{id}
๐ AUTH Update User (Admin)
{"plan":"pro","role":"user","is_active":1}
{"success":true,"message":"User updated."}
https://urlshorten.nanos.ro/api/admin/urls/{id}
๐ AUTH Delete Any URL (Admin)
{"success":true,"message":"URL deleted by admin."}
https://urlshorten.nanos.ro/api/admin/stats
๐ AUTH System Stats (Admin)
{"success":true,"stats":{"total_users":100,"total_urls":5000,"total_clicks":50000}}
| Code | Status | Meaning |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 204 | No Content | CORS preflight |
| 400 | Bad Request | Invalid input data |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Insufficient permissions or plan |
| 404 | Not Found | Resource or endpoint not found |
| 422 | Unprocessable Entity | Validation failed (limit reached, invalid URL, etc.) |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Internal server error |
# Shorten a URL (no auth)
curl -X POST https://urlshorten.nanos.ro/api/shorten \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/very-long-page"}'
# Shorten with auth + custom slug (Pro)
curl -X POST https://urlshorten.nanos.ro/api/shorten \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","custom_slug":"my-brand","expires_days":30}'
# Get your URLs
curl https://urlshorten.nanos.ro/api/urls \
-H "X-API-Key: YOUR_API_KEY"
# Get analytics
curl https://urlshorten.nanos.ro/api/urls/42/stats \
-H "Authorization: Bearer YOUR_API_KEY"
# Admin: change user plan
curl -X PUT https://urlshorten.nanos.ro/api/admin/users/5 \
-H "Authorization: Bearer ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"plan":"pro"}'