api-reference/openapi.json. Two common toolchains:
Option A — openapi-typescript + openapi-fetch
This is the lightest. No code generation, just types.
Option B — openapi-typescript-codegen (full generated client)
If you prefer a generated EventsService.list(...) style:
Wrapping for auth + partner header + retries
Either option benefits from a wrapper that handles token refresh, partner selection, and 429 backoff. Here’s a reference:Working with the CR API
For the CR-API host (see Two-host architecture), generate a second types file from a CR OpenAPI spec — ask Future Demand for the canonical document. Wire it up as a secondopenapi-fetch client
with baseUrl: CR_BASE.
Re-generation in CI
Caveats
The OpenAPI spec is swagger 2.0, not OpenAPI 3.x
The OpenAPI spec is swagger 2.0, not OpenAPI 3.x
Most modern generators handle both.
openapi-typescript does.
openapi-typescript-codegen does. If your generator complains, run a
swagger → openapi conversion first (npx swagger2openapi).Some used endpoints are missing from the spec
Some used endpoints are missing from the spec
/events/{eid}/client_campaign_status[/task], /events/{eid}/campaign_optimisation_status,
and a handful of CR API routes are hit by the reference webapp but
absent from the canonical OpenAPI spec. Your generated client won’t
include them — write thin manual wrappers, and lobby Future Demand to
add them to the spec.Several writes take query-string params
Several writes take query-string params
POST /campaigns/, PUT /events/{eid}/client_campaign_status?...,
POST /package_builder/packages/merge?packages_ids=A&packages_ids=B,
etc. Generated clients handle these correctly, but if you hand-build
a wrapper, watch out for the convention.The `apikey` security scheme is misnamed in the spec
The `apikey` security scheme is misnamed in the spec
It’s actually
Authorization: Bearer <token> — see
Authentication. Configure your generated client
accordingly.