Summary
Add support for recovering instance_id after network failures during license activation. Either make activate idempotent, or allow instance_name as an alternative to instance_id in the validate endpoint.
Problem
When calling POST /v1/licenses/activate, if the network drops before the response reaches the client, the instance_id is lost. Since /v1/licenses/validate requires instance_id, there's no way to recover.
I've tested and confirmed that calling activate again with the same key + instance_name creates a new instance (not idempotent), which increments activation_usage.
Proposed Solutions
Idempotent activation If
activateis called with the samekey+instance_name, return the existing instance instead of creating a new one. (This might be a breaking change)Allow
instance_namein validate (less invasive) Acceptinstance_nameas an alternative toinstance_idin the validate endpoint.POST /v1/licenses/validate { key, instance_name }This would be non-breaking since it just adds a new optional parameter.
Reference
Discussion:
https://discord.com/channels/1262843562140241952/1467467311320666258/1467467311320666258
LemonSqueezy has the same issue: https://lemonsqueezy.nolt.io/733
Keygen.sh handles this with fingerprint scope: https://keygen.sh/docs/choosing-a-licensing-model/floating-licenses/
Creem Activate API: https://docs.creem.io/api-reference/endpoint/activate-license
Creem Validate API: https://docs.creem.io/api-reference/endpoint/validate-license
