Apikeys API (TypeScript)
Methods, examples, and parameters for client.apikeys.
Module Overview
Create, rotate, and revoke API keys for tenants and automation workflows.
Available Methods
client.apikeys.list()- List active and revoked keys.client.apikeys.create()- Create a new API key.client.apikeys.revoke()- Revoke a key immediately.
Examples
TypeScript
import { TheRouter.ai } from "@therouter/sdk";
const client = new TheRouter.ai({ apiKey: process.env.THEROUTER_API_KEY! });
const key = await client.apikeys.create({
name: "ci-pipeline",
scope: ["responses:write", "models:read"],
});
console.log(key.prefix);apikeys-response.json
{
"id": "req_01HXYZ123",
"module": "apikeys",
"status": "ok"
}Parameter Types
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Human-friendly key label. |
scope | string[] | Allowed capabilities for this key. | |
expires_at | string (ISO datetime) | Optional expiration timestamp. |
SDK parity
Method signatures are aligned across SDKs so migration between TypeScript and Python stays predictable.