from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Get customer details
customer_key = "ac85f76a-9c20-4509-9453-daa9480a1ac6"
response = client.customers.get_details(customer_key)
print(f"Customer info: {response['data']['customer_key']}, {response['data']['primary_email']}")
print(f"Product subscriptions: {response['data']['subscriptions']}")
# Access details for each product
for product_sub in response['data']['subscriptions']:
print(f"Product: {product_sub['product_name']}")
print(f"Subscription: {product_sub['subscription']}")
print(f"Entitlements: {product_sub['entitlements']}")
print(f"Wallets: {product_sub['wallets']}"){
"statusCode": 200,
"message": "Customer Details Fetched Successfully",
"meta": {},
"data": {
"metrifox_id": "ac85f76a-9c20-4509-9453-daa9480a1ac6",
"customer_key": "DEV-TJH3UUAHA",
"customer_type": "BUSINESS",
"primary_email": "contact@example.com",
"display_name": "Example Company",
"full_name": "Example Company Inc",
"billing_email": "billing@example.com",
"billing_address": {
"line1": "123 Main St",
"line2": "Suite 100",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"currency": "USD",
"timezone": "America/Los_Angeles",
"language": "en",
"tenant_checkout_username": "example-company",
"subscriptions": [
{
"product_key": "ai-recruitment-agent",
"product_name": "AI Recruitment Agent",
"status": "active",
"subscription": {
"id": "6ba0132d-a886-4ccc-85fa-385f6d515d91",
"status": "active",
"starts_at": "2025-08-27T11:56:54.820Z",
"ends_at": null,
"renews_at": "2025-09-27T11:56:54.819Z",
"trial_end_date": null,
"post_trial_action": null,
"plan_name": "Basic Plan",
"plan_version": 1,
"default_plan_id": null,
"default_plan_name": null,
"product_name": "AI Recruitment Agent",
"product_key": "ai-recruitment-agent",
"offering_key": "standard-offering",
"currency_code": "USD",
"created_at": "2025-08-27T11:56:54.824Z",
"next_billing_date": "Sep 27, 2025",
"next_billing_amount": 1440.0208,
"current_billing_period_start": "2025-08-27T11:56:54.820Z",
"current_billing_period_end": "2025-09-27T11:56:54.820Z",
"subscription_items": [],
"upcoming_invoice": null,
"can_update_quantities": false
},
"entitlements": [
{
"id": "db10505c-55ac-4780-a59f-ddd2aee11bdb",
"name": "Candidate Sourcing",
"used_quantity": 710,
"carryover_quantity": 0,
"quota": "unlimited",
"included_usage": 10,
"reset_interval": "monthly",
"next_reset_at": "2025-09-27T00:00:00.000Z",
"feature_type": "metered"
}
],
"wallets": [
{
"id": "c6bbd894-f6fa-4614-9795-b7f24a0932c9",
"name": "Tokens",
"credit_unit_singular": "Token",
"credit_unit_plural": "Tokens",
"balance": 36,
"allocations": [],
"credit_key": "tokens"
},
{
"id": "92f6d7fc-ad24-4adb-b614-bd6d1350e02c",
"name": "Cowries",
"credit_unit_singular": "Cowrie",
"credit_unit_plural": "Cowries",
"balance": 0,
"allocations": [],
"credit_key": "cowries"
}
],
"subscriptions_history": [
{
"id": "5ba0132d-a886-4ccc-85fa-385f6d515d91",
"status": "cancelled",
"starts_at": "2025-07-01T00:00:00.000Z",
"ends_at": "2025-08-27T11:56:54.820Z",
"renews_at": null,
"trial_end_date": null,
"post_trial_action": null,
"plan_name": "Starter Plan",
"plan_version": 1,
"default_plan_id": null,
"default_plan_name": null,
"product_name": "AI Recruitment Agent",
"product_key": "ai-recruitment-agent",
"offering_key": "standard-offering",
"currency_code": "USD",
"created_at": "2025-07-01T00:00:00.000Z",
"next_billing_date": null,
"next_billing_amount": null,
"current_billing_period_start": "2025-07-27T00:00:00.000Z",
"current_billing_period_end": "2025-08-27T00:00:00.000Z",
"subscription_items": [],
"upcoming_invoice": null,
"can_update_quantities": false
}
],
"payment_method": {
"type": "card",
"brand": "visa",
"last4": "4242",
"exp_month": "12",
"exp_year": "2026",
"display_name": "Visa ending in 4242",
"bank_name": null
}
}
]
},
"errors": {}
}Retrieve the details of one customer, including their wallet balances, entitlements and subscriptions
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Get customer details
customer_key = "ac85f76a-9c20-4509-9453-daa9480a1ac6"
response = client.customers.get_details(customer_key)
print(f"Customer info: {response['data']['customer_key']}, {response['data']['primary_email']}")
print(f"Product subscriptions: {response['data']['subscriptions']}")
# Access details for each product
for product_sub in response['data']['subscriptions']:
print(f"Product: {product_sub['product_name']}")
print(f"Subscription: {product_sub['subscription']}")
print(f"Entitlements: {product_sub['entitlements']}")
print(f"Wallets: {product_sub['wallets']}"){
"statusCode": 200,
"message": "Customer Details Fetched Successfully",
"meta": {},
"data": {
"metrifox_id": "ac85f76a-9c20-4509-9453-daa9480a1ac6",
"customer_key": "DEV-TJH3UUAHA",
"customer_type": "BUSINESS",
"primary_email": "contact@example.com",
"display_name": "Example Company",
"full_name": "Example Company Inc",
"billing_email": "billing@example.com",
"billing_address": {
"line1": "123 Main St",
"line2": "Suite 100",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"currency": "USD",
"timezone": "America/Los_Angeles",
"language": "en",
"tenant_checkout_username": "example-company",
"subscriptions": [
{
"product_key": "ai-recruitment-agent",
"product_name": "AI Recruitment Agent",
"status": "active",
"subscription": {
"id": "6ba0132d-a886-4ccc-85fa-385f6d515d91",
"status": "active",
"starts_at": "2025-08-27T11:56:54.820Z",
"ends_at": null,
"renews_at": "2025-09-27T11:56:54.819Z",
"trial_end_date": null,
"post_trial_action": null,
"plan_name": "Basic Plan",
"plan_version": 1,
"default_plan_id": null,
"default_plan_name": null,
"product_name": "AI Recruitment Agent",
"product_key": "ai-recruitment-agent",
"offering_key": "standard-offering",
"currency_code": "USD",
"created_at": "2025-08-27T11:56:54.824Z",
"next_billing_date": "Sep 27, 2025",
"next_billing_amount": 1440.0208,
"current_billing_period_start": "2025-08-27T11:56:54.820Z",
"current_billing_period_end": "2025-09-27T11:56:54.820Z",
"subscription_items": [],
"upcoming_invoice": null,
"can_update_quantities": false
},
"entitlements": [
{
"id": "db10505c-55ac-4780-a59f-ddd2aee11bdb",
"name": "Candidate Sourcing",
"used_quantity": 710,
"carryover_quantity": 0,
"quota": "unlimited",
"included_usage": 10,
"reset_interval": "monthly",
"next_reset_at": "2025-09-27T00:00:00.000Z",
"feature_type": "metered"
}
],
"wallets": [
{
"id": "c6bbd894-f6fa-4614-9795-b7f24a0932c9",
"name": "Tokens",
"credit_unit_singular": "Token",
"credit_unit_plural": "Tokens",
"balance": 36,
"allocations": [],
"credit_key": "tokens"
},
{
"id": "92f6d7fc-ad24-4adb-b614-bd6d1350e02c",
"name": "Cowries",
"credit_unit_singular": "Cowrie",
"credit_unit_plural": "Cowries",
"balance": 0,
"allocations": [],
"credit_key": "cowries"
}
],
"subscriptions_history": [
{
"id": "5ba0132d-a886-4ccc-85fa-385f6d515d91",
"status": "cancelled",
"starts_at": "2025-07-01T00:00:00.000Z",
"ends_at": "2025-08-27T11:56:54.820Z",
"renews_at": null,
"trial_end_date": null,
"post_trial_action": null,
"plan_name": "Starter Plan",
"plan_version": 1,
"default_plan_id": null,
"default_plan_name": null,
"product_name": "AI Recruitment Agent",
"product_key": "ai-recruitment-agent",
"offering_key": "standard-offering",
"currency_code": "USD",
"created_at": "2025-07-01T00:00:00.000Z",
"next_billing_date": null,
"next_billing_amount": null,
"current_billing_period_start": "2025-07-27T00:00:00.000Z",
"current_billing_period_end": "2025-08-27T00:00:00.000Z",
"subscription_items": [],
"upcoming_invoice": null,
"can_update_quantities": false
}
],
"payment_method": {
"type": "card",
"brand": "visa",
"last4": "4242",
"exp_month": "12",
"exp_year": "2026",
"display_name": "Visa ending in 4242",
"bank_name": null
}
}
]
},
"errors": {}
}Metrifox customer ID (UUID)