> ## Documentation Index
> Fetch the complete documentation index at: https://www.algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply a variant's captured settings to the control index

> Applies the captured settings of the given variant to the control index.

**Required ACL:** `analytics`, `editSettings`

The settings must first be captured with the `saveVariantSettings` operation. To revert previously applied settings on the control index, use this operation with the control variant (variant 1).

Settings can be applied up to 14 days after the A/B test ends, and reverted up to 15 days after. Later requests return `400`.

Each set of captured settings can only be applied once, and settings that were reverted can't be applied again. Both cases return `400`.

The control index must not be in use by an active A/B test. Otherwise, the request returns `422`.

## Usage

<CodeGroup>
  ```cs C# theme={"system"}
  // Initialize the client
  var client = new AbtestingV3Client(
    new AbtestingV3Config(
      "ALGOLIA_APPLICATION_ID",
      "ALGOLIA_API_KEY",
      "ALGOLIA_APPLICATION_REGION"
    )
  );

  // Call the API
  await client.ApplyVariantSettingsAsync(42, 2);
  ```

  ```dart Dart theme={"system"}
  // Initialize the client
  final client = AbtestingV3Client(
      appId: 'ALGOLIA_APPLICATION_ID',
      apiKey: 'ALGOLIA_API_KEY',
      region: 'ALGOLIA_APPLICATION_REGION');

  // Call the API
  await client.applyVariantSettings(
    id: 42,
    variantId: 2,
  );
  ```

  ```go Go theme={"system"}
  // Initialize the client with your application region, eg. abtestingV3.ALGOLIA_APPLICATION_REGION
  client, err := abtestingV3.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", abtestingV3.US)
  if err != nil {
    // The client can fail to initialize if you pass an invalid parameter.
    panic(err)
  }

  // Call the API
  err = client.ApplyVariantSettings(client.NewApiApplyVariantSettingsRequest(
    42, 2))
  if err != nil {
    // handle the eventual error
    panic(err)
  }
  ```

  ```java Java theme={"system"}
  // Initialize the client
  AbtestingV3Client client = new AbtestingV3Client("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");

  // Call the API
  client.applyVariantSettings(42, 2);
  ```

  ```js JavaScript theme={"system"}
  // Initialize the client
  // Replace 'us' with your Algolia Application Region
  const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initAbtestingV3({ region: 'us' });

  // Call the API
  await client.applyVariantSettings({ id: 42, variantId: 2 });
  ```

  ```kotlin Kotlin theme={"system"}
  // Initialize the client
  val client =
    AbtestingV3Client(
      appId = "ALGOLIA_APPLICATION_ID",
      apiKey = "ALGOLIA_API_KEY",
      region = "ALGOLIA_APPLICATION_REGION",
    )

  // Call the API
  client.applyVariantSettings(id = 42, variantId = 2)
  ```

  ```php PHP theme={"system"}
  // Initialize the client
  $client = AbtestingV3Client::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');

  // Call the API
  $client->applyVariantSettings(
      42,
      2,
  );
  ```

  ```python Python theme={"system"}
  # Initialize the client
  # In an asynchronous context, you can use AbtestingV3Client instead, which exposes the exact same methods.
  client = AbtestingV3ClientSync(
      "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
  )

  # Call the API
  client.apply_variant_settings(
      id=42,
      variant_id=2,
  )
  ```

  ```ruby Ruby theme={"system"}
  # Initialize the client
  client = Algolia::AbtestingV3Client.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")

  # Call the API
  client.apply_variant_settings(42, 2)
  ```

  ```scala Scala theme={"system"}
  // Initialize the client
  val client = AbtestingV3Client(
    appId = "ALGOLIA_APPLICATION_ID",
    apiKey = "ALGOLIA_API_KEY",
    region = Option("ALGOLIA_APPLICATION_REGION")
  )

  // Call the API
  Await.result(
    client.applyVariantSettings(
      id = 42,
      variantId = 2
    ),
    Duration(100, "sec")
  )
  ```

  ```swift Swift theme={"system"}
  // Initialize the client
  let client = try AbtestingV3Client(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)

  // Call the API
  try await client.applyVariantSettings(id: 42, variantId: 2)
  ```
</CodeGroup>

<Card icon="folder-code" horizontal="true" title="See the full API reference" arrow="true" href="/doc/rest-api/abtesting-v3/apply-variant-settings">
  For more details about input parameters
  and response fields.
</Card>
