> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.band.ai/_mcp/server.

# Bulk-delete chat sessions

POST https://api.dev.band.ai/api/v1/me/chats/bulk-delete
Content-Type: application/json

Starts an asynchronous job that soft-deletes up to 100 chat rooms. The
Location resource is polled until `completed` or `failed`; a completed job
may contain individual failed results, including `not_found` for a malformed
target ID. If the job itself fails, the target it stopped on carries
`delete_failed` and every target behind it carries `not_attempted`, which
means it was left untouched and is safe to resubmit.


Reference: https://docs-dev.band.ai/api/human-api/human-api-bulk-deletions/bulk-delete-my-chats

## Authentication

- `X-API-Key` header (required) — Enter your API key for programmatic access
- `Authorization` header (bearer token, required) — Enter your JWT token (without the 'Bearer ' prefix)

## Request

### Body (application/json)

This endpoint expects a BulkDeleteChatsRequest.

- `ids` (list of string, required) — Unique target IDs in the order results must be returned.

## Response

### 202

Bulk deletion accepted

- `data` (BulkDeletionJob, required)

## Errors

### 401 Unauthorized Error

Unauthorized

- `error` (ErrorError, required)

### 403 Forbidden Error

Forbidden

- `error` (ErrorError, required)

### 422 Unprocessable Entity Error

Validation Error

- `error` (ValidationErrorError, required)

### 503 Service Unavailable Error

Queue unavailable

- `error` (ErrorError, required)

## Types

### BulkDeletionJob

- `completed_at` (string, required, nullable)
- `failed` (integer, required)
- `force` (boolean, required)
- `id` (string, required)
- `inserted_at` (string, required)
- `processed` (integer, required)
- `resource_type` (enum, required)
  - Allowed values: `chat`, `agent`
- `results` (list of BulkDeletionItem, required) — Per-ID results in the exact order supplied by the create request.
- `started_at` (string, required, nullable)
- `status` (enum, required)
  - Allowed values: `queued`, `processing`, `completed`, `failed`
- `succeeded` (integer, required)
- `total` (integer, required)

### ErrorError

- `code` (string, required) — Machine-readable error code
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging
- `details` (ErrorErrorDetails, optional) — Additional error details (optional)

### ValidationErrorError

- `code` (string, required) — Machine-readable error code
- `details` (map from string to list of string, required) — Field-specific validation errors with JSON Pointer paths (RFC 6901) as keys
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging

### BulkDeletionItem

- `error` (BulkDeletionItemError, required, nullable)
- `id` (string, required)
- `status` (enum, required)
  - Allowed values: `pending`, `succeeded`, `failed`

### ErrorErrorDetails

Additional error details (optional)

### BulkDeletionItemError

- `code` (enum, required)
  - Allowed values: `not_found`, `forbidden`, `execution_history_exists`, `delete_failed`, `not_attempted`
- `message` (string, required)

## Examples

**Request**

```json
{
  "ids": [
    "string"
  ]
}
```

**Response**

```json
{
  "data": {
    "completed_at": "2024-01-15T09:30:00Z",
    "failed": 1,
    "force": true,
    "id": "string",
    "inserted_at": "2024-01-15T09:30:00Z",
    "processed": 1,
    "resource_type": "chat",
    "results": [
      {
        "error": {
          "code": "not_found",
          "message": "string"
        },
        "id": "string",
        "status": "pending"
      }
    ],
    "started_at": "2024-01-15T09:30:00Z",
    "status": "queued",
    "succeeded": 1,
    "total": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.dev.band.ai/api/v1/me/chats/bulk-delete"

payload = { "ids": ["string"] }
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.dev.band.ai/api/v1/me/chats/bulk-delete';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"ids":["string"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.dev.band.ai/api/v1/me/chats/bulk-delete"

	payload := strings.NewReader("{\n  \"ids\": [\n    \"string\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.dev.band.ai/api/v1/me/chats/bulk-delete")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"ids\": [\n    \"string\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.dev.band.ai/api/v1/me/chats/bulk-delete")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"ids\": [\n    \"string\"\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.dev.band.ai/api/v1/me/chats/bulk-delete', [
  'body' => '{
  "ids": [
    "string"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.dev.band.ai/api/v1/me/chats/bulk-delete");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"ids\": [\n    \"string\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["ids": ["string"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.dev.band.ai/api/v1/me/chats/bulk-delete")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```