API Keys

Generate and regenerate Test and Live API Keys using the Razorpay Dashboard.


API key is a combination of the key_id and key_secret and is required to make any API request to Razorpay. You need to the API key in your code as part of your integration process.

Follow these steps to generate API keys:

  1. Log in to your with appropriate credentials.
  2. Select the mode (Test or Live) for which you want to generate the API key.
    • Test Mode: The test mode is a simulation mode that you can use to test your integration flow. Your customers will not be able to make payments in this mode.
    • Live Mode: When your integration is complete, switch to live mode and generate live mode API keys. Replace test mode keys with live mode keys in the integration to accept payments from customers.
  3. Navigate to Account & SettingsAPI Keys (under Website and app settings) → Generate Key to generate key for the selected mode.

The Key Id and Key Secret appear on a pop-up page.

Watch this video to see how to generate API keys in the test mode.


Watch this video to see how to generate API keys in the live mode.

Watch Out!

  • After generating the keys from the Dashboard, download and save them securely. If you do not remember your API Keys, you need to re-generate them from the Dashboard and replace it wherever required.
  • Do not share your API Key secret with anyone or on any public platforms. This can pose security threats for your Razorpay account.
  • Once you generate the API Keys, only the Key Id is visible on the Dashboard and not the Key secret as it can pose security threats for your Razorpay account.

Once generated, you will be able to see the Key Id, the date the key was created and the expiry date for the API Key on screen.

Live mode API keys generated on the Razorpay dashboard

You also have the option to regenerate the key if required.

Two-Factor Authentication

To regenerate API keys, you must validate your identity via OTP sent to your registered mobile number. However, this step is skipped if you already performed OTP validation while logging in to the Dashboard.

If you have not set up two-factor authentication, you will be prompted to verify your mobile number before re-generating keys.

Regenerate API keys on the Razorpay dashboard

To regenerate API key:

  1. Log in to the .
  2. Select the mode for which you want to generate the API key from the menu ribbon.
  3. Navigate to Account & SettingsAPI Keys (under Website and app settings) → Generate Key to generate key for the selected mode.
  4. Click Regenerate Key.

This gives you the option to deactivate the old key immediately or in 24 hours.


Was this page helpful?