from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Get entitlements summary for a subscription
subscription_id = "625f5cee-259b-4994-b7eb-416b9e551f2c"
response = client.subscriptions.get_entitlements_summary(subscription_id)
for entitlement in response['data']:
print(f"Feature: {entitlement['feature_name']} ({entitlement['feature_key']})")
print(f" Usage model: {entitlement['usage_model']}")
print(f" Purchased qty: {entitlement['purchased_qty']}")
print(f" Billing: {entitlement['billing_interval']}")
print(f" Active: {entitlement['active']}")
# Check if this entitlement resulted from a plan transition
if entitlement.get('metadata', {}).get('policy'):
policy = entitlement['metadata']['policy']
print(f" Transition: {policy['change_type']} ({policy['timing']})"){
"statusCode": 200,
"message": "Entitlements summary fetched successfully",
"meta": {},
"data": [
{
"id": "120007eb-c6f7-4439-b7a9-75f09d60079e",
"subscription_id": "625f5cee-259b-4994-b7eb-416b9e551f2c",
"customer_id": "fa545755-be20-4d1b-85d0-a2265dd52c56",
"tenant_id": "90321ce5-5d33-4f6d-a4eb-11660e2b6a46",
"customer_key": "cust-mljp3ra6ffjm",
"active": true,
"subscription_item_id": "b1d50e4f-85db-49d0-9d86-3b02e5f69414",
"purchased_qty": 2,
"billing_interval": "monthly",
"feature_key": "feature_skills_audit",
"soft_limit_enabled": false,
"included_allowance": null,
"included_allowance_reset_interval": "none",
"included_allowance_reset_anchor": "subscription_start",
"usage_limit": null,
"usage_limit_reset_interval": "none",
"usage_limit_reset_anchor": "subscription_start",
"max_carryover_amount": null,
"carryover_action": "does_not_expire",
"carryover_enabled": false,
"event_names": null,
"aggregation_method": "sum",
"feature_type": "metered",
"price_type": "in_advance",
"entitlement_id": "20910dfa-4a88-451c-9b85-2ed8ba937e97",
"prepaid": false,
"prepaid_credit_system_id": null,
"usage_model": "per_use",
"credit_cost": null,
"created_at": "2026-02-13T13:01:29.875Z",
"updated_at": "2026-02-13T13:01:29.875Z",
"billing_interval_value": 1,
"credit_source_id": null,
"carryover_expiry_interval": null,
"carryover_expiry_value": null,
"metadata": {
"policy": {
"id": null,
"name": "Metrifox Default Same Interval Plan Downgrade Policy",
"timing": "immediate",
"tenant_id": null,
"created_at": null,
"updated_at": null,
"change_type": "downgrade",
"time_policy": {
"charge_strategy": "partial_charge",
"unused_time_strategy": "partial_credit"
},
"cycle_strategy": "keep_existing_cycle",
"consumable_policy": {
"charge_strategy": "issue_zero_credit_apply_full_charge",
"provision_strategy": "allocate_full_quantity",
"unused_quantity_handling": "roll_over",
"unprovisioned_quantity_handling": "do_nothing"
},
"interval_strategy": "same_interval"
},
"billing_end_date": "2026-03-12T16:55:21.847Z",
"transitioning_subscription_id": "c541c94a-6a02-4bc0-bf8b-1a5a4245e1d8"
},
"feature_name": "Skills Audit"
},
{
"id": "2e7f7fd8-c723-4d7c-98e5-b8239ab5226e",
"subscription_id": "625f5cee-259b-4994-b7eb-416b9e551f2c",
"customer_id": "fa545755-be20-4d1b-85d0-a2265dd52c56",
"tenant_id": "90321ce5-5d33-4f6d-a4eb-11660e2b6a46",
"customer_key": "cust-mljp3ra6ffjm",
"active": true,
"subscription_item_id": "7ab84a13-f11d-4f03-9936-c5ece50bf40a",
"purchased_qty": 3,
"billing_interval": "monthly",
"feature_key": "feature_seats",
"soft_limit_enabled": false,
"included_allowance": null,
"included_allowance_reset_interval": "none",
"included_allowance_reset_anchor": "subscription_start",
"usage_limit": null,
"usage_limit_reset_interval": "none",
"usage_limit_reset_anchor": "subscription_start",
"max_carryover_amount": null,
"carryover_action": "does_not_expire",
"carryover_enabled": false,
"event_names": null,
"aggregation_method": "sum",
"feature_type": "metered",
"price_type": "in_advance",
"entitlement_id": "262bd36c-eef8-4981-8c58-52c952d3f42e",
"prepaid": false,
"prepaid_credit_system_id": null,
"usage_model": "persistent_use",
"credit_cost": null,
"created_at": "2026-02-13T13:01:29.715Z",
"updated_at": "2026-02-13T13:01:29.715Z",
"billing_interval_value": 1,
"credit_source_id": null,
"carryover_expiry_interval": null,
"carryover_expiry_value": null,
"metadata": {
"policy": {
"id": null,
"name": "Metrifox Default Same Interval Plan Downgrade Policy",
"timing": "immediate",
"tenant_id": null,
"created_at": null,
"updated_at": null,
"change_type": "downgrade",
"time_policy": {
"charge_strategy": "partial_charge",
"unused_time_strategy": "partial_credit"
},
"cycle_strategy": "keep_existing_cycle",
"consumable_policy": {
"charge_strategy": "issue_zero_credit_apply_full_charge",
"provision_strategy": "allocate_full_quantity",
"unused_quantity_handling": "roll_over",
"unprovisioned_quantity_handling": "do_nothing"
},
"interval_strategy": "same_interval"
},
"billing_end_date": "2026-03-12T16:55:21.847Z",
"transitioning_subscription_id": "c541c94a-6a02-4bc0-bf8b-1a5a4245e1d8"
},
"feature_name": "Seats"
}
],
"errors": {}
}Retrieve the full entitlements summary for a subscription, including configuration, allowances, carryover settings, and transition policy details
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Get entitlements summary for a subscription
subscription_id = "625f5cee-259b-4994-b7eb-416b9e551f2c"
response = client.subscriptions.get_entitlements_summary(subscription_id)
for entitlement in response['data']:
print(f"Feature: {entitlement['feature_name']} ({entitlement['feature_key']})")
print(f" Usage model: {entitlement['usage_model']}")
print(f" Purchased qty: {entitlement['purchased_qty']}")
print(f" Billing: {entitlement['billing_interval']}")
print(f" Active: {entitlement['active']}")
# Check if this entitlement resulted from a plan transition
if entitlement.get('metadata', {}).get('policy'):
policy = entitlement['metadata']['policy']
print(f" Transition: {policy['change_type']} ({policy['timing']})"){
"statusCode": 200,
"message": "Entitlements summary fetched successfully",
"meta": {},
"data": [
{
"id": "120007eb-c6f7-4439-b7a9-75f09d60079e",
"subscription_id": "625f5cee-259b-4994-b7eb-416b9e551f2c",
"customer_id": "fa545755-be20-4d1b-85d0-a2265dd52c56",
"tenant_id": "90321ce5-5d33-4f6d-a4eb-11660e2b6a46",
"customer_key": "cust-mljp3ra6ffjm",
"active": true,
"subscription_item_id": "b1d50e4f-85db-49d0-9d86-3b02e5f69414",
"purchased_qty": 2,
"billing_interval": "monthly",
"feature_key": "feature_skills_audit",
"soft_limit_enabled": false,
"included_allowance": null,
"included_allowance_reset_interval": "none",
"included_allowance_reset_anchor": "subscription_start",
"usage_limit": null,
"usage_limit_reset_interval": "none",
"usage_limit_reset_anchor": "subscription_start",
"max_carryover_amount": null,
"carryover_action": "does_not_expire",
"carryover_enabled": false,
"event_names": null,
"aggregation_method": "sum",
"feature_type": "metered",
"price_type": "in_advance",
"entitlement_id": "20910dfa-4a88-451c-9b85-2ed8ba937e97",
"prepaid": false,
"prepaid_credit_system_id": null,
"usage_model": "per_use",
"credit_cost": null,
"created_at": "2026-02-13T13:01:29.875Z",
"updated_at": "2026-02-13T13:01:29.875Z",
"billing_interval_value": 1,
"credit_source_id": null,
"carryover_expiry_interval": null,
"carryover_expiry_value": null,
"metadata": {
"policy": {
"id": null,
"name": "Metrifox Default Same Interval Plan Downgrade Policy",
"timing": "immediate",
"tenant_id": null,
"created_at": null,
"updated_at": null,
"change_type": "downgrade",
"time_policy": {
"charge_strategy": "partial_charge",
"unused_time_strategy": "partial_credit"
},
"cycle_strategy": "keep_existing_cycle",
"consumable_policy": {
"charge_strategy": "issue_zero_credit_apply_full_charge",
"provision_strategy": "allocate_full_quantity",
"unused_quantity_handling": "roll_over",
"unprovisioned_quantity_handling": "do_nothing"
},
"interval_strategy": "same_interval"
},
"billing_end_date": "2026-03-12T16:55:21.847Z",
"transitioning_subscription_id": "c541c94a-6a02-4bc0-bf8b-1a5a4245e1d8"
},
"feature_name": "Skills Audit"
},
{
"id": "2e7f7fd8-c723-4d7c-98e5-b8239ab5226e",
"subscription_id": "625f5cee-259b-4994-b7eb-416b9e551f2c",
"customer_id": "fa545755-be20-4d1b-85d0-a2265dd52c56",
"tenant_id": "90321ce5-5d33-4f6d-a4eb-11660e2b6a46",
"customer_key": "cust-mljp3ra6ffjm",
"active": true,
"subscription_item_id": "7ab84a13-f11d-4f03-9936-c5ece50bf40a",
"purchased_qty": 3,
"billing_interval": "monthly",
"feature_key": "feature_seats",
"soft_limit_enabled": false,
"included_allowance": null,
"included_allowance_reset_interval": "none",
"included_allowance_reset_anchor": "subscription_start",
"usage_limit": null,
"usage_limit_reset_interval": "none",
"usage_limit_reset_anchor": "subscription_start",
"max_carryover_amount": null,
"carryover_action": "does_not_expire",
"carryover_enabled": false,
"event_names": null,
"aggregation_method": "sum",
"feature_type": "metered",
"price_type": "in_advance",
"entitlement_id": "262bd36c-eef8-4981-8c58-52c952d3f42e",
"prepaid": false,
"prepaid_credit_system_id": null,
"usage_model": "persistent_use",
"credit_cost": null,
"created_at": "2026-02-13T13:01:29.715Z",
"updated_at": "2026-02-13T13:01:29.715Z",
"billing_interval_value": 1,
"credit_source_id": null,
"carryover_expiry_interval": null,
"carryover_expiry_value": null,
"metadata": {
"policy": {
"id": null,
"name": "Metrifox Default Same Interval Plan Downgrade Policy",
"timing": "immediate",
"tenant_id": null,
"created_at": null,
"updated_at": null,
"change_type": "downgrade",
"time_policy": {
"charge_strategy": "partial_charge",
"unused_time_strategy": "partial_credit"
},
"cycle_strategy": "keep_existing_cycle",
"consumable_policy": {
"charge_strategy": "issue_zero_credit_apply_full_charge",
"provision_strategy": "allocate_full_quantity",
"unused_quantity_handling": "roll_over",
"unprovisioned_quantity_handling": "do_nothing"
},
"interval_strategy": "same_interval"
},
"billing_end_date": "2026-03-12T16:55:21.847Z",
"transitioning_subscription_id": "c541c94a-6a02-4bc0-bf8b-1a5a4245e1d8"
},
"feature_name": "Seats"
}
],
"errors": {}
}metadata.policy field is only present when the entitlement resulted from a plan transition (upgrade or downgrade). For entitlements that were part of the original subscription, this field will not be included.The unique subscription identifier (UUID)