API Key Authentication
ScriptBase uses API key authentication. All requests must include your API key in the request headers.Getting Your API Key
Create an Account
Sign up at dashboard.scriptbase.app
Authentication Methods
ScriptBase supports two ways to pass your API key:Method 1: X-API-Key Header (Recommended)
Pass your API key using theX-API-Key header:
Method 2: Authorization Bearer Header
Alternatively, use theAuthorization header with a Bearer token:
Security Best Practices
Never expose API keys in client-side code
Never expose API keys in client-side code
API keys should only be used in server-side code. Never include them in frontend JavaScript, mobile apps, or public repositories.
Use environment variables
Use environment variables
Store API keys in environment variables, not in your codebase:Then reference them in your code:
Rotate keys regularly
Rotate keys regularly
Create new API keys periodically and delete old ones to minimize risk if a key is compromised.
Use separate keys for different environments
Use separate keys for different environments
Create different API keys for development, staging, and production environments.
Monitor key usage
Monitor key usage
Regularly check your API key usage in the dashboard to detect any suspicious activity.
Managing API Keys
View All Keys
See all your API keys in the dashboard at dashboard.scriptbase.app/keys.Deactivate a Key
If you suspect a key has been compromised:- Go to the API Keys section
- Find the compromised key
- Click “Deactivate” to immediately stop all requests using that key
- Create a new key to replace it
Key Information
Each API key shows:- Name: Descriptive name you provided
- Created: When the key was created
- Last Used: Last time the key was used
- Status: Active or Inactive
- Requests: Total number of requests made with this key
Authentication Errors
If authentication fails, you’ll receive an error response:| Error Code | Description | Solution |
|---|---|---|
INVALID_API_KEY | API key is missing, invalid, or inactive | Check that your key is correct and active |
UNAUTHORIZED | Missing authentication header | Include X-API-Key or Authorization header |
API_KEY_INACTIVE | API key has been deactivated | Create a new API key |
Testing Your Authentication
Test that your API key works correctly:The
/api/v1/account endpoint does not consume credits, making it perfect for testing authentication.