Skip to main content

Authentication

All Scrub API requests require authentication using an API key.

Getting Your API Key

  1. Log in to your Scrub Dashboard
  2. Navigate to API Keys
  3. Click Create New Key
  4. Give your key a descriptive name (e.g., "Production", "Development")
  5. Copy the key immediately - it won't be shown again

Using Your API Key

Include your API key in the Authorization header of every request:

curl https://api.scrub.health/v1/chat/completions \
-H "Authorization: Bearer sk_scrub_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello"}]}'

API Key Format

Scrub API keys follow this format:

sk_scrub_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Security Best Practices

  • Never commit API keys to version control - Use environment variables
  • Use different keys for different environments - Separate production and development
  • Rotate keys periodically - Delete old keys and create new ones
  • Monitor usage - Check the Dashboard logs for unexpected activity

Environment Variables

We recommend storing your API key in an environment variable:

export SCRUB_API_KEY="sk_scrub_your_api_key_here"

Then reference it in your code:

import os
api_key = os.environ.get("SCRUB_API_KEY")
const apiKey = process.env.SCRUB_API_KEY;

Rate Limits

API keys are subject to rate limits based on your plan. Check your Dashboard for current limits and usage.

Revoking Keys

To revoke an API key:

  1. Go to API Keys in your Dashboard
  2. Find the key you want to revoke
  3. Click Delete

Revoked keys are immediately invalidated and cannot be restored.