> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarms.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Key Setup

> This guide provides step-by-step instructions for obtaining and configuring your Swarms API key to access the Swarms platform services.

This guide provides step-by-step instructions for obtaining and configuring your Swarms API key to access the Swarms platform services.

### Getting Started

#### Step 1: Create Your Account

1. Navigate to the official Swarms platform: [https://swarms.world](https://swarms.world/)
2. Complete the registration process by providing the required information
3. Verify your email address to activate your account

**Benefit**: New users automatically receive free API credits upon successful signup. Check `GET /v1/account/credits` (or the platform dashboard) for your current balance — billable endpoints require a total credit balance greater than \$1.00.

#### Step 2: Generate Your API Key

1. Log into your Swarms account
2. Access the API Keys section: [https://swarms.world/platform/api-keys](https://swarms.world/platform/api-keys)
3. Click "Create New API Key"
4. Assign a descriptive name for your key (recommended for organization)
5. Configure key permissions based on your intended use case
6. Save the generated API key immediately

**Important**: Store your API key securely as it will only be displayed once upon creation.

#### Step 3: Environment Configuration

Immediately after generating your API key, configure it in your environment:

**Option A: Environment Variable (Recommended)**

```bash theme={null}
export SWARMS_API_KEY="your_api_key_here"
```

**Option B: Environment File (.env)**

```
SWARMS_API_KEY=your_api_key_here
```

**Security Note**: Never commit API keys to version control systems. Use environment variables or secure configuration management tools.

#### Step 4: Verify Your API Key

Send your key in the `x-api-key` header. The `Authorization: Bearer <key>` header is also accepted (useful for OpenAI SDK compatibility).

```bash theme={null}
curl -H "x-api-key: $SWARMS_API_KEY" https://api.swarms.world/v1/account/credits
```

```bash theme={null}
curl -H "Authorization: Bearer $SWARMS_API_KEY" https://api.swarms.world/v1/account/credits
```

A successful response returns your current credit balance, confirming the key is active.

### API Key Management

#### Key Organization

* Create specific API keys for different applications and services
* Use descriptive naming conventions to identify key purposes
* Regularly rotate keys for enhanced security
* Monitor key usage through the platform dashboard

#### Best Practices

* Store keys in secure environment variables
* Implement key rotation schedules
* Monitor API usage and billing
* Revoke unused or compromised keys immediately

### Credit System

#### Initial Credits

* Free credits are applied automatically to your account balance upon account creation
* No payment information required for initial usage
* Billable endpoints (`/v1/agent/completions`, `/v1/swarm/completions`, `/v1/chat/completions`, and the Premium endpoints) require a total credit balance greater than \$1.00
* Check your current balance anytime with `GET /v1/account/credits`

### Support and Resources

For technical support or billing inquiries:

* Visit the Swarms platform documentation
* Contact support through the platform dashboard
* Check the community forums for common solutions

### Security Considerations

* Keep API keys confidential and secure
* Use HTTPS for all API communications
* Implement proper error handling in applications
* Monitor API usage for unusual activity
* Report suspected security issues immediately

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.