Skip to main content

AI

These endpoints power LinkLane's AI features in the app. They all need a dashboard session, so an API key gets 401. This page lists what each one does and what it costs, so you can predict credit use.

Credits and errors​

Each call that asks the model for something new spends AI credits. Reading a cached answer is free. If the model fails and LinkLane falls back to a built-in answer, the credits are refunded.

Paid plans get credits every month. Free gets none, but a Free account can still spend credits it earned through referrals or bought. That is why most endpoints below say "Any plan with AI credits".

SituationResponse
No credits at all (Free, with no earned or bought credits)402, detail.error = "ai_requires_paid_plan"
Out of credits this month402, detail.error = "quota_exceeded", detail.dimension = "ai_credits"
More than 20 calls a minute to one AI feature429, detail.error = "rate_limited"

In all three, detail is an object. See Errors.

Insights​

Plain-English reads of your analytics. Each returns summary, why (up to 4 reasons), anomalies (up to 3), recommendations (up to 3), the data it used, and generated_by ("ai" or "fallback"). Answers are cached for 6 hours; add ?force=true for a fresh one.

GET/api/ai/insight/link/{link_id}
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
2 credits
GET/api/ai/insight/account
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
5 credits
GET/api/ai/insight/campaign/{campaign_id}
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
3 credits
GET/api/ai/insight/qr/{link_id}
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
2 credits
GET/api/ai/insight/domain/{domain_id}
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
5 credits

Link and QR insights also return actions: fixes you can apply with Apply an action.

Response · 200 OK (trimmed)
{
"summary": "Clicks rose 38% this week, mostly from Instagram on mobile.",
"why": ["Instagram referrals doubled after the 24 Nov story."],
"anomalies": ["24 Nov was a spike: about 3× a normal day."],
"recommendations": ["Add device routing so iOS visitors land on the app."],
"generated_by": "ai",
"cached": false,
"actions": [
{
"type": "enable_conversion_tracking",
"link_id": "6f1c2b9e-…",
"label": "Turn on conversion tracking",
"feature": "Conversions",
"why": "This link has traffic but isn't measuring outcomes yet.",
"params": {}
}
]
}
GET/api/ai/link-explain/{link_id}
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
2 credits

A short text summary of one link's traffic: { "summary": "…", "cached": false, "age_hours": 0 }. Cached for 6 hours; takes ?force=true.

Create with AI​

POST/api/ai/suggest-alias
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
1 credit

Body: url (required), title, description. Returns { "suggestions": ["spring-sale", …] }, up to 5.

POST/api/ai/suggest-tags
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
1 credit

Same body. Returns up to 5 tag suggestions.

POST/api/ai/intent
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
2 credits

Turns a sentence into a link setup. Body: goal (3–600 characters, required) and url. Returns alias, utm, tags, campaign_name and a note.

Request body
{ "goal": "Summer sale for Instagram, US mobile", "url": "https://shop.example.com/summer" }
POST/api/ai/bio-generate
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
5 credits

Drafts a link-in-bio page. Body: prompt (3–600 characters). Returns profile_name, bio, theme, slug and links.

GET/api/ai/routing-suggest/{link_id}
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
2 credits

Reads the last 14 days of a link's traffic and suggests a routing rule. Returns recommendations and the data behind them. Refunded when there's nothing to suggest.

POST/api/ai/onboarding/setup
Auth
Dashboard session only
Plan
All plans
Note
Free, no credits

The free preview new accounts see during onboarding. Same body as /api/ai/intent. Built-in rules, no model. Limited to 30 calls an hour.

Agent​

POST/api/ai/agent
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
10 credits

The AI Strategist. Body: goal (3–600 characters, required) and an optional link_id. Returns a summary, up to 4 steps (each with title, detail and feature) and actions you can apply.

Apply an action​

POST/api/ai/actions/apply
Auth
Dashboard session only
Plan
All plans
Note
No credits

Applies one fix to a link in your workspace. Needs the member role or higher.

Body parameters​

NameTypeRequiredDescription
typestringYesOne of the action types below.
link_idstringYes, for link actionsThe link to change.
paramsobjectNoExtra input for the action.
typeWhat it doesparams
enable_conversion_trackingTurns on conversion tracking. Pro and above.none
disable_conversion_trackingTurns it off.none
set_utmSets UTM values.utm: source, medium, campaign, term, content
restore_linkUndoes a set_utm.snapshot_id, from the undo that set_utm returned
Response · 200 OK
{
"ok": true,
"message": "Conversion tracking on for /spring-sale.",
"undo": { "type": "disable_conversion_tracking", "link_id": "6f1c2b9e-…", "params": {} }
}

Send the undo object back to this endpoint to reverse the change. Undoing a set_utm returns 409 if the link was edited since.

Digest and alerts​

GET/api/ai/weekly-summary
Auth
Dashboard session only
Plan
Any plan with AI credits
Note
3 credits, cached 24 h

A summary of your account's week: { "summary": "…", "cached": true }.

POST/api/ai/weekly-digest/send
Auth
Dashboard session only
Plan
Pro and above
Note
3 credits

Emails you the account digest now. Returns { "sent": true }, or 400 if you opted out of email.

POST/api/ai/proactive/scan
Auth
Dashboard session only
Plan
All plans
Note
No credits

Runs the alert scan now: links that expire within 48 hours, links near their click cap, and busy links with no conversion tracking. New findings become notifications. Returns { "ok": true, "new_alerts": 2 }.

Bring your own key​

PUT/api/ai/byok
Auth
Dashboard session only
Plan
Enterprise

Sends your AI calls to your own OpenRouter key. Calls still spend credits from your monthly allotment. Body: api_key (required), model, provider (only "openrouter"). The key is encrypted at rest and never returned.

GET/api/ai/byok
Auth
Dashboard session only
Plan
All plans

Shows the setup without the key: configured, enabled, provider, model and key_masked.

DELETE/api/ai/byok
Auth
Dashboard session only
Plan
All plans

Removes your key. AI goes back to credits.