Overview
Karen uses Bearer token authentication for all API requests. There are two types of authentication:- API Keys - For standard wallet and transaction operations
- Admin Secret - For administrative operations (key management, agent creation)
API Keys
API keys provide scoped access to wallet and transaction endpoints.Authentication Header
Include your API key in the Authorization header:Example Request
cURL
API Key Format
API keys have the format:sk-{32_character_hex}
Example: sk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
Admin Secret
The admin secret provides full access to all endpoints, including administrative operations.Setup
Set the admin secret via environment variable:karen-dev-secret
Usage
Include the admin secret in the Authorization header:Example Request
cURL
Create API Key
Generate a new API key with custom permissions and limits.Human-readable name for the API key
Array of permission strings
Maximum transactions per minute
Daily spending limit in SOL
The generated API key (store securely - cannot be retrieved later)
API key record ID
The key name
List API Keys
Retrieve all API keys (excluding the actual key values).Array of API key records
Endpoint Authorization
API Key Endpoints
These endpoints accept API keys or admin secret:POST /api/v1/walletsGET /api/v1/walletsGET /api/v1/wallets/:id/balancePOST /api/v1/wallets/:id/transferPOST /api/v1/wallets/:id/swapPOST /api/v1/wallets/:id/airdropPOST /api/v1/wallets/:id/launch-tokenPOST /api/v1/wallets/:id/mint-supplyPOST /api/v1/wallets/:id/revoke-authorityPOST /api/v1/wallets/:id/stakePOST /api/v1/wallets/:id/unstakePOST /api/v1/wallets/:id/withdraw-stakeGET /api/v1/wallets/:id/stakesPOST /api/v1/wallets/:id/burnPOST /api/v1/wallets/:id/close-accountPOST /api/v1/wallets/:id/wrap-solPOST /api/v1/wallets/:id/unwrap-solGET /api/v1/wallets/:id/transactionsGET /api/v1/transactionsGET /api/v1/agentsPOST /api/v1/agents/:id/chat
Admin-Only Endpoints
These endpoints require admin secret:POST /api/v1/keysGET /api/v1/keysPOST /api/v1/agentsPOST /api/v1/agents/:id/startPOST /api/v1/agents/:id/stop
Public Endpoints
These endpoints do not require authentication:GET /api/v1/health
Error Responses
401 Unauthorized - Missing API Key
401 Unauthorized - Invalid API Key
401 Unauthorized - Admin Secret Required
Security Best Practices
Store Securely
Never hardcode API keys in source code. Use environment variables or secret management services.
Rotate Regularly
Generate new API keys periodically and revoke old ones.
Scope Permissions
Create separate keys with minimal permissions for different use cases.
Monitor Usage
Track API key usage via lastUsedAt timestamps to detect anomalies.