Endpoint
Authentication
Requires a developer API key in the Authorization header.
| Header | Value |
|---|
Authorization | Bearer <api_key> |
Example Request
curl https://grantex-auth-dd4mtrt2gq-uc.a.run.app/v1/usage \
-H "Authorization: Bearer gx_..."
Response — 200 OK
{
"developerId": "dev_01HXYZ...",
"period": "2026-04-05",
"tokenExchanges": 142,
"authorizations": 58,
"verifications": 1203,
"totalRequests": 1403
}
Response Fields
| Field | Type | Description |
|---|
developerId | string | The authenticated developer’s ID |
period | string | Current date in YYYY-MM-DD format |
tokenExchanges | number | Number of token exchange requests today |
authorizations | number | Number of authorization requests today |
verifications | number | Number of token verification requests today |
totalRequests | number | Sum of all request types |
Usage counters are served from Redis for real-time accuracy. They reset at midnight UTC.
Error Responses
| Status | Code | Description |
|---|
| 401 | UNAUTHORIZED | Invalid or missing API key |
SDK Examples
import Grantex from '@grantex/sdk';
const grantex = new Grantex({ apiKey: 'gx_...' });
const usage = await grantex.usage.current();
console.log(`Total requests today: ${usage.totalRequests}`);
console.log(`Token exchanges: ${usage.tokenExchanges}`);