Skip to main content

Generate RSA Key Pair

To authenticate with our API, you need to generate an RSA key pair (public and private keys). The public key will be registered in your dashboard, while the private key will be used to sign your API requests.
The API uses RSA-2048 keys. Make sure to generate keys with a 2048-bit modulus length.

Overview

1

Generate the key pair

Use one of the methods below to generate your RSA key pair. You’ll get both a private key and a public key.
2

Extract the public key

Extract the public key from your generated key pair. The public key will be in PEM format.
3

Register the public key

Copy the public key and register it in your dashboard. Keep your private key secure and never share it.

Language-Specific Examples

Choose your preferred language to see how to generate RSA keys:
# 1. Generate the private key
openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048

# 2. Extract the public key
openssl rsa -pubout -in private_key.pem -out public_key.pem

# 3. Copy the public key in the dashboard
After running these commands, you’ll have two files: private_key.pem (keep this secure) and public_key.pem (copy this to your dashboard).

Security Best Practices

Never share your private key. Keep it secure and never commit it to version control or expose it in client-side code.
  • Store your private key securely (use environment variables or secure key management services)
  • Use a 2048-bit key size (as shown in all examples)
  • Never expose your private key in logs, error messages, or public repositories
  • Rotate your keys periodically for enhanced security
  • Use different key pairs for different environments (development, staging, production)

Next Steps

After generating your RSA key pair:
  1. Register your public key in the dashboard
  2. Store your private key securely - you’ll need it to sign API requests
  3. Learn about request signing - see our Request Signing guide to understand how to use your private key to authenticate API requests

Common Issues

Make sure your keys are in PEM format. PEM keys start with -----BEGIN and end with -----END.
Ensure you’re generating 2048-bit keys. Some older examples may use 1024-bit keys, which are not supported.
Verify that your private key is valid and in the correct format before extracting the public key.