Authentication

All API requests require authentication using an API key.

Getting an API Key

  1. Register as a merchant at linkbay.io/dashboard/merchant
  2. Navigate to the API Keys section in your dashboard
  3. Click "Generate New Key"
  4. Important: Copy and save your key immediately - it will only be shown once!

Using Your API Key

Include your API key in the X-API-Key header with every request:

cURL Example

curl https://api.linkbay.io/api/v1/merchant/lookup-click?click_id=xyz789 \
  -H "X-API-Key: YOUR_API_KEY"

JavaScript/TypeScript Example

const response = await fetch(
  'https://api.linkbay.io/api/v1/merchant/lookup-click?click_id=xyz789',
  {
    headers: {
      'X-API-Key': process.env.LINKBAY_API_KEY,
    },
  }
);

const data = await response.json();

Python Example

import requests
import os

response = requests.get(
    'https://api.linkbay.io/api/v1/merchant/lookup-click',
    params={'click_id': 'xyz789'},
    headers={'X-API-Key': os.environ['LINKBAY_API_KEY']}
)

data = response.json()

Authentication Errors

Status CodeErrorDescription
401API key requiredThe X-API-Key header is missing
401Invalid API keyThe API key is invalid or has been revoked
403API key disabledThe API key has been disabled by the owner

Security Best Practices

  • Never expose your API key in client-side code. Always make API calls from your backend server.
  • Store your API key in environment variables, not in your codebase.
  • Rotate your API keys periodically or if you suspect they've been compromised.
  • Use separate API keys for development and production environments.

Key Management

You can manage your API keys from the API Keys section of your dashboard:

  • View all active keys
  • Generate new keys
  • Revoke compromised keys
  • View key usage statistics