API v1Build with short links.
The cplt.in REST API gives your applications a clean way to create and manage shortened URLs. Requests and responses use JSON.
Base URL https://cplt.in/api/v1
Get your API token
Follow these steps once: register a developer account, log in to receive the token, then send that token as a Bearer token with every protected API request.
Step 1 — Register your developer account
Registration creates the account but does not issue a token.
POST/auth/register
Requestcurl -X POST https://cplt.in/api/v1/auth/register \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Ada Lovelace",
"email": "ada@example.com",
"password": "your-secure-password"
}'
Registration returns the new user and a message asking them to log in.
Step 2 — Log in and receive your token
POST/auth/login
curl -X POST https://cplt.in/api/v1/auth/login \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"email": "ada@example.com",
"password": "your-secure-password"
}'
Step 3 — Copy the token from the login response
200 response{
"user": {
"id": 1,
"name": "Ada Lovelace",
"email": "ada@example.com"
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9..."
}
Step 4 — Use it in the Authorization header
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...
Replace YOUR_TOKEN in the endpoint examples below with the complete token returned by login.
Keep access tokens private. Do not expose them in browser-side code or commit them to source control.
Create a link
POST/links
original_url is required and must use HTTP or HTTPS. expires_at is optional and accepts an ISO 8601 date; omitted links default to one year.
curl -X POST https://cplt.in/api/v1/links \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"original_url": "https://example.com/a-very-long-page",
"expires_at": "2026-12-31T23:59:59Z"
}'
201 response{
"id": 42,
"original_url": "https://example.com/a-very-long-page",
"shortened_url": "https://cplt.in/aB3xYz",
"clicks": 0,
"expires_at": "2026-12-31T23:59:59.000000Z"
}
List your links
GET/links
Returns your links newest first in a paginated response, with 20 results per page. Use ?page=2 to move through pages.
curl https://cplt.in/api/v1/links \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"
Inspect a link
GET/links/{id}
Returns one of your links, including its current clicks count and expiry date.
curl https://cplt.in/api/v1/links/42 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"
Delete a link
DELETE/links/{id}
Permanently removes a link owned by the authenticated account.
curl -X DELETE https://cplt.in/api/v1/links/42 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"
Errors
Errors use standard HTTP status codes and return JSON. Validation responses include field-specific details.
401Missing or invalid access token
404Link not found or not owned by this account
422Request validation failed
429Too many requests; retry later