API Key Authentication
CWMPay uses API keys to authenticate requests. Every request to the CWMPay API must include your API key in the request header.Getting Your API Key
- Login to app.cwmpay.in
- Navigate to API Keys section from the sidebar
- Click Generate API Key if not generated
- Copy and store your key securely
Using Your API Key
Pass your API key in thex-api-key header with every request:
Best Practices
Store in Environment Variables
Store in Environment Variables
Never hardcode your API key in your source code. Always use environment variables:
Never Expose in Frontend
Never Expose in Frontend
API keys must only be used server-side. Never include your API key in:
- Frontend JavaScript code
- Mobile app source code
- Public GitHub repositories
- Browser requests
Regenerate if Compromised
Regenerate if Compromised
If you suspect your API key has been compromised:
- Go to API Keys in your dashboard
- Click Regenerate Key
- Update your environment variables immediately
- Old key will be invalidated instantly
Error Responses
If authentication fails, you’ll receive one of these responses:Next Steps
Create Payment
Start accepting INR payments
Webhooks
Set up payment notifications

