SellMyCode Developers
Licences

Licence updates

Let your product update itself with nothing but its licence. The installation asks whether a newer version exists; if the buyer's update period is running, the answer carries a short-lived download link and the SHA-256 of the package.

ℹ️

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

POST/api/license/update
GET/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"}'

#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.

  • download_url lives 10 minutes and works 3 times, so a broken download can be resumed. After that, call update again 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.
Was this page helpful?