Shorts documentation
Run Shorts yourself, deploy it to your infrastructure, or integrate short links from scripts and external services.
Self-host Shorts
Start the full stack locally, then move the same repository to your production infrastructure.
git clone https://github.com/logical-tech/url-shortner.git
cd url-shortner
cp .env.example .env
bun install --frozen-lockfile
bun run --cwd apps/api migrate
bun run devRead the local guideUse one HTTPS domain, keep your secrets stable, and choose managed or bundled PostgreSQL and Redis.
Authentication
Create a key from the API keys page and send it in the x-api-key header. The full key is shown only once.
curl https://short.logicaltech.it/api/v1/links \
-H "x-api-key: $SHORTS_API_KEY"Endpoints
| Method | Path | Use |
|---|---|---|
| GET | /api/v1/links | List links |
| POST | /api/v1/links | Create a link |
| GET | /api/v1/links/:id | Read link and analytics |
| PUT | /api/v1/links/:id/goals | Set link milestones |
| GET | /api/v1/advertising | Get advertising interstitial settings |
| PATCH | /api/v1/advertising | Configure advertising interstitial |
| PATCH | /api/v1/links/:id | Update a link |
| DELETE | /api/v1/links/:id | Delete a link |
| GET | /api/v1/analytics/summary | Account report |
Create a link
Send at least a URL. Slug, title, and expiry are optional.
curl -X POST https://short.logicaltech.it/api/v1/links \
-H "x-api-key: $SHORTS_API_KEY" \
-H "content-type: application/json" \
-d '{"url":"https://example.com/catalog"}'Advertising interstitial
Configure AdsTerra banners, a visible-only countdown, and whether its end reveals Continue to site or redirects automatically. Paste an invoke.js URL or the complete copied snippet; each banner size can be used once.
curl -X PATCH https://short.logicaltech.it/api/v1/advertising \
-H "x-api-key: $SHORTS_API_KEY" \
-H "content-type: application/json" \
-d '{"enabled":true,"automaticRedirect":false,"delaySeconds":5,"banners":[{"preset":"320x50","script":"https://www.highperformanceformat.com/<key>/invoke.js"}]}'Update a link
Send only the fields you want to change. Set active to false to stop redirecting, or adFree to true to skip the advertising interstitial for one link.
Errors
Errors use the appropriate HTTP status and a JSON body with message. Check URL and slug for 400 errors, the key for 401, and resource existence for 404.