API documentation

Every item sold here comes with a purchase code. Your shipped script exchanges it for a signed token and enforces the licence itself. Call the API directly from any language, or drop in the PHP SDK and let it do the work.

Base URL https://ourcodemarket.com/api/v1 Format JSON Auth API key header
Quick check
curl https://ourcodemarket.com/api/v1/marketplace/categories

How it works

  1. Activate. The script sends the purchase code and its domain. We return a signed token holding what the licence grants.
  2. Verify. On the interval you set, the script re-checks and a fresh token comes back.
  3. Enforce. The token is signed with our private key and verified inside your script against the public key, so a normal check needs no network call at all.
Why the token matters. Because it is verified offline, a buyer whose server briefly loses connectivity keeps working. Only a revoked licence, or one past its grace window, stops.

Authentication

Two kinds of key, from your dashboard. They are not interchangeable.

PUB

Publishable dmz_pk_…

Safe to ship inside the script you sell. It only identifies you, and can do nothing beyond activating and verifying licences.

SEC

Secret dmz_sk_…

For calls from your own server. It can read your sales and revoke licences, so it must never appear in distributed code.

Send the key in a header, never in the query string. Keys in URLs end up in server logs and browser history.
Either header works
X-Domzivo-Key: dmz_pk_your_key
# or
Authorization: Bearer dmz_pk_your_key

Quick start

Ship domzivo-license.php alongside your script and add this to your entry file:

PHP
<?php
require __DIR__ . '/domzivo-license.php';

$license = new DomzivoLicense(
    'dmz_pk_YOUR_PUBLISHABLE_KEY',   // Dashboard > API keys. Same for everything you sell.
    'YOUR_ITEM_ID'                   // The item's own page. Different for each item.
);

// Shows an activation screen if the buyer has not entered their code yet,
// and stops the script if the licence is not valid.
$license->guard();

echo "Licensed and running.";
Both values are required. Your publishable key says who you are; the item id says which of your items this is. Without the item id, a buyer of your cheapest item could use that code to unlock your most expensive one, because a single key covers everything you sell. Copy the id from the Licensing panel on the item's page rather than typing it: one wrong character and no buyer can activate.

Where the item id comes from

The id belongs to the item, so the item has to exist before there is an id to copy. That catches people out, because the id then has to go inside the zip you upload to that same item. Do it in this order and it is straightforward:

  1. Create the item and save it as a draft. A draft needs only a title, so this takes a moment. You do not need the description, price, screenshots or the zip yet.
  2. Open the Licensing panel on that item in your dashboard and press Copy. The id looks like 7c3f21a8-4d55-4e0b-9a1e-2f77b0c9d431.
  3. Paste it into your script as the second argument, next to your publishable key.
  4. Zip your script with the id already in it and upload that zip to the same item.
  5. Finish the listing and submit for review.
The id never changes. Paste it once and it keeps working through every version you release, so an update does not mean touching it again. A different item gets a different id, so do not carry one across when you duplicate a listing: a code bought for one item will not activate another, which is the whole point of it.

To switch features on or off by tier, read what the licence grants:

PHP
$status = $license->check();

if (!empty($status['features']['branding_removal'])) {
    hide_footer_credit();   // Extended buyers can white-label it.
}
Writing in something other than PHP? Every endpoint below is plain HTTP and JSON, so any language can integrate. The SDK is a convenience, not a requirement.

Errors & limits

Errors come back with the matching HTTP status and a readable message. The licensing endpoints are rate limited per IP.

CodeMeaning
400Something in the request body is missing or malformed. Activation also returns this as product_required when the request does not say which item it is for.
401The API key is missing, wrong, or revoked.
403The licence is revoked or refunded, the key is the wrong kind for this endpoint, or the purchase code belongs to a different item (wrong_product).
404No such purchase code.
409Every domain slot on the licence is already in use.
429Too many requests. Back off and retry.

Licensing API

Authenticated with your publishable key. These are the calls your shipped script makes.

POST/licenses/activate

Redeems a purchase code for a domain and returns a signed token.

Request
{
  "purchase_code": "DMZ-XXXX-XXXX-XXXX",
  "domain": "buyerdomain.com",
  "product_id": "your-item-id",
  "environment": "production"
}
Response
{
  "success": true,
  "valid": true,
  "token": "eyJhbGciOiJSUzI1NiIs...",
  "license": {
    "status": "active",
    "tier": "regular",
    "features": { "max_domains": 1 },
    "grace_until": null
  }
}

404 when the code does not exist, 403 when the licence is revoked or refunded, 409 when every domain slot is used.

POST/licenses/verify

Re-checks an activation. Send the token you already hold, or the purchase code and domain.

Request
{
  "token": "eyJhbGciOiJSUzI1NiIs...",
  "domain": "buyerdomain.com",
  "product_id": "your-item-id"
}
Response
{
  "success": true,
  "valid": true,
  "token": "eyJhbGciOiJSUzI1NiIs...",
  "license": { "status": "active", "tier": "regular" }
}

A domain that was never activated answers 200 with valid: false and status not_activated, so your script can show the activation screen rather than crash.

product_id is optional here but checked when you send it, so a code moved to a different item is caught on the next check-in. The SDK always sends it.

POST/licenses/deactivate

Releases the domain slot so the buyer can install elsewhere.

Request
{
  "purchase_code": "DMZ-XXXX-XXXX-XXXX",
  "domain": "buyerdomain.com",
  "product_id": "your-item-id"
}

Vendor API

Authenticated with your secret key. Server side only, never from distributed code.

GET/vendor-api/verify?code=

Confirms a purchase code belongs to you and is valid. The classic "verify purchase" call.

curl
curl -H "X-Domzivo-Key: dmz_sk_your_secret_key" \
  "https://ourcodemarket.com/api/v1/vendor-api/verify?code=DMZ-XXXX-XXXX-XXXX"
GET/vendor-api/licenses

Your issued licences, paginated.

GET/vendor-api/licenses/:code

One licence, with its activations.

POST/vendor-api/licenses/:code/revoke

Revokes a licence. The buyer keeps working until their grace window closes.

GET/vendor-api/sales

Your sales, with the commission split on every line.

Statuses

StatusMeaningShould the script run?
activeEverything is in order.Yes
not_activatedThis domain has no activation yet.No, show the activation screen
not_foundThe purchase code does not exist.No
suspendedTemporarily paused by you or an admin.Until grace ends
revokedPulled, usually a refund or abuse.Until grace ends
refundedThe buyer got their money back.No
invalid_tokenThe token was tampered with or has expired.No, re-activate

Offline & grace

Two values you set per product, on the item form in your dashboard:

  • Check-in interval is how often the script revalidates. Between check-ins it verifies the token offline, with no network call.
  • Offline grace is how long it keeps working when our API is unreachable, and how long a buyer keeps working after a licence is revoked.

Sensible defaults are a 48 hour interval with 10 days of grace. A short grace window is harsher on buyers with flaky hosting; a long one delays enforcement after a refund.

PHP SDK methods

MethodWhat it does
activate($code, $domain)Redeems a purchase code and caches the token.
check()Returns the current status, re-validating over the network only when the token is due.
isValid()A plain boolean, for your own branching.
guard()Activation screen plus enforcement, in one line.
deactivate()Frees the domain slot so the buyer can move the script.

Ready to sell?

Create your keys, upload your item, and the licensing is handled for you.

Go to API keys