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

# Delete A/B test

> Delete an A/B test

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Delete an A/B test" href="/doc/libraries/sdk/methods/abtesting/delete-ab-test" />

**Required ACL:** `editSettings`

Deletes the A/B test from your application.
and removes all associated metadata and metrics.

## Examples

<CodeGroup>
  ```cs C# theme={"system"}
  AnalyticsClient analytics = new AnalyticsClient("YourApplicationID", "YourWriteAPIKey");
  analytics.DeleteABTest(42);

  // Asynchronous
  analytics.DeleteABTestAsync(42);
  ```

  ```go Go theme={"system"}
  client := = analytics.NewClient("YourApplicationID", "YourWriteAPIKey")
  res, err := client.DeleteABTest(42)
  ```

  ```java Java theme={"system"}
  AnalyticsClient analytics = 
  DefaultAnalyticsClient.create("YourApplicationID", "YourWriteAPIKey");

  analytics.DeleteABTest(42);

  // Asynchronous
  analytics.DeleteABTestAsync(42);
  ```

  ```js JavaScript theme={"system"}
  const analytics = client.initAnalytics({
    // optional parameters
    region: 'de',
    appId: 'YourApplicationID',
    apiKey: 'YourWriteAPIKey',
  });
  analytics.deleteABTest(42).then(({ abTestID }) => {
    console.log(abTestID);
  });
  ```

  ```kotlin Kotlin theme={"system"}
  clientAnalytics.deleteABTest(ABTestID(42))
  ```

  ```php PHP theme={"system"}
  $analytics = AnalyticsClient::create(
    'YourApplicationID',
    'YourWriteAPIKey'
  );

  $analytics->deleteABTest(42);
  ```

  ```python Python theme={"system"}
  analytics = AnalyticsClient.create(
      'YourApplicationID',
      'YourWriteAPIKey'
  )

  analytics.delete_ab_test(42)
  ```

  ```ruby Ruby theme={"system"}
  analytics = Algolia::Analytics::Client.create('YourApplicationID', 'YourWriteAPIKey')
  analytics.delete_ab_test(42)
  ```

  ```scala Scala theme={"system"}
  client.execute {
    delete abTest 42
  }
  ```

  ```swift Swift theme={"system"}
  analyticsClient.deleteABTest(withID: 42) { result in
    if case .success(let response) = result {
      print("Response: \(response)")
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="abTestID" type="integer" required>
  The ID of the A/B test you want to delete.
</ParamField>

## Response

<ResponseField name="abTestID" type="integer">
  Generated Id of the A/B test.
</ResponseField>

<ResponseField name="index" type="string">
  Base index name for the A/B test.
</ResponseField>

<ResponseField name="taskID" type="integer">
  The task ID used with the [`waitTask`](/doc/libraries/sdk/v1/methods/wait-task) method.
</ResponseField>

### Response as JSON

This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the `getLogs` method.
Don't rely on the order of properties—JSON objects don't preserve key order.

```jsonc JSON icon=braces theme={"system"}
{
  "abTestID": 78,
  "taskID": 111887230,
  "index": "atis-abtest-default"
}
```
