Activate or renew an add-on after a shop purchase or subscription renewal (called by the NethShop webhook). The system is addressed by its key; the entitlement accepts the canonical catalog id or the legacy alias.
Idempotent upsert: an existing (system, entitlement, scope) grant is
renewed in place (new expiry, revocation cleared), so webhook retries
are safe. The grant is recorded with source: shop.
Requires the manage:entitlements permission — held by the
Backoffice, Admin and Super Admin user roles, or an owner API key.
Body
Required
-
Key of the system to activate the add-on on
-
Canonical catalog id or legacy alias of the add-on
-
Application instance to narrow the grant to (only for scoped catalog items)
-
Expiry of the grant. Null/omitted = perpetual.
-
Free-form reference to the originating record (e.g. shop subscription id)
-
Email of the WordPress customer that owns the order (server-to-server, trusted). Resolved to a my user to store the
purchased_byaudit snapshot; an address matching no my user is kept raw. -
Shop variation (tier) of the purchased product line. Display metadata only: the add-on↔product mapping stays on the parent product and /auth enforcement ignores it. Refreshed by activate, so tier upgrades/downgrades follow the renewals. Omitted for manual grants and simple (non-variable) products.
Responses
-
Entitlement activated successfully
-
Unknown entitlement, scope not supported by the catalog item, or system-type mismatch ("this entitlement applies to nsec systems only")
-
Unauthorized - invalid or missing token
-
Forbidden - insufficient permissions
-
System not found for this key
-
Internal server error
curl \
--request POST 'https://api.your-domain.com/api/entitlements/activate' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"system_key":"NETH-F5D2-5E69-A174-45A9-B1AB-2BB9-03F5-F1B4","entitlement":"nsec-blacklist","scope":"nethvoice1","valid_until":"2027-07-01T10:00:00Z","source_ref":"sub_12345","buyer_email":"mario.rossi@example.com","variant":{"id":245,"sku":"ATS-15","label":"1-15 device"}}'
{
"system_key": "NETH-F5D2-5E69-A174-45A9-B1AB-2BB9-03F5-F1B4",
"entitlement": "nsec-blacklist",
"scope": "nethvoice1",
"valid_until": "2027-07-01T10:00:00Z",
"source_ref": "sub_12345",
"buyer_email": "mario.rossi@example.com",
"variant": {
"id": 245,
"sku": "ATS-15",
"label": "1-15 device"
}
}
{
"code": 200,
"message": "entitlement activated successfully",
"data": {
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"system_id": "550e8400-e29b-41d4-a716-446655440000",
"entitlement": "nsec-blacklist",
"scope": "nethvoice1",
"source": "manual",
"source_ref": "sub_12345",
"valid_from": "2026-07-01T10:00:00Z",
"valid_until": "2027-07-01T10:00:00Z",
"revoked_at": "2026-05-04T09:42:00Z",
"revoked_source": "shop",
"active": true,
"pending_ref": "wc-order-83164",
"pending_since": "2026-07-15T18:00:00Z",
"status": "active",
"created_by": {
"user_id": "53h5zxpwu4vc",
"user_name": "Edoardo Super",
"organization_id": "lbswt1rxdhbz",
"organization_name": "Nethesis Italia",
"channel": "shop"
},
"purchased_by": {
"logto_id": "53h5zxpwu4vc",
"name": "Mario Rossi",
"email": "mario.rossi@example.com",
"organization_id": "akkbs6x2wo82",
"organization_name": "ACME S.r.l.",
"org_role": "reseller",
"user_roles": [
"Admin"
],
"out_of_scope": true
},
"variant": {
"id": 245,
"sku": "ATS-15",
"label": "1-15 device"
},
"renewal_count": 3,
"created_at": "2026-07-01T10:00:00Z",
"updated_at": "2026-07-01T10:00:00Z"
}
}
{
"code": 400,
"message": "validation failed",
"data": {
"type": "validation_error",
"errors": [
{
"key": "username",
"message": "required",
"value": "string"
}
]
}
}
{
"code": 401,
"message": "invalid token",
"data": {}
}
{
"code": 403,
"message": "insufficient permissions",
"data": {}
}
{
"code": 400,
"message": "validation failed",
"data": {
"type": "validation_error",
"errors": [
{
"key": "username",
"message": "required",
"value": "string"
}
]
}
}
{
"code": 500,
"message": "internal server error",
"data": {}
}