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
Hit by the reference webapp but often absent from the published spec:
/events/{eid}/client_campaign_status[/task]/events/{eid}/campaign_optimisation_status/events/{eid}/ad_campaign_optimisation_status/events/{eid}/attribution_model- CR API:
/customers/*,events/bulk_upload,/events/last_updated_on_fe/{eid},PUT /events/{eid}(domain save)
Several writes take query-string params
Several writes take query-string params
POST /campaigns/, PUT /events/{eid}/client_campaign_status?...,
POST /events/{eid}/series?event_series=A&event_series=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.