Skip to content

Entitlement Endpoints ​

Entitlements are the central aggregator of middag-account. Every product, service, environment, and license links back to an entitlement via a unique code. Inspired by Atlassian's SEN model but expanded with typed classes and lifecycle management.

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

Endpoints ​

MethodEndpointAuthScopeDescription
GET/entitlementsJWT + OrgentitlementsList organization entitlements
GET/entitlements/{id}JWT + OrgentitlementsEntitlement details
GET/entitlements/code/:code``JWT + OrgentitlementsLookup by code (e.g., PLG-2026040142)
GET/entitlements/{id}/ordersJWT + OrgentitlementsLinked orders
GET/entitlements/{id}/licensesJWT + OrgentitlementsLinked licenses
GET/entitlements/{id}/contractsJWT + OrgentitlementsLinked contracts

Code Format ​

Entitlement codes follow the pattern {CLASS}-{YEAR}{MONTH}{SEQ:4d}.

Classes:

ClassTypeDescription
PLGPluginSoftware license entitlement
ENVEnvironmentManaged hosting environment
SVCServiceProfessional service / project
ORDOrderStandalone order entitlement
AFLAffiliateAffiliate program entitlement
EDUEducationTraining / academy entitlement

Example: PLG-2026040001, ENV-2026050023, SVC-2026030005

GET /entitlements ​

List entitlements for the current organization.

Headers: X-Middag-Organization: {org_id}

Query filters:

ParameterTypeValues
classstringPLG, ENV, SVC, ORD, AFL, EDU
statusstringactive, suspended, expired, cancelled
searchstringSearch by code or product name

Response (200):

json
{
    "success": true,
    "data": [
        {
            "id": 101,
            "code": "PLG-2026040001",
            "class": "PLG",
            "product_name": "Campus EAD",
            "status": "active",
            "organization_id": 42,
            "company": "middag_br",
            "expires_at": "2027-04-01T00:00:00Z",
            "auto_created": true,
            "created_at": "2026-04-01T10:00:00Z",
            "updated_at": "2026-04-01T10:00:00Z"
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "pages": 1
    }
}

GET /entitlements/:id ​

Full entitlement details including metadata.

Response fields: id, code, class, product_name, product_description, status, organization_id, company, expires_at, quote_id, auto_created, metadata, created_at, updated_at.

GET /entitlements/code/:code ​

Lookup an entitlement by its unique code. Returns the same schema as GET /entitlements/{id}.

GET /entitlements/code/PLG-2026040001

GET /entitlements/:id/orders ​

List WooCommerce orders linked to this entitlement.

GET /entitlements/:id/licenses ​

List software licenses linked to this entitlement. Only relevant for PLG-class entitlements.

GET /entitlements/:id/contracts ​

List contracts linked to this entitlement.

Status Values ​

StatusDescription
activeEntitlement is valid and operational
suspendedTemporarily paused (e.g., payment issue)
expiredPast expiration date, not renewed
cancelledPermanently cancelled (terminal state)

See Lifecycle States for the full state machine.