Skip to main content

AI

Base: https://api.linklane.io/api. All AI endpoints are paid-only — a Free user gets 402 with { "error": "ai_requires_paid_plan", "dimension": "ai_credits", "upgrade_to": "pro" }. Each call spends weighted AI credits; when out of credits the same 402 shape returns with error: "quota_exceeded".

Insight

Grounded, structured insight (summary, why[], anomalies[], recommendations[], data, generated_by). Cached ~6h; add ?force=true to regenerate.

GET /api/ai/insight/link/{link_id} # 2 credits
GET /api/ai/insight/account # 5 credits
GET /api/ai/insight/campaign/{campaign_id} # 3 credits
GET /api/ai/insight/qr/{link_id} # 2 credits — scoped to QR scans
GET /api/ai/insight/domain/{domain_id} # 5 credits

Link/QR/campaign/domain insights also return an actions[] array of applyable fixes (see Actions).

Create with AI

POST /api/ai/suggest-alias # 1 credit { url, title?, description? }
POST /api/ai/suggest-tags # 1 credit { url, title?, description? }
POST /api/ai/intent # 2 credits { goal, url? } → { alias, utm, tags, campaign_name }
POST /api/ai/bio-generate # 5 credits { prompt } → { profile_name, bio, theme, links[] }
GET /api/ai/routing-suggest/{link_id} # 2 credits → { recommendations[], data }
POST /api/ai/onboarding/setup # FREE, no credits — deterministic { goal, url? }

Digest

GET /api/ai/weekly-summary # 3 credits — cached 24h
POST /api/ai/weekly-digest/send # 3 credits — email the account digest now

Agent

POST /api/ai/agent # 10 credits { goal, link_id? }

Returns { summary, steps[], actions[], data, generated_by }. actions[] are applyable via the actions endpoint.

Actions

Apply a typed, derived action on a link you own. Returns { ok, message, undo } where undo is a ready-to-POST inverse action.

POST /api/ai/actions/apply
{ "type": "enable_conversion_tracking", "link_id": "…", "params": {} }

Types: enable_conversion_tracking / disable_conversion_tracking, set_utm / restore_link. (No credit cost — these are mutations, not generations.)

Proactive scan

POST /api/ai/proactive/scan # run the deterministic scan now → { new_alerts }

Findings (expiring soon, near click-cap, untracked winner) are pushed as notifications, deduped. A background scan also runs periodically.

BYOK (Enterprise)

GET /api/ai/byok # { configured, enabled, provider, model, key_masked }
PUT /api/ai/byok # { api_key, model?, provider? } — Enterprise only
DELETE /api/ai/byok # revert to the shared key

The key is encrypted at rest and never returned.