Skip to content

Update Check

Check if a newer version of a product is available. Returns WordPress-compatible update information for the product's stable release (the version you designate as stable in the console — publishing a new version makes it stable automatically, and you can roll back to any earlier published version).

GET /v1/wp/update-check

Query Parameters

ParameterRequiredDescription
slugYesProduct slug
versionNoCurrently installed version. When omitted the full update payload is returned regardless.
license_keyNoLicense key. Required to receive the download (package) URL — but the version/changelog are returned without it (see Licensing).
siteNoThe site URL (site_url()). Used to confirm the site's activation is still active before handing out the download.

Response

json
{
  "name": "My Plugin",
  "slug": "my-plugin",
  "version": "2.0.0",
  "new_version": "2.0.0",
  "url": "https://example.com/readme",
  "package": "https://api.packedge.dev/v1/download/rel_xxx?license_key=KEY",
  "tested": "6.4",
  "requires": "5.0",
  "requires_php": "7.4",
  "icons": {
    "1x": "https://example.com/icon-128.png",
    "2x": "https://example.com/icon-256.png"
  },
  "banners": {
    "low": "https://example.com/banner-772x250.png",
    "high": "https://example.com/banner-1544x500.png"
  },
  "sections": {
    "description": "Plugin description",
    "changelog": "## 2.0.0\n- New feature"
  }
}

The tested, requires, and requires_php values come from the stable release's metadata (set per-release in the console, auto-filled from the plugin readme.txt on upload). sections.changelog is the release notes; icons and banners come from the product's logo/banner.

Licensing (the package URL)

The update payload — new_version, sections, icons, banners, etc. — is always returned, so WordPress shows that an update is available even to unlicensed sites (a nudge to activate).

The package (download) URL is included only when:

  • a valid license_key is supplied, and
  • the license is active and not expired, and
  • the site (if supplied) has not been deactivated.

Otherwise package is an empty string: WordPress still shows the update, but the download is refused until the user activates a valid license. The Download endpoint enforces the same gate, so a copied URL won't work for a deactivated site either.

Example

bash
curl "https://api.packedge.dev/v1/wp/update-check?slug=my-plugin&license_key=MYPLUGIN-XXXX-XXXX-XXXX-XXXX&version=1.0.0"

Caching

  • Product info and latest release data cached in KV for 5 minutes
  • Cache key: wp-update:{slug}

WordPress Integration

Hook into the WordPress update system:

php
add_filter('pre_set_site_transient_update_plugins', function($transient) {
    $license_key = get_option('my_plugin_license_key');
    $current_version = MY_PLUGIN_VERSION;

    $response = wp_remote_get(add_query_arg([
        'slug' => 'my-plugin',
        'license_key' => $license_key,
        'version' => $current_version,
    ], 'https://api.packedge.dev/v1/wp/update-check'));

    if (is_wp_error($response)) {
        return $transient;
    }

    $update = json_decode(wp_remote_retrieve_body($response));

    if (version_compare($current_version, $update->version, '<')) {
        $transient->response['my-plugin/my-plugin.php'] = (object) [
            'slug' => $update->slug,
            'new_version' => $update->version,
            'package' => $update->package,
            'icons' => (array) $update->icons,
        ];
    }

    return $transient;
});

See WordPress SDK for a simpler integration.