Overview
Brand DNA API uses API keys for authentication. All requests must include a valid API key in theAuthorization header.
Creating API Keys
See API Keys for detailed management.
Authentication Method
Bearer Token
Include API key inAuthorization header:
API Key Format
API keys follow this pattern:- Production:
sk_live_+ 32 alphanumeric characters - Test:
sk_test_+ 32 alphanumeric characters
Permissions (Scopes)
API keys support granular permissions:| Scope | Read | Write | Description |
|---|---|---|---|
read:analyses | ✅ | — | Retrieve analysis results and history |
write:analyses | — | ✅ | Run new brand analyses |
read:chat | ✅ | — | Retrieve Helix chat history |
write:chat | — | ✅ | Send messages to Helix AI |
read:workspace | ✅ | — | View tasks and workspace data |
write:workspace | — | ✅ | Create, update, delete tasks |
read:competitors | ✅ | — | Retrieve competitor data |
write:competitors | — | ✅ | Add/remove tracked competitors |
read:exports | ✅ | — | Download PDF exports |
write:exports | — | ✅ | Generate new exports |
admin:team | ✅ | ✅ | Manage team members (Agency only) |
admin:full | ✅ | ✅ | All permissions |
Checking Required Scopes
Each endpoint specifies required scopes in documentation: Example:POST /v1/analyze
- Required Scopes:
write:analyses - 403 Forbidden if key lacks this scope
Making Authenticated Requests
cURL Example
JavaScript/Node.js Example
Python Example
PHP Example
Error Responses
401 Unauthorized
Missing or invalid API key:- API key missing from
Authorizationheader - API key has been revoked
- Typo in API key (extra spaces, incorrect format)
403 Forbidden
Valid key, but insufficient permissions:- Create new API key with required scopes
- Or update existing key permissions (Settings → API Keys)
Security Best Practices
1. Store Keys Securely
Good: Environment Variables2. Use HTTPS Only
All API requests MUST use HTTPS:3. Rotate Keys Regularly
Best Practice: Rotate API keys every 90 days4. Use Minimal Permissions
Only grant scopes your application needs: Example: Dashboard displaying analysis results- ✅ Grant:
read:analyses - ❌ Don’t grant:
write:analyses,admin:full
5. Separate Keys per Environment
Use different API keys for:- Development:
sk_test_keys for local testing - Staging: Separate key for staging environment
- Production: Production-only key with minimal scopes
- Revoke dev key without affecting production
- Track usage by environment
- Limit damage if key is compromised
6. Monitor Key Usage
Regularly review API key activity:- Settings → API Keys → Last Used column
- Investigate keys unused for 30+ days
- Revoke unused or suspicious keys
API Key Lifecycle
Active Key
Revoked Key
- All requests return
401 Unauthorized - Cannot be reactivated (must create new key)
Test vs. Production Keys
Test Keys (sk_test_)
Purpose: Testing and development
Behavior:
- Access sandbox environment:
https://sandbox-api.branddna.app/v1 - No rate limits
- Data deleted after 7 days
- Doesn’t count toward production quotas
Production Keys (sk_live_)
Purpose: Production applications
Behavior:
- Access production environment:
https://api.branddna.app/v1 - Rate limits enforced
- Data persisted according to plan
- Counts toward quotas
Troubleshooting
API Key Not Working
Check:- Key format correct:
sk_live_orsk_test_+ 32 chars - No extra spaces or line breaks
- Key hasn’t been revoked (Settings → API Keys)
- Subscription is active (billing issue can disable API)
Permission Errors
403 Forbidden:- Check required scopes for endpoint in docs
- Verify key has those scopes (Settings → API Keys)
- Create new key with correct permissions
Rate Limit Issues
429 Too Many Requests:- Check
X-RateLimit-Remainingheader - Implement exponential backoff
- Upgrade to Agency for higher limits
Related Pages
- API Overview - Getting started with the API
- API Keys - Manage keys and permissions
- Analysis API - Run brand analyses
- Rate Limits - Request limits by tier
Authentication configured? Continue to Analysis API →

