SDKs & Client Libraries
Generate a fully typed client from the adaptlive OpenAPI spec. The recommended TypeScript path uses hey-api — run one command against the live schema and get type-safe functions for every endpoint.
Generate from OpenAPI
Live spec
Always up to date at /api/v1/openapi.json.
Static snapshot
The repo also keeps a generated snapshot at apps/web/public/openapi.json.
Client Examples
Setup
npm install @hey-api/client-fetch
npm install -D @hey-api/openapi-ts
# Generate the typed SDK from the live spec
npx openapi-ts -i https://adaptlive.app/api/v1/openapi.json -o src/adaptlive -c @hey-api/client-fetchUsage
import { client } from "./adaptlive/client.gen";
import { getWorkRecords, postPeopleUpsert } from "./adaptlive/sdk.gen";
// Configure once
client.setConfig({
baseUrl: "https://adaptlive.app/api/v1",
headers: {
Authorization: `Bearer ${process.env.ADAPT_API_KEY}`,
},
});
// Fully typed — params, response, and errors
const { data, error } = await getWorkRecords({
query: { limit: 50 },
});
if (error) throw new Error(error.error.message);
console.log(data.data);
// Create or update a person by phone
const { data: person } = await postPeopleUpsert({
body: {
primaryPhone: "+15125551234",
firstName: "Jane",
lastName: "Doe",
},
});Production Guidance
- Keep API keys on your server; never ship them to browsers or mobile apps.
- Honor
429responses and retry with backoff. - Use
Idempotency-Keyon mutating requests. - Re-run
npx openapi-tswhen the API spec changes to pick up new endpoints.
