Get Your API Key

How to Obtain an API Key

To start using the BillMyAgent API, you'll need an API key. API keys are used to authenticate all your API requests.

Option 1: Self-Service Registration (Recommended)

Create an account and manage your API keys directly:

  1. Sign up for a free account
  2. Log in to the Admin Portal
  3. Navigate to the API Keys section
  4. Click Create New API Key
  5. Give your key a descriptive name (e.g., "Production API Key" or "Development Key")
  6. Copy the generated key immediately - it will only be shown once!
  7. Store it securely in your environment variables or secrets manager

⚠️ Important: API keys are hashed before storage and cannot be retrieved later. Make sure to save your key securely when it's generated.

Option 2: Development/Testing (Local Only)

For local development and testing, you can create API keys manually using the provided scripts. See the Documentation for details on using the API key generation scripts.

Note: In development mode, the API Gateway accepts any API key value for testing purposes. In production, all API keys must be valid and registered in the database.

API Key Format

API keys follow this format:

sk_live_<64-hex-characters>

Example:

sk_live_a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456

Security Best Practices

  • Never commit API keys to version control - Use environment variables or secrets managers
  • Use different keys for different environments - Separate keys for development, staging, and production
  • Rotate keys regularly - Update your API keys every 90 days or as needed
  • Revoke compromised keys immediately - If a key is exposed, deactivate it immediately
  • Use HTTPS only - Always transmit API keys over secure connections
  • Monitor key usage - Watch for unusual access patterns

Using Your API Key

Once you have your API key, include it in all API requests using the X-API-Key header:

fetch('http://localhost:3001/api/v1/payments', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here'
  },
  body: JSON.stringify({
    // your payment data
  })
});

Next Steps

Once you have your API key:

  1. Check out the API Reference for endpoint details
  2. Follow our Integration Guides for step-by-step instructions
  3. Explore Code Examples to see implementations in different languages