Update entitlements
See how the update endpoint is implemented in our Example app ↗.
What is the /increment endpoint
The /increment
endpoint may come useful when increasing the usage count of a consumable user entitlement.
For example, you should use this if you want to increment API calls, tokens used, or monthly active users.
Each call to /increment
adds to the current usage, and the API will return whether the user is still entitled after the increment (i.e., whether the usage remains within the allowed limit).
This makes it ideal for enforcing usage-based billing or feature gating without maintaining counters on your end.
How to use it
Here's an example of how to implement the /increment
endpoint in your code:
import axios from "axios";
const gater = axios.create({
baseURL: "https://api.gater.dev",
headers: { "X-Api-Key": process.env.GATER_SECRET },
});
const response = await gater.post("/increment", {
user: "user_123",
feature: "app_tokens",
amount: 5000, // 💡 defaults to 1 if undefined
});
console.log(response.data);
N.B. The request will not succeed if the provided amount
property exceeds
the remaining usage for the entitlement's current quota.