Skip to content
Corto
Sign inGet started
Self-host Corto

Corto documentation

Run Corto yourself, deploy it to your infrastructure, or integrate short links from scripts and external services.

Self-host Corto

Start the full stack locally, then move the same repository to your production infrastructure.

Run locally
Use Bun with PostgreSQL and Redis you can reach from your machine.
git clone https://github.com/logical-tech/Corto.git
cd Corto
cp .env.example .env
bun install --frozen-lockfile
bun run --cwd apps/api migrate
bun run dev
Read the local guide
Deploy in production
Use the platform-specific Docker Compose configuration included with the repository.

Use one HTTPS domain, keep your secrets stable, and choose managed or bundled PostgreSQL and Redis.

Base URL
https://corto.logicaltech.it/api/v1

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://corto.logicaltech.it/api/v1/links \
  -H "x-api-key: $CORTO_API_KEY"

Endpoints

MethodPathUse
GET/api/v1/linksList links
POST/api/v1/linksCreate a link
GET/api/v1/links/:idRead link and analytics
PUT/api/v1/links/:id/goalsSet link milestones
GET/api/v1/advertisingGet advertising interstitial settings
PATCH/api/v1/advertisingConfigure advertising interstitial
PATCH/api/v1/links/:idUpdate a link
DELETE/api/v1/links/:idDelete a link
GET/api/v1/analytics/summaryAccount report

Create a link

Send at least a URL. Slug, title, and expiry are optional. Add clickLimit to switch the link off once it is reached, or password to gate it behind a form.

curl -X POST https://corto.logicaltech.it/api/v1/links \
  -H "x-api-key: $CORTO_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://corto.logicaltech.it/api/v1/advertising \
  -H "x-api-key: $CORTO_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.