Authenticate the ReyGrid TypeScript SDK with an API key.
Provide your API key when creating the client. The SDK sends it as Authorization: Bearer <key> on every request.
import { ReyGrid } from "reygrid";const client = new ReyGrid({ apiKey: process.env.REYGRID_API_KEY });
Change the key at runtime
client.setApiKey("new-key"); // returns the client, so calls can be chainedclient.setApiKey(undefined); // clearclient.getApiKey(); // string | undefined
Validate the key
const v = await client.validate();console.log(v.valid, v.usage.total, v.usage.quotaLimit);const usage = await client.getUsage(); // shortcut for (await validate()).usage