# Delete all threads Delete all threads belonging to the authenticated user. Optionally scoped to a specific organization. Soft-deletes all threads for the authenticated user. If `organization_id` is provided, only threads within that organization are deleted. If omitted, threads across all organizations are deleted. #### Query Parameters **`organization_id`** string optional Scope deletion to a specific organization. Must start with `org_`. If omitted, all threads across all organizations are deleted. ## Returns Returns the count of deleted threads and a confirmation message. Request ```bash cURL # Delete all threads (all organizations) curl -X DELETE "https://api.aitronos.com/v1/threads" \ -H "X-API-Key: $FREDDY_API_KEY" # Delete all threads in a specific organization curl -X DELETE "https://api.aitronos.com/v1/threads?organization_id=org_abc123" \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") client.threads.delete_all_threads(organization_id="org_abc123") print("All threads deleted.") ``` ```python Python import os import requests api_key = os.environ["FREDDY_API_KEY"] # Delete all threads in a specific organization response = requests.delete( "https://api.aitronos.com/v1/threads", headers={"X-API-Key": api_key}, params={"organization_id": "org_abc123"}, ) result = response.json() print(f"Deleted {result['deleted']} thread(s)") ``` ```javascript JavaScript const apiKey = process.env.FREDDY_API_KEY; const response = await fetch( "https://api.aitronos.com/v1/threads?organization_id=org_abc123", { method: "DELETE", headers: { "X-API-Key": apiKey, }, } ); const result = await response.json(); console.log(`Deleted ${result.deleted} thread(s)`); ``` Response ```json 200 OK { "deleted": 42, "message": "Successfully deleted 42 thread(s)" } ``` ```json 4xx Error { "success": false, "error": { "code": "VALIDATION_ERROR", "message": "Please check your input and try again.", "system_message": "Invalid organization_id format. Must start with 'org_'", "type": "validation_error", "status": 422, "details": { "organization_id": "invalid_id" }, "trace_id": "abc-123-def", "timestamp": "2025-12-22T15:30:00Z" } } ``` ## Related Resources - [Delete Thread](/docs/api-reference/threads/delete) - [List Threads](/docs/api-reference/threads/list) - [Threads Overview](/docs/documentation/core-concepts/threads-overview)