Skip to content
API docsGitHub

Corto documentation

Run it yourself. Automate everything.

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

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

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

OpenAPI JSON
Endpoints
MethodPathUse
GET/api/v1/linksList links
POST/api/v1/linksCreate a link
GET/api/v1/links/:idRead link and analytics
PATCH/api/v1/links/:idUpdate a link
DELETE/api/v1/links/:idDelete a link
PUT/api/v1/links/:id/goalsSet link milestones
GET/api/v1/advertisingGet advertising interstitial settings
PATCH/api/v1/advertisingConfigure advertising interstitial
GET/api/v1/analytics/summaryAccount report
POST/api/mcpMCP endpoint for AI assistants, same API key

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 a message.

400

Bad request

Check the URL and the slug format.

401

Unauthorized

The API key is missing or revoked.

404

Not found

The link or resource does not exist.