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
| Method | Endpoint | Auth | Scope | Description |
|---|---|---|---|---|
| GET | /entitlements | JWT + Org | entitlements | List organization entitlements |
| GET | /entitlements/{id} | JWT + Org | entitlements | Entitlement details |
| GET | /entitlements/code/:code`` | JWT + Org | entitlements | Lookup by code (e.g., PLG-2026040142) |
| GET | /entitlements/{id}/orders | JWT + Org | entitlements | Linked orders |
| GET | /entitlements/{id}/licenses | JWT + Org | entitlements | Linked licenses |
| GET | /entitlements/{id}/contracts | JWT + Org | entitlements | Linked contracts |
Code Format
Entitlement codes follow the pattern {CLASS}-{YEAR}{MONTH}{SEQ:4d}.
Classes:
| Class | Type | Description |
|---|---|---|
PLG | Plugin | Software license entitlement |
ENV | Environment | Managed hosting environment |
SVC | Service | Professional service / project |
ORD | Order | Standalone order entitlement |
AFL | Affiliate | Affiliate program entitlement |
EDU | Education | Training / 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:
| Parameter | Type | Values |
|---|---|---|
class | string | PLG, ENV, SVC, ORD, AFL, EDU |
status | string | active, suspended, expired, cancelled |
search | string | Search by code or product name |
Response (200):
{
"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-2026040001GET /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
| Status | Description |
|---|---|
active | Entitlement is valid and operational |
suspended | Temporarily paused (e.g., payment issue) |
expired | Past expiration date, not renewed |
cancelled | Permanently cancelled (terminal state) |
See Lifecycle States for the full state machine.