SDK overview
codata-io — a zero-dependency typed TypeScript client for data, auth, agents, realtime, notifications, and keys.
codata-io
Codata ships a typed TypeScript SDK — codata-io — that wraps every workspace surface: data, auth, agents, realtime, notifications, jobs, and API keys. Zero dependencies, Node 18+, same surface in Node, browsers, edge runtimes, and React Native. You always call the SDK; never raw fetch or axios.
npm install codata-ioInitialize
After generating your workspace, Codata writes a typed client file (e.g. src/lib/codata.ts) and a .env entry with your workspace API key:
import { CodataClient } from "codata-io";
const client = new CodataClient({
apiKey: process.env.CODATA_API_KEY!, // workspace API key (wsk_*)
});
export const ws = client.workspace(process.env.CODATA_WORKSPACE_ID!);Auth options
apiKey- Workspace API key (wsk_*) — recommended for server-side production use.
token- Bearer/JWT token (OAuth or developer token).
tokenFn- Async token provider for dynamic/refreshing credentials.
Other options: timeout (default 30s), retry (exponential backoff), cache, and request/response interceptors.
Everything hangs off the workspace
const ws = client.workspace(workspaceId, { branch: "main" });
await ws.get("/books"); // data → /docs/sdk-examples
ws.auth // end-user auth → /docs/authentication
ws.agent("supportBot") // AI agents → /docs/ai-agents
ws.realtime() // realtime → /docs/realtime
ws.notifications // transactional messages
ws.jobs // scheduled / background jobs
client.keys // API key managementGolden rule: the generated types are the single source of truth. Don't define duplicate interfaces, Zod schemas, mappers, or ORM models next to the SDK — if the schema doesn't fit, update the workspace spec and regenerate.