LessTokens Logo
Getting Started
First Api Key

Documentation

Getting Started

  • Overview
  • Account Setup
  • First API Key
  • First Request
  • Understanding Metrics

API Reference

  • Overview
  • Authentication
  • Compressionnew
  • MCP Servernew
  • Errors

Integrations

  • Node.js / TypeScript
  • Python
  • cURL

Resources

  • Best Practices

Need help?

Join our community or contact support for assistance.

Contact Support →

Create Your First API Key

Learn how to generate, secure, and manage your LessToken API keys for authentication and access control.

Why API Keys?

API keys are your secure credentials for accessing the LessToken API. They authenticate your requests and track your usage, ensuring security and proper billing.

Secure Access

Encrypted authentication without exposing credentials

Usage Tracking

Monitor and control API consumption per key

Easy Rotation

Generate new keys and revoke old ones instantly

Creating Your First Key

1

Navigate to API Keys

Go to your dashboard and click on the 'API Keys' tab in the sidebar.

2

Click 'Create New Key'

Click the 'Create New API Key' button in the top right corner.

3

Name Your Key

Give your API key a descriptive name (e.g., 'Production', 'Development', 'Testing').

4

Copy and Save

Copy your API key immediately and store it securely. You won't be able to see it again!

Using Your API Key

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

Example Request
curl -X POST https://lesstokens.hive-hub.ai/api/compress \
  -H "X-API-Key: lsk_live_1234567890abcdef..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Your text to compress",
    "options": {
      "jsonMinify": true,
      "removeComments": true
    }
  }'

Test Keys

Prefix: lsk_test_...

Use for development and testing. No charges applied.

Live Keys

Prefix: lsk_live_...

Use for production. All requests are billed.

Security Best Practices

Never Commit Keys to Version Control

Add .env files to .gitignore and use environment variables instead of hardcoding keys in your code.

Use Environment Variables

Store API keys in environment variables and load them at runtime using process.env or similar.

Rotate Keys Regularly

Generate new keys periodically and revoke old ones, especially if you suspect they may be compromised.

Use Different Keys for Different Environments

Create separate keys for development, staging, and production to isolate and control access.

Storing Your Key Securely

Always use environment variables to store your API keys:

.env File (Local Development)

.env
# LessToken API Configuration
LESSTOKEN_API_KEY=lsk_live_your_key_here
LESSTOKEN_BASE_URL=https://lesstokens.hive-hub.ai

# Never commit this file!
# Add to .gitignore

.gitignore

.gitignore
# Environment variables
.env
.env.local
.env.production
.env.*.local

# API keys
*.key
api-keys.txt

Managing Your Keys

You can manage all your API keys from the dashboard:

View Keys

See all your active and inactive keys

Copy Keys

Quickly copy keys to clipboard

Revoke Keys

Delete compromised or unused keys

Key Visibility

For security reasons, you can only see the full API key once when it's created. After that, only the last 4 characters are displayed.

Next Steps

Now that you have your API key, you're ready to make your first request!