SDKs
TypeScript SDK
@tigby/sdk on npm – generated from the API's own contract, no runtime dependencies.
npm install @tigby/sdkGenerated from the OpenAPI document, which is itself generated from the running API – the package cannot describe an endpoint the API does not have. The fetch client is bundled; nothing else is installed.
Use it
import { configureTigby, createIdentity, listIdentities, TigbyError } from "@tigby/sdk";
configureTigby({ apiKey: process.env.TIGBY_API_KEY });
const { data: created } = await createIdentity({ body: { handle: "orderbot" } });
console.log(created.saga.status); // provisioning has started
const { data } = await listIdentities();For more than one account in a process, createTigbyClient({ apiKey }) returns a client every operation accepts as { client }.
Both default to https://api.tigby.eu – the host the OpenAPI document names, read out of the generated client rather than written again. Pass baseUrl: "http://localhost:8080" for a dev stack.
Errors
Every refusal raises TigbyError – the RFC 9457 problem as a typed object:
try {
await createIdentity({ body: { handle: "orderbot" } });
} catch (error) {
if (error instanceof TigbyError) {
error.code; // "handle_taken" – stable, branch on it
error.agentHint; // what to do instead
error.docUrl; // where a human reads more
}
}