Note: No API token is needed. The credential is the purchase code PLUS the activation_token this site received from activate β a purchase code and a domain alone cannot fetch your files.
Tip: The PHP SDK & WordPress updater do all of this for you β signature, nonce, token storage and checksum included.
Warning: Answers are signed exactly like the other licence endpoints. Verify the signature and the nonce first, then compare the downloaded file with package.sha256 before you install it. See Signatures & fields.
#Endpoints
/api/license/update/api/license/download/{ticket}| Parameter | Type | Description |
|---|---|---|
purchase_code required |
string | the buyer's purchase code |
item_id required |
integer | the ID of YOUR item, hard-coded in your product |
domain required |
string | the activated domain |
activation_token required |
string | the token returned when this site was activated |
current_version |
string | the version that is running now, e.g. 1.2.0 β used to decide update_available |
nonce required |
string | 16β128 random characters, new for every call |
#Example
curl -X POST https://sellmycode.net/api/license/update \
-H "Content-Type: application/json" \
-d '{"purchase_code":"β¦","item_id":12345678,"domain":"shop.example.com","activation_token":"β¦","current_version":"1.2.0","nonce":"9f3c1d7e0a2b4c6d8e0f"}'
$nonce = bin2hex(random_bytes(16));
$res = json_decode(file_get_contents('https://sellmycode.net/api/license/update', false, stream_context_create(['http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\n",
'content' => json_encode([
'purchase_code' => $code, 'item_id' => 12345678, 'domain' => $domain,
'activation_token' => $token, 'current_version' => MY_VERSION, 'nonce' => $nonce,
]),
]])), true);
$keys = ['k1' => '5Uk3p1+J0PXzJkwS4wVFvTN9GcHpJzX5ClRI8zlI0yQ=', 'k2' => 'erOiojOdS5F/IfhPMO9gvjAvuEPVapIadTDaWU0z83o=']; // kid => key: active + standby
$publicKey = base64_decode($keys[$res['kid'] ?? ''] ?? '');
if (strlen($publicKey) !== 32 || !sodium_crypto_sign_verify_detached(base64_decode($res['signature']), $res['payload'], $publicKey)) {
exit('Untrusted answer');
}
$answer = json_decode($res['payload'], true);
if ($answer['nonce'] !== $nonce) {
exit('Replayed answer');
}
if ((int) $answer['item']['id'] !== 12345678 || $answer['domain'] !== $domain) {
exit('Answer for another item or site'); // $domain as stored: lower case, no www.
}
if ($answer['code'] === 'update_available' && $answer['package']['integrity'] === 'sha256') {
$zip = file_get_contents($answer['package']['download_url']);
if (!hash_equals($answer['package']['sha256'], hash('sha256', $zip))) {
exit('Package checksum mismatch');
}
file_put_contents(__DIR__ . '/update.zip', $zip);
}
{
"status": "success",
"code": "update_available",
"domain": "shop.example.com",
"item": { "id": 12345678, "name": "My Plugin", "version": "1.3.0", "url": "https://sellmycode.net/items/my-plugin/12345678" },
"current_version": "1.2.0",
"latest_version": "1.3.0",
"update_available": true,
"changelog": { "version": "1.3.0", "body": "Fixed β¦", "released_at": "2026-10-20T08:00:00+00:00" },
"package": {
"download_url": "https://sellmycode.net/api/license/download/Qx7β¦",
"expires_at": "2026-10-27T03:10:00+00:00",
"max_uses": 3,
"sha256": "4f9cβ¦",
"size": 1843200,
"integrity": "sha256"
},
"updates": { "active": true, "until": "2027-04-27T00:00:00+00:00", "lifetime": false, "renew_url": null },
"nonce": "9f3c1d7e0a2b4c6d8e0f",
"issued_at": "2026-10-27T03:00:00+00:00"
}
#Answer codes
code |
Meaning | package |
|---|---|---|
update_available |
current_version is older than latest_version |
download link |
latest |
you sent no current_version; here is the latest package |
download link |
up_to_date |
the site already runs the latest version | null |
update_window_expired |
the buyer's update period has ended β show updates.renew_url |
null |
no_package |
the item has no downloadable file right now | null |
Every answer above is "status": "success" with HTTP 200 β only update_available and latest carry a package. changelog is the latest entry only, as plain text (HTML removed, at most 4,000 characters), or null. Check item.id and domain against your own values after the signature and the nonce.
Errors use the codes of the other licence endpoints (invalid_code, not_activated, site_blocked, license_blocked, rate_limited) plus invalid_activation_token and item_removed.
#The download link
download_urllives 10 minutes and works 3 times, so a broken download can be resumed. After that, callupdateagain for a fresh link.- Rights are checked again when the link is used: a refund, a hold, a blocked licence, a paused site or an expired update period after the link was issued all stop the download.
- The link redirects to a short-lived storage URL. Follow redirects.
#Package integrity
integrity |
What to do |
|---|---|
sha256 |
compare sha256 (and size) with the downloaded file before installing |
pending |
the checksum of a newly published file is still being computed β try again in a few minutes, or install without it at your own risk |
unverified |
the item's file is hosted outside SellMyCode and has no checksum; we recommend not installing automatically |
Tip: Upload packages through the upload API or the item form so they are stored on SellMyCode β those always get a checksum.
#Limits
- 30 calls per licence and domain per 10 minutes (shared with the other licence endpoints).
- 10 package downloads per licence per hour.
- Invalid links count towards the same failed-lookup budget as invalid purchase codes.
Developers