Skip to main content
This document provides a guide and overview for the InsertTreatment and UpdateTreatment RPCs, which allow you to insert and update treatments directly via API.

API Definitions

Entities

TreatmentPb

TreatmentVersionPb

TagPb

ContentPb

TargetActionPb

EligibilityRulesPb

MutualExclusionGroupPb

TreatmentTypePb

EligibilityRulePb

InsertTreatment

API to create a new treatment

Sample cURL Request

Sample Response

UpdateTreatment

API to update an existing treatment.

Sample cURL Request

Sample Response

API to delete an existing treatment.

Don’t set any fields other than project_id, treatment_id, external_treatment_id and last_modified_by when deleting treatments

Sample cURL Request

Sample Response

API to pause an existing treatment.

Don’t set any fields other than project_id, treatment_id, external_treatment_id, last_modified_by, and should_pause when pausing treatments
A paused treatment reports status ARCHIVED once its end_timestamp has passed.

Sample cURL Request

Sample Response

API to archive an existing treatment.

Don’t set any fields other than project_id, treatment_id, external_treatment_id, last_modified_by, and should_archive when archiving treatments
Archiving sets the live version’s end_timestamp to the time of the request, so the treatment stops serving. If the treatment had not started yet, its start_timestamp is also moved to just before the request time. An unpublished draft is kept and returned as a second entry in versions. To restore an archived treatment, call UpdateTreatment with should_publish=true and a future end_timestamp. A paused treatment stays paused through archive and restore; send should_pause=false to resume it.

Sample cURL Request

Sample Response