Skip to main content

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

  1. Login to app.cwmpay.in
  2. Navigate to API Keys section from the sidebar
  3. Click Generate API Key if not generated
  4. Copy and store your key securely

Using Your API Key

Pass your API key in the x-api-key header with every request:

Best Practices

Never hardcode your API key in your source code. Always use environment variables:
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
Always make CWMPay API calls from your backend server.
If you suspect your API key has been compromised:
  1. Go to API Keys in your dashboard
  2. Click Regenerate Key
  3. Update your environment variables immediately
  4. 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