API Reference
Authentication

Authentication

The Litmus API supports two authentication methods: Bearer tokens (JWT) and API keys.

Register a New Account

curl -X POST https://api.litmus.science/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "your-secure-password",
    "name": "Your Name",
    "organization": "Your Organization"
  }'

Response:

{
  "id": "usr_abc123",
  "email": "user@example.com",
  "name": "Your Name",
  "organization": "Your Organization",
  "role": "requester",
  "rate_limit_tier": "standard",
  "created_at": "2026-01-27T10:00:00Z",
  "api_key": "lk_abc123def456..."
}
⚠️

Store your API key securely! It's only returned once at registration. If you lose it, you'll need to generate a new one.

Get Access Token

Exchange credentials for a JWT token:

curl -X POST https://api.litmus.science/auth/token \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "your-secure-password"
  }'

Response:

{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Tokens expire after 24 hours.

Using Bearer Tokens

Include the token in the Authorization header:

curl https://api.litmus.science/experiments \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

Using API Keys

Include the API key in the X-API-Key header:

curl https://api.litmus.science/experiments \
  -H "X-API-Key: lk_abc123def456..."

API keys don't expire but can be revoked.

When to Use Which

MethodBest For
Bearer TokenInteractive sessions, web apps
API KeyServer-to-server, automated pipelines

Security Best Practices

  1. Never expose credentials in client-side code — Use server-side proxies
  2. Rotate API keys periodically — Generate new keys and deprecate old ones
  3. Use environment variables — Never hardcode credentials
  4. Monitor usage — Check rate limit headers for unusual activity

Rate Limit Tiers

TierRequests/MinuteRequests/DayHow to Get
Standard1001,000Default for new accounts
Pro1,00010,000Contact sales
AI Agent5005,000For automated pipelines

Contact support@litmus.science to upgrade your tier.