---
title: "cancelSession"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# cancelSession

Path: agenthold API › sessions

`POST /sessions/{sessionId}/cancel`

URL: `/api/v1/sessions/{sessionId}/cancel`

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `sessionId` (`cancelSession.path.sessionId`; string, required)

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/api/v1/sessions/<sessionId>/cancel' \
  --cookie 'agenthold_session=<agenthold_session>'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/sessions/<sessionId>/cancel';
const options = {
  method: 'POST',
  headers: {cookie: 'agenthold_session=<agenthold_session>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/sessions/<sessionId>/cancel"

headers = {"cookie": "agenthold_session=<agenthold_session>"}

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

print(response.text)
```

## Responses

### 202

Cancellation requested.

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelSession.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelSession.response.404.error`; string, required)

### 409

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelSession.response.409.error`; string, required)


Source: https://agenthold.dev/api/cancel-session/index.md
