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

# Stop a durable client execution

POST https://api.runtype.com/v1/client/conversations/{conversationId}/executions/{executionId}/cancel

Cancel the specified execution without starting a replacement. For a native agent, pending inputs become not applied; for a Claude Managed agent, the hosted session is interrupted and stays resumable. Requires the exact visitor and session bound to the conversation.

Reference: https://docs.runtype.com/api-reference/runtype-api/client-runtime/stop-a-durable-client-execution

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Path parameters

- `conversationId` (string, required)
- `executionId` (string, required)

### Query parameters

- `sessionId` (string, required)

### Headers

- `x-visitor-token` (string, required) — The browser's anonymous visitor secret (`cvt_…`) returned by `/client/init`. It is what scopes the request to one visitor's own conversations, so a request without it is refused. Sent as a header so it never lands in access logs or `Referer`.
- `x-identity-proof` (string, optional) — Optional fresh hosted end-user identity proof. When admitted and already bound to the presented visitor, expands the request from this exact browser to sibling visitors for the same verified person. Without it, even a previously bound visitor remains exact-browser scoped.

## Response

### 202

Cancellation accepted

- `accepted` (boolean, required)
- `executionId` (string, required)

## Errors

### 401 Unauthorized Error

Missing or expired session or visitor credential

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 403 Forbidden Error

Inactive client token or origin mismatch

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 404 Not Found Error

Execution or delivery not owned by this visitor conversation

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 409 Conflict Error

Execution is already terminal or no longer cancellable

- `accepted` (boolean, required)
- `executionId` (string, required)
- `reason` (string, optional)

### 429 Too Many Requests Error

Visitor request rate exceeded

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

## Types

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

## Examples

**Response**

```json
{
  "accepted": true,
  "executionId": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel"

querystring = {"sessionId":"sessionId"}

headers = {"x-visitor-token": "x-visitor-token"}

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

print(response.json())
```

```javascript
const url = 'https://api.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId';
const options = {method: 'POST', headers: {'x-visitor-token': 'x-visitor-token'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId"

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

	req.Header.Add("x-visitor-token", "x-visitor-token")

	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.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId")

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

request = Net::HTTP::Post.new(url)
request["x-visitor-token"] = 'x-visitor-token'

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.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId")
  .header("x-visitor-token", "x-visitor-token")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId', [
  'headers' => [
    'x-visitor-token' => 'x-visitor-token',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId");
var request = new RestRequest(Method.POST);
request.AddHeader("x-visitor-token", "x-visitor-token");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["x-visitor-token": "x-visitor-token"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/client/conversations/conversationId/executions/executionId/cancel?sessionId=sessionId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```