Custom Usage
api.market allows you to set custom Usage reported by your backend. These changes need to be made in your API backend. Hence when api.market 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 api.market. You must also include this in your docs.
💡 Billing per image, second of video, megapixel or 1,000 characters? You can pick that billing unit in your pricing plan instead, and api.market counts the units for you. If your backend also sends this header, the header always wins over the plan's billing unit. For example, on a plan billed per image, X-Magicapi-Billing: API=7 bills 7 units however many images the response contains.
Default Behavior:
By default, each request is billed in the billing unit of the customer's pricing plan (see What is a Pricing Plan). On plans billed per call, the default for new products, every request counts as 1 unit, as if your backend sent this header:
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 API calls 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