Documentation Index
Fetch the complete documentation index at: https://docs.grantex.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Grantex tracks API usage in real-time using Redis counters with periodic PostgreSQL rollup. Monitor token exchanges, authorizations, and verifications per developer.
Enabling Usage Metering
Set the environment variable:
USAGE_METERING_ENABLED=true
API Endpoints
Current Period Usage
curl https://api.grantex.dev/v1/usage \
-H "Authorization: Bearer $GRANTEX_KEY"
Response:
{
"developerId": "dev_...",
"period": "2026-03-02",
"tokenExchanges": 42,
"authorizations": 18,
"verifications": 7,
"totalRequests": 67
}
Usage History
curl "https://api.grantex.dev/v1/usage/history?days=30" \
-H "Authorization: Bearer $GRANTEX_KEY"
SDK Usage
// TypeScript
const usage = await grantex.usage.current();
console.log(`Today: ${usage.totalRequests} requests`);
const history = await grantex.usage.history({ days: 7 });
for (const day of history.entries) {
console.log(`${day.date}: ${day.totalRequests}`);
}
# Python
usage = grantex.usage.current()
print(f"Today: {usage.total_requests} requests")
history = grantex.usage.history(days=7)
for day in history.entries:
print(f"{day.date}: {day.total_requests}")
Plan Limits
| Metric | Free | Pro | Enterprise |
|---|
| Agents | 500 | 5,000 | Unlimited |
| Grants | 1,000 | 50,000 | Unlimited |
| Policies | 50 | 500 | Unlimited |
| Audit entries | 20,000 | 1,000,000 | Unlimited |
| Token exchanges/month | 50,000 | 5,000,000 | Unlimited |
| Authorizations/month | 50,000 | 5,000,000 | Unlimited |
| Webhooks | 30 | 200 | Unlimited |