API ReferenceCode Examples

Code Examples

Integrate the License API into your application using standard HTTP requests. No SDK required — the API uses simple REST endpoints with JSON responses.

JavaScript / TypeScript

Verify a License

const BASE_URL = 'https://verify.web3.market/api/license';
 
async function verifyLicense(licenseKey, domain) {
  const res = await fetch(
    `${BASE_URL}/verify?license_key=${licenseKey}&domain=${domain}`
  );
  const data = await res.json();
  return data.valid === true;
}
 
// Usage
const isValid = await verifyLicense('LIC-XXXX-XXXX-XXXX-XXXX', 'myapp.com');
if (!isValid) {
  // Handle invalid license
}

Activate a Domain

async function activateDomain(licenseKey, domain) {
  const res = await fetch(`${BASE_URL}/activate`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ license_key: licenseKey, domain }),
  });
  return res.json();
}

Deactivate a Domain

async function deactivateDomain(licenseKey, domain) {
  const res = await fetch(`${BASE_URL}/deactivate`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ license_key: licenseKey, domain }),
  });
  return res.json();
}

Check License Status

async function getLicenseStatus(licenseKey) {
  const res = await fetch(`${BASE_URL}/status?license_key=${licenseKey}`);
  return res.json();
}

Python

import requests
 
BASE_URL = "https://verify.web3.market/api/license"
 
def verify_license(license_key: str, domain: str) -> bool:
    res = requests.get(f"{BASE_URL}/verify", params={
        "license_key": license_key,
        "domain": domain,
    })
    return res.json().get("valid", False)
 
def activate_domain(license_key: str, domain: str) -> dict:
    res = requests.post(f"{BASE_URL}/activate", json={
        "license_key": license_key,
        "domain": domain,
    })
    return res.json()
 
def deactivate_domain(license_key: str, domain: str) -> dict:
    res = requests.post(f"{BASE_URL}/deactivate", json={
        "license_key": license_key,
        "domain": domain,
    })
    return res.json()
 
def get_status(license_key: str) -> dict:
    res = requests.get(f"{BASE_URL}/status", params={
        "license_key": license_key,
    })
    return res.json()

PHP

<?php
 
$baseUrl = 'https://verify.web3.market/api/license';
 
function verifyLicense(string $licenseKey, string $domain): bool {
    $url = "$GLOBALS[baseUrl]/verify?" . http_build_query([
        'license_key' => $licenseKey,
        'domain' => $domain,
    ]);
    $response = json_decode(file_get_contents($url), true);
    return $response['valid'] ?? false;
}
 
function activateDomain(string $licenseKey, string $domain): array {
    $ch = curl_init("$GLOBALS[baseUrl]/activate");
    curl_setopt_array($ch, [
        CURLOPT_POST => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
        CURLOPT_POSTFIELDS => json_encode([
            'license_key' => $licenseKey,
            'domain' => $domain,
        ]),
    ]);
    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}

cURL

# Verify a license
curl "https://verify.web3.market/api/license/verify?license_key=LIC-XXXX-XXXX-XXXX-XXXX&domain=myapp.com"
 
# Activate a domain
curl -X POST https://verify.web3.market/api/license/activate \
  -H "Content-Type: application/json" \
  -d '{"license_key":"LIC-XXXX-XXXX-XXXX-XXXX","domain":"myapp.com"}'
 
# Deactivate a domain
curl -X POST https://verify.web3.market/api/license/deactivate \
  -H "Content-Type: application/json" \
  -d '{"license_key":"LIC-XXXX-XXXX-XXXX-XXXX","domain":"myapp.com"}'
 
# Check license status
curl "https://verify.web3.market/api/license/status?license_key=LIC-XXXX-XXXX-XXXX-XXXX"

Response Examples

Successful Verification

{
  "valid": true,
  "license": {
    "expires_at": null
  }
}

Failed Verification

{
  "valid": false,
  "error": "invalid_domain",
  "message": "Domain is not authorized for this license."
}

License Status

{
  "success": true,
  "license": {
    "key": "LIC-XXXX-XXXX-XXXX-XXXX",
    "status": "active",
    "product": {
      "id": 1,
      "title": "My dApp",
      "slug": "my-dapp"
    },
    "domain": {
      "domain": "myapp.com",
      "activated_at": "2026-02-21T10:00:00.000000Z",
      "verification_count": 42,
      "last_verified_at": "2026-02-21T15:30:00.000000Z"
    },
    "expires_at": null,
    "created_at": "2026-02-20T08:00:00.000000Z"
  }
}