How to validate license keys in an Electron app
To validate license keys in an Electron app, call Ruba’s activate endpoint once per device and its validate endpoint when the app starts or a paid action runs, from the main process, always sending your organization ID. Ruba issues the keys and hosts the check, and pays you to your own bank. What happens when a check fails is yours to design.
The flow in plain steps
A Ruba license key can allow 1 to 50 activations, and a validate call tells your app if a key is still good. Tanvir in Chattogram built a bulk file renamer with Electron. A buyer pays on a Ruba checkout link, receives a key like RENAME-…, and pastes it into the app. Then the app must decide: is this key real, and is it allowed on this computer?
- First runActivateLabel the device. Store the activation ID.
- Each launchValidateSend key and activation ID.
- SuccessUnlock featuresCache the result carefully.
- FailureLock or explainYour design decides.
Activate a device
The activate call needs the key, your organization ID, a label for the device and optional conditions. The conditions you register here must be sent again at validation.
const API = 'https://api.getruba.com' // use https://sandbox-api.getruba.com in tests
export async function activate(key: string, label: string) {
const response = await fetch(`${API}/v1/customer-portal/license-keys/activate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
key,
organization_id: ORGANIZATION_ID,
label,
conditions: { major_version: 1 },
}),
})
if (!response.ok) throw new Error('Activation failed')
return response.json()
}Validate on launch
Validation takes the key, your organization ID, the activation ID and the same conditions. Always check the organization ID, so a valid key from another seller’s shop cannot unlock your app. If you sell several License keys benefits, match the benefit ID too.
export async function isLicensed(key: string, activationId: string) {
const response = await fetch(`${API}/v1/customer-portal/license-keys/validate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
key,
organization_id: ORGANIZATION_ID,
activation_id: activationId,
conditions: { major_version: 1 },
}),
})
return response.ok
}The installer goes to the buyer by a private link that lasts 60 minutes, and the file is checked for malware first.
Decisions that are yours
What to do next
Create a product, attach a License keys benefit and test in the sandbox. Then see the early-access deal. Ruba charges 4% + $0.50 per sale with no monthly fee. Related: selling a desktop app with license keys.
Validate on launch, and handle the offline case. Skip the company and the monthly fee: neither is needed. The rate for your Electron app is 4% + $0.50 per sale, locked once you are approved in early access, for as long as the account stays open and in good standing. A fee Ruba never told you about is refunded, and Ruba pays you $100. Terms apply. See the early-access deal.
Questions people ask
Which endpoints do I call?
The customer portal has endpoints for license keys: activate and validate, at /v1/customer-portal/license-keys/activate and /validate on api.getruba.com. They take the key and your organization ID, and they need no access token in the app.
What must I always check?
The organization ID, so a valid key from another Ruba organization cannot be accepted. If your organization sells several License keys benefits, also match the benefit ID to the capability you expect.
How do I limit a key to a few computers?
Set an activation limit from 1 to 50 on the benefit. Create an activation with a label when the app starts on a new device, then send the activation ID when you validate.
What about working offline?
Ruba hosts online validation. If your app must work offline, decide how long to trust the last successful check, and store it carefully. That part is your design.
Does Ruba store the activation for me?
Ruba records activations. Your app stores the activation ID it gets back, so it can validate later.
Sources
We check these when we update this guide. Rules can change, so check them yourself before you decide.
- Ruba: license keysChecked 26 Nov 2026
- Ruba: sandboxChecked 26 Nov 2026
- Ruba: subscriptionsChecked 26 Nov 2026
- Ruba: pricing and feesChecked 26 Nov 2026