Skip to content

License Endpoints

Licenses represent software license keys linked to PLG-class entitlements. The License domain acts as an adapter over WC Software License (when present) or uses built-in license management.

Base path: /wp-json/middag-account/v1/licenses

Endpoints

MethodEndpointAuthScopeDescription
GET/licensesJWT + OrglicensesList licenses
GET/licenses/{id}JWT + OrglicensesLicense details
POST/licenses/{id}/activateJWT + OrglicensesActivate license on domain
POST/licenses/{id}/deactivateJWT + OrglicensesDeactivate from domain

GET /licenses

List all licenses for the current organization.

Headers: X-Middag-Organization: {org_id}

Response (200):

json
{
    "success": true,
    "data": [
        {
            "id": 601,
            "license_key": "XXXX-XXXX-XXXX-XXXX",
            "product_name": "Campus EAD Plugin",
            "status": "active",
            "entitlement_id": 101,
            "entitlement_code": "PLG-2026040001",
            "activations_limit": 3,
            "activations_count": 1,
            "activated_domains": [
                "example.com"
            ],
            "expires_at": "2027-04-01T00:00:00Z",
            "created_at": "2026-04-01T10:00:00Z"
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "pages": 1
    }
}

GET /licenses/:id

Full license details including activation history and linked entitlement.

Response fields: id, license_key, product_name, status, entitlement_id, entitlement_code, activations_limit, activations_count, activated_domains[], expires_at, created_at, updated_at.

POST /licenses/:id/activate

Activate a license on a specific domain. Fails if the activation limit is reached.

Request:

json
{
    "domain": "mysite.example.com"
}

Response (200):

json
{
    "success": true,
    "data": {
        "license_id": 601,
        "domain": "mysite.example.com",
        "activations_count": 2,
        "activations_limit": 3
    },
    "message": "License activated"
}

Returns 409 CONFLICT if the activation limit has been reached.

POST /licenses/:id/deactivate

Deactivate a license from a specific domain, freeing an activation slot.

Request:

json
{
    "domain": "mysite.example.com"
}

Response (200):

json
{
    "success": true,
    "data": {
        "license_id": 601,
        "domain": "mysite.example.com",
        "activations_count": 1,
        "activations_limit": 3
    },
    "message": "License deactivated"
}