Authentication
The API uses API keys. Send the key as a Bearer token in the Authorization header of every request.
PlanPro and above
Create a key
- Open the API Keys page in the LinkLane app (under Automation in the sidebar).
- Name the key and pick its scopes. If you pick none, the key gets all three.
- Copy the key. LinkLane shows it once. Every key starts with
ll_live_.
You can't change a key's scopes later. To change them, create a new key and revoke the old one.
Send the key
- cURL
- JavaScript
- Python
curl https://api.linklane.io/api/links \
-H "Authorization: Bearer ll_live_your_key"
await fetch("https://api.linklane.io/api/links", {
headers: { Authorization: "Bearer ll_live_your_key" },
});
import requests
requests.get(
"https://api.linklane.io/api/links",
headers={"Authorization": "Bearer ll_live_your_key"},
)
Keep keys in an environment variable such as LINKLANE_API_KEY. The rest of these docs use that name.
Scopes
A scope limits what a key can do. A call outside the key's scopes returns 403 with "API key lacks permission: <scope>".
| Scope | Lets the key |
|---|---|
links:read | List, count and read links. List campaigns and custom domains, to find the campaign_id and domain_id that links use. |
links:write | Create, change and delete links. |
analytics:read | Read link and account analytics, and export click events. |
A key acts for the user who made it. It sees every link in that user's workspace. If that user is a viewer on a team, the key can read but not write.
What a key can't do
Some endpoints only accept a dashboard session. The LinkLane app uses them. With an API key they return 401 Not authenticated. These include:
- creating, changing or deleting campaigns and custom domains;
- bulk tools and CSV import;
- webhooks, Slack and Discord integrations, and API key management;
- all AI endpoints;
- link goals, tags, preview refresh and snapshots.
Each endpoint page shows its auth with an Auth label.
Keep keys safe
- Treat a key like a password. Don't commit it to git or put it in browser code.
- Revoke a key you no longer use, or one that may have leaked, on the API Keys page. It stops working at once.
- Each key can make 100 requests a minute. See Rate limits.