@prospektex/api-client
v0.1.0
Published
Typed client for the Prospektex API.
Readme
@prospektex/api-client
Typed client for the Prospektex API. Types are generated from the live API, so the client cannot drift from the server.
npm install @prospektex/api-clientQuickstart
import { createApiClient } from "@prospektex/api-client";
const api = createApiClient("https://app.prospektex.com/api", {
apiKey: process.env.PROSPEKTEX_API_KEY,
});
const res = await api.conversations.$get({ query: { status: "open" } });
if (res.ok) {
const { conversations } = await res.json(); // fully typed
}Authentication
API key (server-to-server). Create one under Settings → Developers. Sent as
Authorization: Bearer <key>.
createApiClient(baseUrl, { apiKey: "ptx_..." });A key acts as the user who created it, inside the workspace it was created in, and is limited to the permissions granted at creation.
Session cookie (browser, same-origin). Pass no apiKey and forward
credentials:
createApiClient("/api", { init: { credentials: "include" } });Requirements
Node 18+ or any fetch-capable runtime. The only runtime dependencies are
hono and zod — no database or auth packages are pulled in.
