> ## 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.

# Get Current Usage

> Retrieve real-time usage metrics for the current period.

## Endpoint

```
GET /v1/usage
```

## Authentication

Requires a developer API key in the `Authorization` header.

## Request Headers

| Header          | Value              |
| --------------- | ------------------ |
| `Authorization` | `Bearer <api_key>` |

## Example Request

```bash theme={null}
curl https://grantex-auth-dd4mtrt2gq-uc.a.run.app/v1/usage \
  -H "Authorization: Bearer gx_..."
```

## Response -- 200 OK

```json theme={null}
{
  "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                    |

<Note>
  Usage counters are served from Redis for real-time accuracy. They reset at midnight UTC.
</Note>

## Error Responses

| Status | Code           | Description                |
| ------ | -------------- | -------------------------- |
| 401    | `UNAUTHORIZED` | Invalid or missing API key |

## SDK Examples

<CodeGroup>
  ```typescript TypeScript theme={null}
  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}`);
  ```

  ```python Python theme={null}
  from grantex import Grantex

  grantex = Grantex(api_key="gx_...")

  usage = grantex.usage.current()
  print(f"Total requests today: {usage.total_requests}")
  print(f"Token exchanges: {usage.token_exchanges}")
  ```
</CodeGroup>
