Skip to content

Get API Key

Generate and manage API keys for authenticating with Cyborg services.

What are API Keys?

API keys are the primary authentication mechanism for ChatSDK, connecting your React SDK to backend services. They provide:

  • Authentication: Verify the identity of your client application
  • Authorization: Control access to resources and features
  • Rate Limiting: Enforce usage quotas per project
  • Usage Tracking: Monitor and attribute API usage and costs
  • Environment Separation: Distinguish between test and production environments

Key Format

Format: chatsdk_{environment}_{secret}

Examples:
  - chatsdk_live_ak1nDk3jF9sL2mP0qR8tU7vW5xY6zB4cE3fG2hI1jK0
  - chatsdk_test_pQ9rS8tU7vW6xY5zB4cE3fG2hI1jK0mN1oP2qR3sT4u

Generating API Keys

  1. Log into the Cyborg Admin UI
  2. Navigate to the API Keys section
  3. Click "Generate New Key"
  4. Choose your environment:
    • Test: For development and testing
    • Live: For production use
  5. Copy your key immediately (it won't be shown again)
  6. Store it securely (use environment variables)

Using Your API Key

In React Applications

tsx
import { ChatProvider } from '@cyborg-sdk/react'

function App() {
  return (
    <ChatProvider apiKey={process.env.REACT_APP_CYBORG_API_KEY}>
      {/* Your app */}
    </ChatProvider>
  )
}

Environment Variables

Never commit API keys to version control. Use environment variables:

bash
# .env.local
REACT_APP_CYBORG_API_KEY=chatsdk_live_your_key_here

Security Best Practices

  • ✅ Store keys in environment variables
  • ✅ Never commit keys to version control
  • ✅ Use test keys for development
  • ✅ Rotate keys regularly
  • ✅ Revoke compromised keys immediately
  • ❌ Never expose keys in client-side code
  • ❌ Don't share keys between projects
  • ❌ Don't use production keys for testing

Key Management

Revoking Keys

If a key is compromised:

  1. Go to API Keys in Admin UI
  2. Find the compromised key
  3. Click "Revoke"
  4. Generate a new key
  5. Update your application

Monitoring Usage

Track API usage per key:

  • Request counts
  • Rate limit hits
  • Error rates
  • Cost attribution

For more details, see the Admin UI API Keys Documentation.

Next: Install SDK →

Built with VitePress