Build on top of LNK7 with our REST API. Create, manage, and track short links programmatically.
All API endpoints require a Bearer token in the Authorization header:
Authorization: Bearer lnk7_your_token_here
To get a token:
POST /api/v1/auth/login endpoint to receive a token, orTokens start with lnk7_ and are shown only once at creation. Store them securely.
curl -X POST lnk7.net/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "your_password"}'
curl -X POST lnk7.net/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "your_password"}'
# Response: {"token": "lnk7_abc...", "token_id": "tok_...", ...}
curl -X POST lnk7.net/api/v1/links \
-H "Authorization: Bearer lnk7_your_token" \
-H "Content-Type: application/json" \
-d '{"original_url": "https://example.com/my-long-url"}'
# Response: {"id": 1, "short_code": "abc123d", "short_url": "lnk7.net/abc123d", ...}
Visit lnk7.net/abc123d — it redirects to your original URL instantly.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/v1/auth/register |
None | Create a new account |
| POST | /api/v1/auth/login |
None | Authenticate and receive API token |
| GET | /api/v1/auth/tokens |
Bearer | List your API tokens |
| DELETE | /api/v1/auth/tokens/{'{'}token_id{'}'} |
Bearer | Revoke a token |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/links |
Bearer | List your links (paginated) |
| POST | /api/v1/links |
Bearer | Create a short link |
| GET | /api/v1/links/{'{'}link_id{'}'} |
Bearer | Get link details |
| PUT | /api/v1/links/{'{'}link_id{'}'} |
Bearer | Update link URL or status |
| DELETE | /api/v1/links/{'{'}link_id{'}'} |
Bearer | Permanently delete a link |
curl lnk7.net/api/v1/links \
-H "Authorization: Bearer $TOKEN"
# Response: {"links": [...], "page": 1, "has_next": false}
curl -X PUT lnk7.net/api/v1/links/1 \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"original_url": "https://new-destination.com", "is_active": true}'
curl -X DELETE lnk7.net/api/v1/links/1 \
-H "Authorization: Bearer $TOKEN"
# Returns 204 No Content on success
All errors return a consistent JSON format:
{
"detail": "Description of what went wrong"
}
| Code | Meaning | Common Cause |
|---|---|---|
200 |
Success | Request completed |
201 |
Created | Resource successfully created |
204 |
No Content | Successful deletion |
400 |
Bad Request | Invalid URL, validation error |
401 |
Unauthorized | Missing or invalid Bearer token |
404 |
Not Found | Link doesn't exist or not owned by you |
422 |
Validation Error | Request body doesn't match expected schema |