API Request Authentication
All API requests to Devdraft must be authenticated using API keys. This guide explains how to obtain and use your API keys securely.API Keys
Devdraft uses API keys to authenticate requests. You can manage your API keys from your dashboard.Live Keys
Production Environment
- Format:
pk_live_...
(publishable) andsk_live_...
(secret) - Process real transactions
- Connect to production systems
Test Keys
Development & Testing
- Format:
pk_test_...
(publishable) andsk_test_...
(secret) - Safe for development
- No real money processed
Key Permissions
Key Permissions
Client-Side Safe: These keys can be safely used in client-side code as they have limited permissions.
- Limited to creating payment intents and retrieving public data
- Cannot access sensitive account information
- Safe to expose in frontend applications
Authentication Methods
Bearer Token Authentication
Include your secret API key in theAuthorization
header:
Basic Authentication
Alternatively, use HTTP Basic Authentication with your secret key as the username:Request Headers
Required Headers
Optional Headers
Code Examples
Security Best Practices
Protecting Your Keys
- Never expose secret keys in client-side code
- Use environment variables to store keys
- Rotate keys regularly for enhanced security
- Restrict key permissions to minimum required scope
Environment Variables
Store your keys securely:Key Rotation
Regularly rotate your API keys:- Generate a new API key in your dashboard
- Update your application configuration
- Test the new key in a staging environment
- Deploy to production
- Delete the old key