SDKs
Generate a typed careCycle API client from the OpenAPI spec.
careCycle does not publish an official SDK. The API is fully described by an OpenAPI 3.1 spec, so you can generate a typed client in the language you use:
- YAML:
https://docs.carecycle.ai/openapi.yaml - JSON:
https://docs.carecycle.ai/openapi.json
Generate a client with OpenAPI Generator
OpenAPI Generator supports dozens of
languages. This generates a TypeScript client that uses fetch:
npx @openapitools/openapi-generator-cli generate \
-i https://docs.carecycle.ai/openapi.yaml \
-g typescript-fetch \
-o ./carecycle-clientFor other languages, change -g (for example python, go, java, or
csharp). Run npx @openapitools/openapi-generator-cli list to see every
generator.
Authenticate the client
Operations in the spec declare the x-api-key header scheme, so generated
clients send your key once you configure it. With the TypeScript client above:
import { CampaignsApi, Configuration } from "./carecycle-client"
const campaigns = new CampaignsApi(
new Configuration({ apiKey: process.env.CARECYCLE_API_KEY })
)
const page = await campaigns.getV2Campaigns({ page: 1, perPage: 50 })Generated class and method names come from the tags and operation IDs in the spec, so check the generated code for the exact names. Keep your API key on the server: see Authentication.
Regenerate the client when the spec changes. See Versioning.