Custom Usage

MagicAPI allows you to set custom Usage reported by your backend. These changes need to be made in your API backend. Hence when MagicAPI calls your API backend, then that backend must add this header to the response.

Please make sure you mention this clearly in your Product description on MagicAPI. You must also include this in your docs.

Default Behavior:

By default, each request consumes "1" API call for the given Pricing Plan. Hence the default header is added to all requests:

X-Magicapi-Billing: API=1;

Allow "unlimited" calls for certain endpoints

If you wish to make certain endpoints "FREE". i.e. To NOT reduce the API usage when a user requests those endpointPaths. Then you can simply pass this header:

X-Magicapi-Billing: API=0;

This will not "increase" the total APICalls used in the given plan.

Charge more than "1" API unit for a request

Similarly to charge more than "one" unit per request, you can update this header to the custom usage and send it as a response in your API.

X-Magicapi-Billing: API=3;

Last updated