---
title: Remove sessions from an Agent Analytics dataset
description: Removes sessions from a dataset. The sessions themselves are untouched; only their dataset membership is removed. Sessions that are not in the dataset are ig…
product: general
lang: en
last_updated: 2026-10-21
token_estimate: 1324
---
# Remove sessions from an Agent Analytics dataset

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Remove sessions from an Agent Analytics dataset

**DELETE** `/v1/projects/{project_id}/agent-analytics/datasets/{dataset_id}/sessions`

Full URL: `https://developer-api.amplitude.com/v1/projects/{project_id}/agent-analytics/datasets/{dataset_id}/sessions`

**Servers:**
- Production (US): `https://developer-api.amplitude.com/v1/projects/{project_id}/agent-analytics/datasets/{dataset_id}/sessions`
- Production (EU): `https://developer-api.eu.amplitude.com/v1/projects/{project_id}/agent-analytics/datasets/{dataset_id}/sessions`

Remove sessions from an Agent Analytics dataset

Removes sessions from a dataset. The sessions themselves are untouched;
only their dataset membership is removed. Sessions that are not in the
dataset are ignored, so the call is safe to repeat.

Takes the same body as the add operation, so an add is undone in one call
rather than one call per session. `dry_run=true` validates the dataset and
the session ids without mutating, returning `204` on a hit and `404` if the
dataset does not exist.

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Authorization | string | Yes | — | http |

## Path parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| project_id (path) | string | Yes | 12345 | Amplitude project identifier, backed by the canonical app ID. Constraints: pattern: ^[0-9]+$ |
| dataset_id (path) | string | Yes | — | Stable dataset identifier, returned by create or by the Agent Analytics read surface. |

## Query parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| dry_run (query) | boolean | No | false | Validate request without performing mutation. |

## Header parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Idempotency-Key (header) | string | Yes | — | Unique idempotency key used to safely retry write operations. Constraints: min length: 8, max length: 255 |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| session_ids | string[] | Yes | — | Session identifiers. All must belong to the path project. |

## Response (application/json)

**204** — Sessions removed from the dataset, or dry-run hit.

**400**

**401**

**403**

**404**

**422**

**429**

**502**

## Code samples

### cURL

```bash
curl -X DELETE "https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false" \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.delete(
    "https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false",
    headers={
        "Content-Type": "application/json",
        "Authorization": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false", {
  method: "DELETE",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Authorization: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("DELETE", "https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false"))
      .method("DELETE", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://developer-api.amplitude.com/v1/projects/12345/agent-analytics/datasets/{dataset_id}/sessions?dry_run=false")
request = Net::HTTP::Delete.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

