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

# Stop an execution

DELETE https://clients.infonite.tech/api/executions/handler/v1/{execution_id}/abort

Stop an execution that is still running.

Use it when your own process no longer needs the answer — your customer abandoned the journey, the case was closed, a timeout of yours fired. The execution closes as `ABORTED` with `CLIENT_CANCELLED`, which reads as a cancellation and not as a failure anywhere you look at it later.

**Whatever was already retrieved stays readable** until you delete the execution. Aborting also frees the slot immediately, which clears the `409` that blocks a new execution for the same customer and engine.

| Status | Meaning                                                                                                                      |
| :----- | :--------------------------------------------------------------------------------------------------------------------------- |
| `204`  | Stopped. No body.                                                                                                            |
| `304`  | It had already closed on its own. Nothing changed — **aborting twice is safe**, and this is the second answer, not an error. |
| `404`  | No such execution for your application, or it has been deleted.                                                              |

**A paused execution is a good candidate.** One waiting on a challenge your customer will never answer holds nothing useful: abort it rather than letting it reach `ACTION_TIMEOUT` on its own.

**Server to server only.** This call is authorised with your application secret: it belongs in your backend, never in a browser, a mobile app or anything your customer can read.

Reference: https://infonite.dev/api-reference/direct-executions/direct-executions-api/handling-the-state/direct-executions-v-1-handler-abort

## Authentication

- `X-APP-SECRET` header (required) — Application Secret

## Servers

- `https://clients.infonite.tech/api` (Legacy Server, default)
- `https://clients.infonite.io/api` (Production Server)

## Request

### Path parameters

- `execution_id` (string, required) — The execution, as the acceptance response returned it.

## Response

### 204

**204 No Content**Stopped. The execution closes as `ABORTED` with `CLIENT_CANCELLED`. No body.

## Errors

### 404 Not Found Error

**404 Not Found**No execution with that id for your application, or it has been deleted.

- `detail` (string, required) — Error message

### 409 Conflict Error

**409 Conflict**This execution cannot be stopped from outside at the moment.

- `detail` (string, required) — Error message

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of object, optional)
  - `loc` (list of string or integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any, optional)
  - `ctx` (object, optional)

## Examples

**SDK Code**

```python
import requests

url = "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort"

headers = {"X-APP-SECRET": "<apiKey>"}

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

print(response.json())
```

```javascript
const url = 'https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort';
const options = {method: 'DELETE', headers: {'X-APP-SECRET': '<apiKey>'}};

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://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort"

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

	req.Header.Add("X-APP-SECRET", "<apiKey>")

	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://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort")

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

request = Net::HTTP::Delete.new(url)
request["X-APP-SECRET"] = '<apiKey>'

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.delete("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort")
  .header("X-APP-SECRET", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort', [
  'headers' => [
    'X-APP-SECRET' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort");
var request = new RestRequest(Method.DELETE);
request.AddHeader("X-APP-SECRET", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-APP-SECRET": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/abort")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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()
```