Skip to main content

Generate API keys

First of all, you need to generate the private and public API keys. The following code samples illustrate how to handle that.

info

Requires Node.js >= 18.

const crypto = require('crypto');

const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 2048,
publicKeyEncoding: {
type: 'pkcs1',
format: 'der'
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'der'
}
});

console.log('The private key is: ', privateKey.toString('hex'));
console.log();
console.log('The public key is: ', publicKey.toString('base64'));
console.log();
console.log('Api Key Base64 is: ', crypto.createHash('sha256').update(publicKey).digest('base64'));
warning

Keep your private key in a safe place and don't share it with anyone, not even us.

You need to share with us only your:

  • Public key;
  • API key Base64.