v3

latestOpenAPI 3.1.02026-08-07478772.4 KB
campaign

Replace a campaign's configuration

Replace a campaign's configuration through the one validated write path.

Authorize, validate, then write via the apply_campaign_config RPC, which stamps the write so the version trigger records who made it. Returns the id of the version the write minted, the stored configuration, and the base_updated_at token to send back on the next conditional write.

Supplying base_updated_at makes the write conditional: if the configuration moved since that token was issued, the write is refused with 409 instead of overwriting the other edit. Omit it to write unconditionally.

What this endpoint does NOT do:

  • No partial merge. The body's configuration REPLACES the stored one outright, matching how the product saves today.
  • No experiments consent flow. Consent arguments are always sent empty, so a write that would disturb a running experiment is refused by the engine and returned as 409 with the engine's message; that caller has to go through the consent-aware path instead.
  • No field stripping. Keys CampaignConfig does not declare are stored verbatim and logged, never dropped.

request is the published contract and the first validation gate; http_request supplies what actually gets written. Parsing the body into CampaignConfig would silently drop every undeclared key (the model is extra="ignore", and its nested models are too, so no amount of extra="allow" at the top level would make the parsed object faithful), so the raw JSON object is what reaches storage.

Decoded from the cached BYTES, not from http_request.json(): Starlette caches the decoded object and hands the SAME one to FastAPI's parse, and several config validators rewrite what they are given in place (TTSConfig._resolve_params_by_provider replaces params with a model instance and can inject a default model). Reading .json() would therefore return a body the parse had already corrupted. Re-decoding the bytes costs one json parse and is the only form that is guaranteed pristine.

put/api/v1/campaigns/{campaign_id}/configuration

Path parameters

campaign_idstring required

Request body

base_updated_atstring date-time nullable

Compare-and-set token from a previous response's base_updated_at. When supplied the write is refused with 409 if the configuration changed since. Omit to write unconditionally.

Response

Configuration written; a new version was minted

campaign_idstring required

The campaign that was written.

version_idstring nullable

Id of the campaign version this write minted.

configurationobject nullable

The configuration as now stored, including undeclared keys.

updated_atstring date-time nullable

The campaign row's updated_at after the write.

base_updated_atstring date-time nullable

Token to send as base_updated_at on the next conditional write. Advances only when the configuration really changes — do not derive it from updated_at, which moves on any column.