Policies

Monetization Policy

The Monetization policy allows you to track and monetize the usage of our API resources, declaratively and programatically.

Follow our Quickstart guide for Monetization to get started.

Beta

This policy is in beta. You can use it today, but it may change in non-backward compatible ways before the final release.

Configuration

The configuration shows how to configure the policy in the 'policies.json' document.

{ "name": "my-monetization-inbound-policy", "policyType": "monetization-inbound", "handler": { "export": "MonetizationInboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "meters": { "requests": 1 } } } }

Policy Options

The options for this policy are specified below. All properties are optional unless specifically marked as required.

  • allowRequestsWithoutSubscription <boolean> -
    Indicates if requests without subscription should be allowed or not.
    Defaults to false.
  • allowedSubscriptionStatuses <string[]> -
    Indicates which subscription statuses should be allowed.
    Defaults to [["active","incomplete","trialing"]].
  • bucketId <string> -
    Indicates the bucket to be used, overrides the default one.
  • allowRequestsOverQuota <boolean> -
    Indicates if requests over quota should be allowed or not.
    Defaults to false.
  • meters <object> (Required) -
    The meters to be used by the policy against the subscription quota.
  • meterOnStatusCodes <string | number[]> -
    A list of successful status codes and ranges "200-299, 304" that should trigger a metering call.
    Defaults to "200-299".

Using the Policy

Read more about how policies work

Previous
Moesif Analytics & Billing