Skip to content

Import from KeyAuth

Move your keys, subscriptions and users from KeyAuth with one call of the Management API. Every imported license gets a new key in your product's format. Old KeyAuth keys stop working, so tell your customers their new key; the import report lists it next to the old one.

1. Export from KeyAuth

Call these endpoints of KeyAuth's seller API and keep the JSON:

KeyAuth call Field to send
fetchallkeys keys
fetchallusers users (with subscriptions if your export has them)
fetchallsubs subscriptions (needed for user subscriptions whose key is not among keys)

Send the rows as they come; unknown fields are ignored. Passwords, HWIDs and IP addresses are never read. Devices activate again with the Noctix SDK, because KeyAuth's device IDs are not comparable with device identification.

2. Map levels to plans

Create a plan for each KeyAuth level first, then map the levels in levels. Trial plans are not allowed.

3. Dry run

curl -X POST https://api.example.com/v1/products/$PRODUCT/imports/keyauth \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{
    "dry_run": true,
    "levels": { "1": "plan_basic", "2": "plan_pro" },
    "subscriptions": [{ "name": "default", "level": "1" }],
    "keys": [{ "key": "ABC-123", "level": "1", "status": "Used", "usedby": "ada" }],
    "users": [{ "username": "ada", "email": "ada@example.com",
                "subscriptions": [{ "subscription": "default", "expiry": "1924992000", "key": "ABC-123" }] }]
  }'

The answer is the report of the real import, with nothing stored:

  • licenses: what would be created, with source (key or subscription), row, keyauth_key, username, plan_id and expires_at.
  • skipped: every row that is not imported, with reason.
  • warnings: rows imported with a change (invalid_email: the customer is imported without the address).
  • customers_created, customers_existing.
Reason Meaning
missing_key, missing_username The row has no key or username
invalid_username Username longer than 191 characters
duplicate The same key, user or subscription appears twice
banned, banned_user The key or its user is banned at KeyAuth
unmapped_level No plan in levels for the level
unknown_subscription The subscription is not in subscriptions
invalid_expiry, expired The expiry is not a Unix time or has passed
already_imported An earlier import created it

4. Import

Send the same body without dry_run, ideally with an Idempotency-Key header. The answer is 201 with the same report, now with license_id, customer_id and the new key of each license. Keep it: a replay of the same request answers without keys (fetch one with GET /v1/licenses/{id}/key).

  • Users become customers with the external user ID keyauth:<username>.
  • Licenses carry the tag keyauth. A license gets its end from the KeyAuth subscription, otherwise from the plan.
  • One request takes up to 1000 rows of keys and users, and the body limit of the API applies. Split a larger export into parts: rows imported before are reported as already_imported, and users are reused. A subscription that names its key and that key are the same license, even when they come in different requests. Send a user together with the keys they redeemed, so those keys get the subscription's expiry.

The dashboard does all of this for you: open the product, choose Import from KeyAuth, add the three JSON files, map the levels, check, import, and download the new keys as CSV.

Needs the scopes licenses:write and customers:write. Resellers cannot import.