Variation

Schema, including its fields, nested structure, and relationships

Definition

A Variation is a traffic bucket inside a variation group. Exactly one variation per group is the reference (control). Non-reference variations may define Modifications (e.g., setting feature flags or remote config variables) applied to users assigned to that variation.

Payload Properties

When creating/updating a Variation, the payload includes the following fields:

  • id (String, optional) – The variation unique ID. Include this only when updating an existing variation.

  • name (String, required) — Label for the variation.

  • reference (Boolean, required) — Exactly one true per group.

  • allocation (Integer, required) — Percentage (0–100) of the group’s traffic.

  • modifications (Object, optional) — Changes applied to this variation:

    • type (String, required when present) — e.g., "FLAG" (or "VARIABLES" if supported).

    • value (Object, required when present) — Key/value pairs to set (flag names or config keys).

Example Variation Payload: Creating a new variation with a name, allocating 50% of traffic, and including some flags:

{
  "name": "Variation 1",
  "reference": false,
  "allocation": 50,
  "modifications": {
    "type": "FLAG",
    "value": {
      "flag_created_with_resource_loader": "blue",
      "recommendations.limit": 6
    }
  }
}

Response Fields

When a Variation is returned by the API/Resource Loader (nested under its variation group), you’ll see the server-assigned ID and the resolved definition:

  • id (String) — Unique variation identifier.

  • name (String) — Variation name.

  • reference (Boolean) — Whether this is the control.

  • allocation (Integer) — Traffic allocation (0–100).

  • modifications (Object) — Resolved modifications:

    • type (String) — e.g., "FLAG".

    • value (Object|Array) — Effective values. Some implementations return an empty object/array for the control when no changes apply.

Example Response

{
  "allocation": 50,
  "id": "variation_id",
  "modifications": {
    "type": "FLAG",
    "value": []
  },
  "name": "Original",
  "reference": true
}

Error Codes

Variations use the same set of error codes as modifications (and other resources), adjusted to the context of campaigns and variations:

  • InvalidPayload – The variation data was missing required fields or had invalid values.

  • ParentNotFound – The specified parent campaign was not found (e.g., the $_parent_id campaign ID is invalid).

  • PermissionDenied – The user is not allowed to create or modify variations in this campaign.

  • DuplicateRef – A variation with the same reference already exists (for example, a duplicate variation name in the same campaign).

  • InvalidDependency – A related resource is missing (for instance, trying to create a variation in a campaign that doesn’t exist or isn’t accessible).

Last updated

Was this helpful?