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

# Batch Stop Threads

POST https://api.athenaintel.com/api/v0/threads/stop
Content-Type: application/json

Stop multiple running thread executions in a single request. This endpoint accepts thread IDs (the same IDs used with the single-thread stop endpoint). Each thread is stopped independently - failures for individual threads do not affect other threads in the batch.

Reference: https://docs.athenaintel.com/api-reference/threads/batch-stop

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a ThreadBatchStopRequest.

- `thread_ids` (list of string, required) — List of thread IDs to stop

## Response

### 200

Batch stop completed (check results for individual thread status)

- `failed_count` (integer, required) — Number of threads that failed to stop
- `results` (list of ThreadBatchStopResultItem, required) — Detailed results for each thread
- `stopped_count` (integer, required) — Number of threads successfully stopped
- `total_requested` (integer, required) — Total number of threads requested to stop

## Errors

### 401 Unauthorized Error

Unauthorized

- `message` (string, required)

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 500 Internal Server Error

Internal server error during batch stop

- `map from string to any`

## Types

### ThreadBatchStopResultItem

Result for a single thread in batch stop operation.

- `success` (boolean, required) — Whether the stop was successful
- `thread_id` (string, required) — The thread ID
- `error` (string, optional, nullable) — Error message if stop failed

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Request**

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

**Response**

```json
{
  "failed_count": 1,
  "results": [
    {
      "success": true,
      "thread_id": "thread_12345-6789-abcd-efgh"
    },
    {
      "success": true,
      "thread_id": "thread_22222-3333-4444-5555"
    },
    {
      "success": false,
      "thread_id": "thread_99999-8888-7777-6666",
      "error": "Thread not found"
    }
  ],
  "stopped_count": 2,
  "total_requested": 3
}
```

**SDK Code**

```python threads_batch_stop_example
import requests

url = "https://api.athenaintel.com/api/v0/threads/stop"

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

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

print(response.json())
```

```javascript threads_batch_stop_example
const url = 'https://api.athenaintel.com/api/v0/threads/stop';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"thread_ids":["string"]}'
};

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

```go threads_batch_stop_example
package main

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

func main() {

	url := "https://api.athenaintel.com/api/v0/threads/stop"

	payload := strings.NewReader("{\n  \"thread_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 threads_batch_stop_example
require 'uri'
require 'net/http'

url = URI("https://api.athenaintel.com/api/v0/threads/stop")

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  \"thread_ids\": [\n    \"string\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.athenaintel.com/api/v0/threads/stop")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"thread_ids\": [\n    \"string\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/threads/stop', [
  'body' => '{
  "thread_ids": [
    "string"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp threads_batch_stop_example
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/threads/stop");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"thread_ids\": [\n    \"string\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift threads_batch_stop_example
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/threads/stop")! 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()
```