Gatemi License Manager Developer Reference

Read from the plugin code. The free edition is plain WordPress PHP (GMLKF_* classes) and has no REST API; everything under "REST API" is the full edition (GatemiLicenseManager).

REST API — Full edition

Base: https://your-store.example/wp-json/gatemi-lk/v1/

Every route is public by design: the license key is the credential, and an activation token (returned by /activate) identifies one site. Send parameters as JSON in the body for POST routes and as query arguments for GET routes. Always use HTTPS — the key travels in the request.

Errors

A refusal is a standard WordPress REST error:

{
  "code": "max_activations",
  "message": "This license has no activation slots left. Deactivate an old site in your account, or upgrade the license.",
  "data": { "status": 409, "manage_url": "https://your-store.example/my-account/gmlk-licenses/" }
}

data.manage_url is on every error — the Where customers manage their licenses setting, or My Account → Licenses — so your software can always link the customer to the fix. Switch on code; the message is for people.

Code HTTP Meaning
invalid_key 404 No license has this key.
invalid_site 400 site_url could not be parsed.
not_activated 404 No live activation matches this key and token.
product_mismatch 403 The license does not cover this product identifier.
expired 403 The license has expired (activation only).
revoked 403 The license was revoked or refunded.
max_activations 409 No free slot (or the local-site cap is reached).
no_release 404 No release, or the package file is missing.
invalid_signature 403 A download link is forged or past its expiry.
invalid_products 400 /sync was sent no usable product list.
too_many_products 400 /sync asked about more products than allowed (250).
rate_limited 429 Too many requests; data.retry_after gives seconds.
server_error 500 The activation could not be stored.

The license object

/activate, /check and /sync answer with:

{
  "status": "active",
  "expires_at": "2027-10-20",
  "activations": { "used": 2, "limit": 3 },
  "token": "9f2c1a7e5b3d4c6a8e0f1b2c3d4e5f60"
}

status is active, expired or revoked. expires_at is a date (UTC) or null for a key that never expires. activations.used counts live, non-local sites.

POST /activate

Parameter Required Description
key yes The license key.
product yes The product identifier your software uses — must be one of the license's Product identifiers (or the product's slug when none are set).
site_url yes The site's address, e.g. https://shop.example.com.
versions no Object with optional plugin, wp, php strings, recorded on the activation.

Returns the license object with the site's token. Store the token: every other route needs it. Activating a site that is already active returns the same token and uses no extra slot. Local and staging sites never use a slot. Refuses invalid_key, product_mismatch, revoked, expired, invalid_site, max_activations.

POST /deactivate

Parameter Required Description
key yes The license key.
token yes The activation token.

Returns { "deactivated": true } — also when the site was already deactivated. Refuses invalid_key, not_activated (no activation has this token). Deactivating does not depend on the license's status, so a site can always give its slot back.

POST /check

Parameter Required Description
key yes The license key.
token yes The activation token.
product yes The product identifier.
versions no As for /activate.

Returns the license object and records the site as seen. An expired license is still answered (with status: "expired"), so your software can say so. Refuses invalid_key, not_activated, product_mismatch.

GET /update

Parameter Required Description
key yes The license key.
token yes The activation token.
product yes The product identifier (the release slug).
{
  "version": "1.4.0",
  "requires": "6.4",
  "tested": "6.8",
  "requires_php": "7.4",
  "last_updated": "2026-10-01 09:12:44",
  "changelog_html": "<h4>1.4.0</h4><ul><li>…</li></ul>",
  "license_status": "active",
  "package": "https://your-store.example/wp-json/gatemi-lk/v1/download?product=…&version=…&lid=…&exp=…&sig=…"
}

package is present only for an active license. An expired license gets the same details plus manage_url and no package. A revoked license is refused. Refuses invalid_key, not_activated, product_mismatch, revoked, no_release.

GET /download

Use the package URL exactly as returned. Its parameters are product, version, lid (license id), exp (Unix expiry) and sig (HMAC-SHA256 of product|version|lid|exp). The link lasts 600 seconds by default. On success the zip is streamed (Content-Type: application/zip). The license is checked again at download time. Refuses invalid_signature, revoked (not active any more), product_mismatch, no_release.

POST /sync

One call for every product on a site.

Parameter Required Description
key yes The license key.
token yes The activation token.
products yes A list of slugs, or of objects { "slug": "my-plugin", "installed": "1.3.2" }. At most 250.
versions no As for /activate.

Returns the license object plus products, keyed by slug. Each entry is either the /update payload (with package only when the license is active and the release is newer than installed, or installed was not given) or a per-product error { "error": "product_mismatch", "message": "…" }. One product the key does not cover never fails the whole call. Whole-call refusals: invalid_products, too_many_products, invalid_key, not_activated, revoked.

Rate limits

Every route counts each request twice, in 300-second windows: per route + IP + key (30 requests, or 3 per product the key covers if more) and per route + IP (600). Every answer carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; a 429 also carries Retry-After. Behind a proxy or CDN, declare the proxy addresses with gmlk_trusted_proxies — otherwise every customer shares the proxy's address.

Example: activating from your software

$response = wp_remote_post( 'https://your-store.example/wp-json/gatemi-lk/v1/activate', array(
	'headers' => array( 'Content-Type' => 'application/json' ),
	'body'    => wp_json_encode( array(
		'key'      => $key,
		'product'  => 'my-plugin',
		'site_url' => home_url(),
		'versions' => array( 'plugin' => MY_PLUGIN_VERSION, 'wp' => get_bloginfo( 'version' ), 'php' => PHP_VERSION ),
	) ),
	'timeout' => 15,
) );
$body = json_decode( wp_remote_retrieve_body( $response ), true );
if ( isset( $body['token'] ) ) {
	update_option( 'my_plugin_license_token', $body['token'] );
} elseif ( isset( $body['code'] ) ) {
	// e.g. 'max_activations' — show $body['message'] and link $body['data']['manage_url'].
}

A network failure is not an answer: keep the stored state until the server actually says otherwise.

Filters — Full edition

Filter Arguments Default What it changes
gmlk_download_url_lifetime int $seconds 600 (min 60) How long a signed download link lasts.
gmlk_releases_dir string $dir uploads/gmlk-releases Where release packages are stored.
gmlk_site_is_local bool $local, string $host false Treat more hosts as free local or staging sites (called after the built-in list).
gmlk_local_activation_cap int $cap, array $license, string $site max(5, 2 × limit) How many local sites one license may activate.
gmlk_ip_budget int $budget, string $route 600 Requests per address per route per window.
gmlk_key_budget int $budget, string $route, int $covered max(30, 3 × covered) Requests per key per route per window.
gmlk_rate_limit array [max, window], string $bucket per bucket Low-level override of any one bucket.
gmlk_trusted_proxies array $proxies none Proxy addresses whose CF-Connecting-IP / X-Forwarded-For may be trusted.
gmlk_sync_max_products int $max 250 Products one /sync call may ask about.
gmlk_modules array $modules — The module list the plugin boots.
gmlk_license_api_url, gmlk_update_cache_ttl This plugin's own gatemi.com licence and update check.

The free edition applies no filters.

WooCommerce hooks used (both editions)

woocommerce_order_status_completed (issue keys), woocommerce_checkout_order_processed and woocommerce_store_api_checkout_order_processed (hold pool keys, recorded in order meta _gmlk_pool_reserved), woocommerce_order_status_cancelled and woocommerce_order_status_failed (give held keys back), woocommerce_order_refunded (revoke on a full refund, or give held keys back when nothing was issued yet), woocommerce_email_after_order_table, woocommerce_order_details_after_order_table, woocommerce_admin_order_data_after_order_details (show keys), woocommerce_product_is_in_stock, woocommerce_product_variation_is_in_stock, woocommerce_product_get_stock_quantity and woocommerce_product_variation_get_stock_quantity at priority 20 (pool as stock), and the gmlk-licenses My Account endpoint.

Data

Tables (identical in both editions): {prefix}gmlk_licenses (UNIQUE key_hash, UNIQUE dedupe_key), {prefix}gmlk_activations (UNIQUE (license_id, site_url)), {prefix}gmlk_pool_keys (UNIQUE key_hash), {prefix}gmlk_releases (UNIQUE (product_slug, version)) and {prefix}gmlk_events. The free edition creates all five and writes only the first and the pool.

Options: gmlk_settings (manage_url, delete_data, and the generated cipher_secret and signing_secret), gmlk_schema_version, gmlk_flush_rewrites; full edition gmlk_license. Rate-limit state lives in transients prefixed gmlk_rl_.

Product meta: _gmlk_enabled, _gmlk_key_source, _gmlk_product_slugs, _gmlk_activation_limit, _gmlk_term_days. Order meta: _gmlk_license_ids (license ids, never keys).

Dedupe key: order:{order_id}:item:{item_id}:unit:{n}.

CSS classes

Delivery: .gmlk-keys, .gmlk-keys-title, .gmlk-keys-list, .gmlk-keys-item, .gmlk-keys-label, .gmlk-keys-key, and on the admin order screen .gmlk-keys-status--{status}. My Account: .gmlk-account, .gmlk-account-license, .gmlk-account-key, .gmlk-account-status; full edition also .gmlk-account-reset, .gmlk-account-sites, .gmlk-account-downloads, .gmlk-account-action.

Shopping Cart
Scroll to Top