SDK & CLI
TypeScript client
The SDK wraps the REST API with one typed namespace per service — projects, deployments, environments, apps, databases, buckets, sandboxes, functions, networking, domains, apiKeys, serviceAccounts, invites, audit, metrics, usage, resources and organization. Every method maps to a documented endpoint; the REST endpoints page lists each path next to its namespace. The client authenticates with an API key from Organization → API keys. A failed call throws TngatcloudApiError, whose message is the API's own explanation ("This project already has 20 databases…") and whose status lets you branch on 409 (a cap), 403 (a permission) or 404.
import { TngatcloudClient, TngatcloudApiError } from "@tngatcloud/sdk";
const client = new TngatcloudClient({
apiKey: process.env.TNGAT_API_KEY!,
baseUrl: "https://api.tngat.com",
// Retries (default 2) cover a rate limit or a restarting pod so your code
// does not have to. Set 0 to opt out.
maxRetries: 2,
});
const project = await client.projects.create({
slug: "shopfront",
name: "Shopfront",
port: 3000,
});
const db = await client.databases.create({
projectId: project.id,
name: "orders",
engine: "postgres",
cpu: "500m",
memoryMb: 1024,
storageGb: 10,
});
const bucket = await client.buckets.create({
projectId: project.id,
name: "assets",
quotaGb: 50,
});A refusal says what to change, so handle it where the work is — and branch on code, which is stable, rather than on the message:
import { TngatcloudApiError } from "@tngatcloud/sdk";
try {
await client.databases.create({ projectId: project.id, name: "events", engine: "postgres" });
} catch (error) {
if (error instanceof TngatcloudApiError) {
switch (error.code) {
case "resource_limit_exceeded":
// The project is at a published cap — split the workload across
// projects, or ask a platform administrator to raise the limit.
break;
case "org_suspended":
// A platform freeze, not a permission problem. Retrying now will not
// help; surface it and wait.
break;
case "forbidden":
// The key's role does not include this action. The message names it.
break;
}
}
throw error;
}Retries. The client repeats a 429 (after the retry-after the API sends, or with jittered backoff when there is none) and a 502/503/504 on methods that are idempotent by definition — GET, HEAD, PUT, DELETE. It deliberately does not repeat a POST after a 5xx: the request may already have been processed, and a second attempt could provision a second database. Retry the POST yourself once you have checked whether it landed.
Onboarding an AI agent
Dashboard → Onboard Your Agent copies a ready-made prompt describing the SDK contract. Paste it into your assistant and it can provision infrastructure on your behalf using a scoped API key.
Give an agent a key with the narrowest role that works, and bind it to your organization's IP allowlist. Agent-driven changes appear in the audit log under the service account that owns the key.
Approval workflow
The built-in agent asks for explicit approval before it runs a mutating call. Approvals are per-request and are recorded alongside the action they authorised.