Authentication
The linked.is API uses Bearer token authentication. You'll need to generate an API token from your account settings to make API requests.
Generating an API Token
- Log in to your linked.is account
- Navigate to Settings > API
- Enter a token name (up to 100 characters), for example the name of your app
- Click "Generate Token"
- Copy your token from the window that opens and store it securely
Tokens start with lnk_. Each token expires one year after it was created. The expiry is not shown in settings, so note the creation date and generate a new token before then.
Using Your Token
Include your API token in the Authorization header of every request, as Bearer followed by the token:
<script setup lang="ts">
const fetchLinks = async () => {
const response = await fetch("https://linked.is/api/v1/links", {
method: "GET",
headers: {
Authorization: `Bearer ${YOUR_API_TOKEN}`,
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);
return data;
};
</script>
<template>
<div>
<button @click="fetchLinks">Fetch Links</button>
</div>
</template>
import requests
headers = {
'Authorization': f'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json'
}
response = requests.get('https://linked.is/api/v1/links', headers=headers)
data = response.json()
print(data)
curl -X GET "https://linked.is/api/v1/links" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Token Permissions
A token acts as you. There are no per-token scopes: every token can use the whole API on your personal workspace and on every team you are a member of. With a token you can:
- Create, read, update, and delete links, and get their QR codes
- Create, read, update, and delete bio profiles and their blocks
- Access analytics data
- List your teams
A token can't create, list or revoke API tokens. Managing tokens needs a signed-in browser session in Settings > API.
Token Security
- Never share your API token
- Don't commit tokens to version control
- Use environment variables to store tokens
- Regenerate tokens periodically
- Revoke tokens that may have been compromised
Regenerating Tokens
To replace a token with a new one:
- Go to Settings > API
- Find the token in "Your API Tokens"
- Click the "Regenerate token" button (the refresh icon)
The old token is revoked and a new token with the same name is created and shown once.
Revoking Tokens
To revoke an API token:
- Go to Settings > API
- Find the token you want to revoke
- Click the "Revoke token" button (the trash icon)
Revoked tokens will immediately stop working for all API requests.
Authentication Errors
When authentication fails, the API returns a 401 Unauthorized status code. The reason is in the message field of the error body:
| Message | Cause |
|---|---|
Authorization header is required | The Authorization header is missing or doesn't start with Bearer |
Invalid API token | The token doesn't exist or was revoked |
API token has expired | The token is more than a year old |
Invalid or expired session token | The token doesn't start with lnk_, for example because it was copied incompletely |
<script setup lang="ts">
const invalidTokenError = {
error: true,
url: "https://linked.is/api/v1/links",
statusCode: 401,
statusMessage: "Server Error",
message: "Invalid API token"
};
</script>
<template>
<pre>{{ JSON.stringify(invalidTokenError, null, 2) }}</pre>
</template>
<script setup lang="ts">
const expiredTokenError = {
error: true,
url: "https://linked.is/api/v1/links",
statusCode: 401,
statusMessage: "Server Error",
message: "API token has expired"
};
</script>
<template>
<pre>{{ JSON.stringify(expiredTokenError, null, 2) }}</pre>
</template>
<script setup lang="ts">
const missingTokenError = {
error: true,
url: "https://linked.is/api/v1/links",
statusCode: 401,
statusMessage: "Server Error",
message: "Authorization header is required"
};
</script>
<template>
<pre>{{ JSON.stringify(missingTokenError, null, 2) }}</pre>
</template>