Create API Keys

API keys enable secure server-to-server communication and automation workflows with Bluebricks without requiring interactive login.

Prerequisites

  • Bluebricks account with API key permissions

  • Bricks CLI installed and logged in (for first-time creation)

  • Required role: Admin

Creating API Keys

Method 1: Using cURL with JWT Token

First, you need to get your JWT token from credentials:

# Get your JWT token
cat ~/.bricks/environment.yaml | grep token | sed -n 's/^token: Bearer //p'

# Create a new API key
curl https://api.bluebricks.co/api/v1/auth/key \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_JWT_TOKEN' \
  --data '{"name": "my-automation-key"}'

Method 2: Using Web Interface

  1. Log into Bluebricks dashboard

  2. Navigate to Settings > API Keys (Or click herearrow-up-right)

  3. Click "Create New API Key"

  4. Enter a descriptive name

  5. Copy the generated key (shown only once)

Using API Keys

Environment Variable

Command Line Flag

Configuration File

Add to ~/.bricks/config.yaml:

API Key Management

List API Keys

Activate/Deactivate Keys

Automation Use Cases

CI/CD Pipelines

Use the Bricks GitHub Actionarrow-up-right to automate deployments:

Server Scripts

Security Best Practices

  • Store securely: Use environment variables or secure secret management

  • Rotate regularly: Create new keys and deactivate old ones

  • Limit permissions: Use keys with minimal required permissions

  • Monitor usage: Review API key activity regularly

  • Never commit: Never include API keys in version control

See also

Last updated

Was this helpful?