Authentication Guide

Rich Utilities uses the Authentication service for centralized identity management. Learn how to authenticate your requests using JWT tokens for user sessions or API keys for server-to-server integrations.

Overview

The Rich Utilities platform supports two authentication methods:

  • JWT Tokens: Short-lived tokens for user sessions (15-minute access tokens with 7-day refresh tokens)
  • API Keys: Long-lived keys for server-to-server integrations (v1 simple keys or v2 scoped keys)

All API requests must include an authentication header. Unauthenticated requests will receive a 401 Unauthorized response.


JWT Authentication

JWT (JSON Web Token) authentication is the recommended approach for user-facing applications.

Token Types

TokenLifetimePurpose
Access Token15 minutesAPI requests
Refresh Token7 daysObtain new access tokens

Authentication Flow

  1. Register a new user account via /auth/register
  2. Login to receive a token pair via /auth/login
  3. Use the access token in the Authorization header
  4. Refresh when the access token expires via /auth/refresh
  5. Logout to revoke tokens via /auth/logout

Example Usage

Token Refresh

When your access token expires (after 15 minutes), use the refresh token to get a new pair:


API Keys

API keys are best for server-to-server integrations, background jobs, and MCP server configurations.

v1 API Keys (Legacy)

Simple hashed keys suitable for basic integrations:


Scoped API Keys

v2 API keys provide granular permissions using bitfield scopes.

Key Format

v2 keys follow the format: ru_v2_<12_char_prefix>_<32_char_secret> (51 characters total)

Example: ru_v2_abcd1234efgh_0123456789abcdef0123456789abcdef

Available Scopes

ResourceActions
companiesread, write, delete, admin
leadsread, write, delete, admin
contactsread, write, delete, admin
enrichmentread, write, delete, admin
searchread
adminread, write, delete, admin

Scope format: {resource}:{action}

Example scopes: ["companies:read", "leads:write", "contacts:read"]

Creating Scoped Keys

Using Scoped Keys

Checking Scopes

You can check what scopes an API key has:


Security Best Practices

Storing Credentials

Environment Variables:

macOS Keychain:

Docker Secrets:

Rate Limiting

The API enforces rate limits:

Endpoint TypeLimit
Authentication5 attempts per minute
General API60 requests per minute (default)
Scoped KeysConfigurable per key (default: 1000 RPM)

Rate limit headers are included in responses:

  • X-RateLimit-Limit: Request limit
  • X-RateLimit-Remaining: Remaining requests
  • X-RateLimit-Reset: Reset timestamp

Failed Authentication

After 5 failed login attempts, accounts are locked for 15 minutes. Contact support if you need immediate assistance.

Token Expiration

Token TypeExpirationRefreshable?
Access Token15 minutesYes (with refresh token)
Refresh Token7 daysNo (login again)
API Key v1Never (until revoked)N/A
API Key v2ConfigurableN/A

Revoking Access

Revoke JWT Tokens:

Revoke API Keys:

Password Security

Rich Utilities uses Argon2id for password hashing with the following parameters:

  • Memory: 64 MB
  • Iterations: 3
  • Parallelism: 4 threads

This provides post-quantum resistance against password cracking attempts.

HTTPS Only

All authentication endpoints require HTTPS. HTTP requests are automatically redirected to HTTPS in production.


SDK Authentication

Official SDKs handle authentication automatically:


Error Reference

StatusErrorDescription
401unauthorizedMissing or invalid credentials
401invalid_credentialsWrong email/password
401token_expiredJWT token has expired
403forbiddenValid credentials but insufficient permissions
403admin_access_requiredEndpoint requires admin role
429rate_limit_exceededToo many requests
423account_lockedToo many failed login attempts

For complete API reference, see the Authentication API documentation.

Was this page helpful?