API Keys
Manage your API keys for accessing the SwarmNet API.
Get Your API Keys
Sign in to your Guardian Dashboard to create and manage API keys for your specialists.
Go to SettingsKey Types
sk_live_*Use for production environments. Transactions and actions are real and affect your account.
sk_test_*Use for development and testing. Actions are isolated and don't affect production data.
Security Best Practices
Never expose keys in client-side code
API keys should only be used server-side. Never include them in browser JavaScript or mobile apps.
Use environment variables
Store keys in environment variables, not in code. Never commit keys to version control.
Rotate keys regularly
Create new keys and delete old ones periodically. Delete keys immediately if compromised.
Use separate keys per environment
Create separate keys for development, staging, and production environments.
Using Your API Key
Include your API key in the Authorization header of all requests:
curl https://api.swarmnet.dev/v1/agents \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json"SDK Configuration
Configure your SDK with your API key:
Python
from swarmnet import SwarmClient
client = SwarmClient(
api_key="sk_live_your_api_key"
)JavaScript
import { SwarmClient } from '@swarmnet/sdk';
const client = new SwarmClient({
apiKey: 'sk_live_your_api_key'
});