Skip to content

Authentication

Learn how to authenticate with the linked.is API

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

  1. Log in to your linked.is account
  2. Navigate to Settings > API
  3. Enter a token name (up to 100 characters), for example the name of your app
  4. Click "Generate Token"
  5. 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.

Important: Your API token is only shown once. Make sure to copy it immediately and store it in a secure location. linked.is stores only a hash of the token and can't show it again.

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>
The API doesn't send CORS headers, so browsers block calls made from other websites. Send requests from your server, where the token stays private.

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

Security Best Practices:
  • 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:

  1. Go to Settings > API
  2. Find the token in "Your API Tokens"
  3. 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:

  1. Go to Settings > API
  2. Find the token you want to revoke
  3. 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:

MessageCause
Authorization header is requiredThe Authorization header is missing or doesn't start with Bearer
Invalid API tokenThe token doesn't exist or was revoked
API token has expiredThe token is more than a year old
Invalid or expired session tokenThe 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>