MuleSoft is the most complex enterprise gateway estate. Aforo integrates via a Custom Policy — the MuleSoft-native extension mechanism that enforces logic at the API Manager layer, completely decoupled from your Mule application code.
Policy-layer enforcement
Monetization runs in the Mule runtime policy chain — before your flow logic executes
Zero .jar modifications
No changes to Mule applications, DataWeave transformations, or connector configs
Anypoint Exchange native
Publish once to Exchange. Apply to any API via API Manager — same as any MuleSoft policy
Runtime Fabric compatible
Works on CloudHub 2.0, Runtime Fabric, and Hybrid deployments
INFO
This is the key difference from competing billing tools. Most require you to add SDK calls inside your Mule flows. Aforo sits outside the flow at the policy layer — the same layer where you apply rate limiting and OAuth validation today.
Once the policy is in Exchange, apply it to your managed APIs through API Manager:
1Open Anypoint Platform → API Manager → select your target API
2Click "Policies" tab → "Add Policy"
3Search for "Aforo Monetization" in the policy catalog
4Select the policy and click "Configure"
5Fill in the required parameters (see Step 3 below)
6Click "Apply" — the policy activates immediately on the next request
PRO TIP
To apply globally across all APIs in an environment, use the Automated Policy feature: API Manager → Automated Policies → Add → select Aforo Monetization. This mirrors the Kong "global plugin" and Apigee "Flow Hook" patterns.
Build pipelines, deployment scripts — no modifications
<5ms
MuleSoft Policy Decision
Entitlement + margin check in Mule runtime policy chain. Same performance as native rate limiting.
INFO
Monetization happens entirely at the policy layer. The Mule runtime executes the Aforo policy in the request/response chain — the same place where you run OAuth, rate limiting, and IP whitelisting today. Your application code never knows Aforo exists.
Verify the policy is active and correctly routing events:
terminal
# Check policy status via Anypoint CLI
anypoint-cli api-mgr policy list \
--environment prod \
--apiInstanceId {API_ID}
# Expected output:
# ID | Policy | Status
# 12345 | Aforo Monetization | ACTIVE
# PaperPlaneTilt a test request through the API
curl -v https://your-api.cloudhub.io/api/endpoint \
-H "X-Tenant-Id: test_tenant_123" \
-H "Authorization: Bearer customer_token"
# Check for Aforo response headers:
# X-Aforo-Remaining: 8420
# X-Aforo-Plan: enterprise
# X-Aforo-Margin-Status: healthy
# Verify event arrived in Aforo
curl -s "https://api.aforo.ai/v1/events?tenant_id=test_tenant_123&limit=1" \
-H "Authorization: Bearer sk_live_your_admin_key" | jq .
PRO TIP
If events are not appearing, check the Anypoint Runtime Manager logs. Look for [aforo-policy] log entries. Common issues: incorrect environment_id mapping, expired API key, or outbound HTTPS blocked by the VPC firewall (allow ingest.aforo.ai:443).