Developer Integration

Build on top of LNK7 with our REST API. Create, manage, and track short links programmatically.

Authentication

All API endpoints require a Bearer token in the Authorization header:

Authorization: Bearer lnk7_your_token_here

To get a token:

  1. Create an account on LNK7
  2. Use the POST /api/v1/auth/login endpoint to receive a token, or
  3. Go to your Tokens page to generate one via the web UI

Tokens start with lnk7_ and are shown only once at creation. Store them securely.

Quick Start

1. Register an account

curl -X POST lnk7.net/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "your_password"}'

2. Get your API token

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_...", ...}

3. Create a short link

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", ...}

4. Use your link

Visit lnk7.net/abc123d — it redirects to your original URL instantly.

API Reference

Authentication

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

Links

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

Code Examples

List your links

curl lnk7.net/api/v1/links \
  -H "Authorization: Bearer $TOKEN"

# Response: {"links": [...], "page": 1, "has_next": false}

Update a link

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}'

Delete a link

curl -X DELETE lnk7.net/api/v1/links/1 \
  -H "Authorization: Bearer $TOKEN"

# Returns 204 No Content on success

Error Handling

All errors return a consistent JSON format:

{
  "detail": "Description of what went wrong"
}

Common Status Codes

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

Ready to start building?

Create an account and get your API token in seconds.

Get Started