Authentication
API key authentication for the Brandparser API
API Keys
All Brandparser API requests require authentication using an API key.
API Key Format
API keys follow this format:
bp_{environment}_{random_string}bp_prod_- Production environment keysbp_stag_- Staging environment keys
Example: bp_prod_xK9mP2nQ4rS6tU8vW0xY
Using Your API Key
Include your API key in the Authorization header as a Bearer token:
curl https://api.brandparser.com/v1/api/brands \
-H "Authorization: Bearer bp_prod_your_api_key"Creating API Keys
- Log in to your Brandparser dashboard
- Go to Settings > API Keys
- Click Create API Key
- Select the environment (staging or production)
- Optionally add a description to identify the key's purpose
- Click Create
Your API key is displayed once. Copy it immediately - you won't be able to see it again.
Key Security Best Practices
Do
- Store API keys in environment variables or a secrets manager
- Use staging keys for development and testing
- Rotate keys periodically
- Use separate keys for different applications
Don't
- Commit API keys to source control
- Share keys between team members
- Expose keys in client-side code
- Log API keys in application output
Environment Variables
Store your API key in an environment variable:
# .env file (add to .gitignore)
BRANDPARSER_API_KEY=bp_prod_your_api_keyAccess it in your code:
// Node.js
const apiKey = process.env.BRANDPARSER_API_KEY;# Python
import os
api_key = os.environ.get('BRANDPARSER_API_KEY')Workspace Scope
API keys are scoped to a single workspace. Brands created with a key belong to that workspace and can only be accessed by keys from the same workspace.
Revoking Keys
To revoke an API key:
- Go to Settings > API Keys
- Find the key you want to revoke
- Click the Delete button
- Confirm the deletion
Revoked keys immediately stop working. Any applications using that key will receive 401 Unauthenticated responses.
Error Responses
Missing Authorization Header
{
"error": "Unauthenticated",
"message": "Missing authentication token"
}Invalid API Key Format
{
"error": "Unauthenticated",
"message": "Invalid API key format"
}Invalid or Revoked Key
{
"error": "Unauthenticated",
"message": "Invalid API key"
}All authentication errors return HTTP status 401.