SwiftClaw
Introduction to SwiftClawQuick StartInstallationConfiguration

Authentication

Authentication OverviewAPI KeysWebhooks

API Reference

API OverviewREST APISDK Reference

Core Concepts

Understanding AgentsWorkspacesEnvironments

CLI

CLI ReferenceCLI CommandsCLI Configuration
SwiftClaw

API Keys

Managing SwiftClaw API keys

API Keys

API keys authenticate your requests to SwiftClaw agents.

Creating API Keys

Via CLI

# Create new API key
swiftclaw keys create my-agent --name production

# Output:
# API Key: sk_live_abc123...
# Name: production
# Created: 2024-03-08 10:30:00

Via Dashboard

  1. Navigate to your agent
  2. Click "Settings" → "API Keys"
  3. Click "Create New Key"
  4. Enter key name
  5. Copy and save the key securely

Save Immediately: API keys are only shown once. Store them securely.

Using API Keys

REST API

curl https://api.swiftclaw.io/agents/my-agent/invoke \
  -H "Authorization: Bearer sk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello"}'

Python SDK

from swiftclaw import SwiftClaw

client = SwiftClaw(api_key="sk_live_abc123...")

response = client.agents.invoke(
    agent="my-agent",
    message="Hello"
)

Node.js SDK

import { SwiftClaw } from '@swiftclaw/sdk';

const client = new SwiftClaw({
  apiKey: 'sk_live_abc123...'
});

const response = await client.agents.invoke({
  agent: 'my-agent',
  message: 'Hello'
});

Managing API Keys

List Keys

# List all keys
swiftclaw keys list my-agent

# Output:
# NAME        KEY                  CREATED              LAST USED
# production  sk_live_abc123...    2024-03-01 10:00    2024-03-08 09:30
# staging     sk_live_def456...    2024-03-05 14:30    2024-03-07 16:45

Rotate Keys

# Create new key
swiftclaw keys create my-agent --name production-v2

# Update your application
# Verify new key works
# Revoke old key
swiftclaw keys revoke my-agent --key sk_live_abc123...

Revoke Keys

# Revoke specific key
swiftclaw keys revoke my-agent --key sk_live_abc123...

# Revoke by name
swiftclaw keys revoke my-agent --name production

Key Permissions

Read-Only Keys

# Create read-only key
swiftclaw keys create my-agent \
  --name readonly \
  --permissions read

Full Access Keys

# Create full access key
swiftclaw keys create my-agent \
  --name admin \
  --permissions read,write,delete

Key Metadata

Add metadata to keys for tracking:

swiftclaw keys create my-agent \
  --name production \
  --metadata environment=production,team=backend

Rate Limits

API keys have rate limits:

  • Live Keys: 1000 requests/minute
  • Test Keys: 10000 requests/minute

Check rate limit status:

swiftclaw keys status my-agent --key sk_live_abc123...

Security Best Practices

1. Use Environment Variables

# .env
SWIFTCLAW_API_KEY=sk_live_abc123...

2. Never Commit Keys

Add to .gitignore:

.env
.env.local
*.key

3. Rotate Regularly

Set up automatic rotation:

swiftclaw keys rotate my-agent \
  --interval 90d \
  --auto

4. Monitor Usage

Set up alerts for unusual activity:

swiftclaw alerts create \
  --agent my-agent \
  --metric api-key-usage \
  --threshold 1000 \
  --window 1h

Troubleshooting

Invalid API Key

Error: 401 Unauthorized - Invalid API key

Solutions:

  • Verify key is correct
  • Check key hasn't been revoked
  • Ensure key has required permissions

Rate Limit Exceeded

Error: 429 Too Many Requests

Solutions:

  • Implement exponential backoff
  • Reduce request rate
  • Upgrade to higher tier

Next Steps

  • Webhooks
  • REST API
  • SDK Reference

How is this guide ?

Last updated on

Authentication Overview

Understanding authentication in SwiftClaw

Webhooks

Receiving and verifying webhook events from SwiftClaw

On this page

API Keys
Creating API Keys
Via CLI
Via Dashboard
Using API Keys
REST API
Python SDK
Node.js SDK
Managing API Keys
List Keys
Rotate Keys
Revoke Keys
Key Permissions
Read-Only Keys
Full Access Keys
Key Metadata
Rate Limits
Security Best Practices
1. Use Environment Variables
2. Never Commit Keys
3. Rotate Regularly
4. Monitor Usage
Troubleshooting
Invalid API Key
Rate Limit Exceeded
Next Steps