useGrant

SDK

Type-safe TypeScript SDK for the useGrant API.

Installation

The TypeScript SDK gives you type-safe access to the useGrant API. Install it from the npm registry with your package manager of choice:

npm install @usegrant/sdk

Authentication

The SDK needs an API key, which you can create on the API Keys settings page. If a request fails with 401 Unauthorized, check that:

  • The key was copied correctly and starts with uga_.
  • The key has not expired. If it has, create a new key and replace the old one.

See API Authentication for more details.

Rate limiting

Each API key is limited to 1000 requests per hour. Requests over the limit receive a 429 Too Many Requests response.

To stay within the limit:

  • Retry failed requests with exponential backoff.
  • Monitor your API usage.
  • Cache responses where appropriate, for example reuse an access token until it expires instead of creating a new one per request.

If you self-host useGrant, you can change the limit in the apiKey plugin configuration in src/lib/auth.ts.

Usage

See the README on GitHub for usage instructions.

On this page