# Cancel Shared Thread Response

Cancels the in-progress streaming response the caller started on the live-shared thread behind a share link — the slug-scoped twin of [Cancel a Response Stream](/api-reference/responses/cancel-stream) for a recipient who joined via this slug.

A joiner may cancel **only** a stream they started (their own user is on the active stream); they cannot cancel the owner's or another joiner's turn. Allowed **only** when the link's `access_level` is `live` (`403` otherwise); an unknown or unauthorized link — or no active stream the caller owns — returns `404`.

## Authentication

Requires **user** authentication. Authenticate with a Bearer token or `x-api-key` header.

## Path Parameters

**`slug`** string required

The share-link slug, taken from the share URL.

## Returns

A JSON object describing the cancellation outcome:

- **`success`** — whether the cancel was accepted.
- **`cancel_mode`** — `quick_edit` (within the quick-edit window: both the user message and the partial assistant response are removed) or `keep_partial` (the partial assistant response is saved).
- **`elapsed_seconds`** — how long the stream had been running.
- **`user_message_deleted`** / **`assistant_response_deleted`** / **`partial_content_saved`** — what changed.


## Code Examples

### cURL


```bash
curl -X POST "https://api.aitronos.com/v1/shared-threads/abc123slug/cancel" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Python SDK


```python
from aitronos import Aitronos

client = Aitronos(api_key="", token="YOUR_TOKEN")
result = client.threads.shared.cancel(slug="abc123slug")
print(result)
```

### Python (requests)


```python
import requests

response = requests.post(
    "https://api.aitronos.com/v1/shared-threads/abc123slug/cancel",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
)
print(response.json())
```

### JavaScript


```javascript
const response = await fetch(
  "https://api.aitronos.com/v1/shared-threads/abc123slug/cancel",
  {
    method: "POST",
    headers: { Authorization: "Bearer YOUR_TOKEN" },
  },
);
console.log(await response.json());
```

## Response Examples

### Success (200)


```json
{
  "success": true,
  "cancel_mode": "keep_partial",
  "elapsed_seconds": 7.3,
  "user_message_deleted": false,
  "assistant_response_deleted": false,
  "partial_content_saved": true
}
```

### Error — Link does not grant live access (403)


```json
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "This share link does not grant live co-working access",
    "system_message": "Insufficient permissions",
    "type": "authorization_error",
    "status": 403,
    "details": {
      "link_id": "slink_2b1c3d4e5f6a7b8c9d0e1f2a3b4c5d6e",
      "access_level": "view"
    },
    "trace_id": "...",
    "timestamp": "..."
  }
}
```

### Error — No active stream for this thread (404)


```json
{
  "success": false,
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "message": "No active stream found for this thread",
    "system_message": "No active stream found for this thread",
    "type": "client_error",
    "status": 404,
    "details": {},
    "trace_id": "...",
    "timestamp": "..."
  }
}
```

## Related Resources

- [Send to Shared Thread](/api-reference/shared-threads/send-shared-thread) — Post a message to the shared thread
- [Reconnect to Shared Thread Stream](/api-reference/shared-threads/reconnect-shared-thread-stream) — Resume an in-flight response
- [Live Shared Thread](/api-reference/shared-threads/live-shared-thread) — Subscribe to the co-working event stream