Overview
This guide covers everything you need to know about authenticating with the Cred Protocol API, from creating API keys to implementing secure authentication in your applications.Authentication Methods
The Cred Protocol API uses Bearer token authentication. Every request must include your API key in theAuthorization header.
Creating API Keys
Step-by-Step Guide
1
Sign In
Go to app.credprotocol.com and sign in to your account.
2
Navigate to Dashboard
Click on Dashboard in the navigation menu.
3
Access API Keys
Find the API Keys section in your dashboard.
4
Create New Key
Click Create API Key and enter a descriptive name for your key.
5
Copy and Store Securely
Copy your API key immediately and store it securely. You won’t be able to view the full key again.
Implementation Examples
Environment Variables
Always store your API key in environment variables:Backend Proxy Pattern
For web applications, create a backend proxy to keep your API key secure:SDK Pattern
Create a reusable client for your application:Security Best Practices
Never expose keys in client-side code
Never expose keys in client-side code
API keys should never be included in frontend JavaScript, mobile apps, or anywhere they can be viewed by end users.
Use environment variables
Use environment variables
Store API keys in environment variables, never in code:
- Use
.envfiles for local development - Use secret management services in production (AWS Secrets Manager, HashiCorp Vault, etc.)
- Never commit
.envfiles to version control
Rotate keys regularly
Rotate keys regularly
Establish a key rotation schedule:
- Create a new API key
- Update your application to use the new key
- Verify the new key works in production
- Revoke the old key
Use separate keys for environments
Use separate keys for environments
Create different API keys for:
- Development
- Staging
- Production
Monitor key usage
Monitor key usage
Regularly review your API usage in the Dashboard to:
- Detect unusual activity patterns
- Identify compromised keys
- Optimize your usage
Troubleshooting
Common Errors
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
- Accessing a feature not included in your plan
- Rate limit exceeded
- Check your plan limits in the Dashboard
- Upgrade your plan if needed
- Implement rate limiting in your application