# Provided a customer email:
# Get the subscriptions this customer is subscribed to.
# Note, the user <-> subscription_id relationship is cachable as
# the subscription_id will never change, even after the
# subscription has been canceled.
subscriptions = requests.get(
f"https://api.ironplans.com/subscriptions/v1?customer_email={email}",
headers={"Authorization": "Bearer my-private-token"}
# Determine which subscription/team to report usage for.
# Report the customer has consumed 1 `requests` unit:
data = {"op": "inc", "slug": "requests", "value": 1}
f"https://api.ironplans.com/subscriptions/v1/{subscription['id']}/report/",
headers={"Authorization": "Bearer my-private-token"}